Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion js/genkit/.guides/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { googleAI } from '@genkit-ai/google-genai';

export const ai = genkit({
plugins: [googleAI()],
model: googleAI.model('gemini-2.5-flash'),
});

export { z };
Expand All @@ -26,5 +27,5 @@ import './genkit.js';
// import each created flow, tool, etc. here for use in the Genkit Dev UI
```

8. Add a `genkit:ui` script to `package.json` that runs `npx genkit-cli start -- npx tsx {sourceDir}/ai/index.ts` (or `pnpm dlx` or `yarn dlx` for those package managers). DO NOT try to run the script now.
8. Add a `genkit:ui` script to `package.json` that runs `npx genkit-cli start -- npx tsx --watch {sourceDir}/ai/index.ts` (or `pnpm dlx` or `yarn dlx` for those package managers). DO NOT try to run the script now.
9. Tell the user "Genkit is now configured and ready for use." as setup is now complete. Also remind them to set appropriate env variables (e.g. `GEMINI_API_KEY` for Google providers). Wait for the user to prompt further before creating any specific flows.
19 changes: 19 additions & 0 deletions js/plugins/google-genai/.guides/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
To use a Gemini model with Genkit:

```ts
import { ai, z } from '...'; // path to genkit instance
import { googleAI } from '@genkit-ai/google-genai';

const { text } = await ai.generate({
model: googleAI.model('gemini-2.5-flash'),
prompt: '...',
});
```

ALWAYS use `gemini-2.5-*` series models, they are the best and current generation of Gemini models. NEVER use `gemini-2.0-*` or `gemini-1.5-*` models. For general purpose inference, use one of these models:

- `gemini-2.5-flash`: balance of speed/performance, good default
- `gemini-2.5-pro`: most powerful, use for complex prompts
- `gemini-2.5-flash-lite`: very fast, use for simple prompts

All of these models can accept multi-modal input, but for image or audio output see the available documentation for specialized models.