Firebase Genkit

PHOTO EMBED

Thu Jan 02 2025 09:29:06 GMT+0000 (Coordinated Universal Time)

Saved by @Liselot3

import { genkit } from 'genkit';
import { googleAI, gemini15Flash } from '@genkit-ai/googleai';

const ai = genkit({
  plugins: [googleAI()],
  model: gemini15Flash,  // Set default model
});

// Simple generation
const { text } = await ai.generate('Why is AI awesome?');
console.log(text);

// Streamed generation 
const { stream } = await ai.generateStream('Tell me a story');
for await (const chunk of stream) {
  console.log(chunk.text);
}
content_copyCOPY

https://firebase.google.com/docs/genkit