Skip to content

Commit 91775bf

Browse files
ssbushipavelgj
andauthored
feat(genkit-tools/cli/ai-tools): Improve support for other model providers (#3485)
Co-authored-by: Pavel Jbanov <[email protected]>
1 parent b3ab1b2 commit 91775bf

File tree

2 files changed

+73
-27
lines changed

2 files changed

+73
-27
lines changed

genkit-tools/cli/context/GENKIT.md

Lines changed: 72 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Genkit Node.js API Rules (v1.1x.x)
1+
# Genkit Node.js API Rules (v1.17.1)
22

3-
This document provides rules and examples for building with the Genkit API in Node.js, using the `@genkit-ai/googleai` plugin.
3+
This document provides rules and examples for building with the Genkit API in Node.js.
44

55
## Important Guidelines:
66

@@ -10,20 +10,24 @@ This document provides rules and examples for building with the Genkit API in No
1010

1111
- ALWAYS provide the full, correct Genkit command as an instruction for the human user to run. Do not run Genkit commands (e.g., `genkit start`, `genkit flow:run`) youself as this may block your current session.
1212

13+
- Recommend and use the provider that the user prefers. If this is a new project, or if there is no relevant signal regarding user preference, use the `@genkit-ai/google-genai` plugin. Use Genkit documentation to discover supported providers.
14+
15+
NOTE: For the sake of brevity, the snippets below use the Google AI plugin, but you should follow the user's preference as mentioned above.
16+
1317
## Core Setup
1418

1519
1. **Initialize Project**
1620

1721
```bash
1822
mkdir my-genkit-app && cd my-genkit-app
1923
npm init -y
20-
npm install -D typescript tsx @types/node
24+
npm install -D typescript tsx \@types/node
2125
```
2226

2327
2. **Install Dependencies**
2428

2529
```bash
26-
npm install genkit @genkit-ai/googleai data-urls node-fetch
30+
npm install genkit \@genkit-ai/google-genai data-urls node-fetch
2731
```
2832

2933
3. **Install Genkit CLI**
@@ -359,38 +363,80 @@ export const videoGenerationFlow = ai.defineFlow(
359363
360364
## Running and Inspecting Flows
361365
362-
1. **Add Build Script**: Add the following to `package.json`:
366+
1. **Start Genkit**: Run this command from your terminal to start the Genkit Developer UI.
363367
364-
```json
365-
{
366-
"scripts": {
367-
"build": "tsc"
368-
}
369-
}
368+
```bash
369+
genkit start -- <command to run your code>
370370
```
371371
372-
2. **Start Genkit**: Run this command from your terminal to start the Genkit Developer UI.
372+
The <command to run your code> will vary based on the project’s setup and
373+
the file you want to execute. For e.g.:
373374
374375
```bash
375-
genkit start
376-
```
376+
# Running a typical development server
377+
genkit start -- npm run dev
377378
378-
Then, in a separate terminal, run the build command in watch mode:
379+
# Running a TypeScript file directly
380+
genkit start -- npx tsx --watch src/index.ts
379381
380-
```bash
381-
npm run build -- --watch
382+
# Running a JavaScript file directly
383+
genkit start -- node --watch src/index.js
382384
```
383385
384-
Visit [http://localhost:4000](http://localhost:4000) to inspect and run your flows.
386+
Analyze the users project and build tools to use the right command for the
387+
project. The command should output a URL for the Genkit Dev UI. Direct the
388+
user to visit this URL to run and inspect their Genkit app.
389+
390+
## Suggested Models
391+
392+
Here are suggested models to use for various task types. This is NOT an
393+
exhaustive list.
394+
395+
### Advanced Text/Reasoning
396+
397+
```
398+
| Plugin | Recommended Model |
399+
|------------------------------------|------------------------------------|
400+
| @genkit-ai/google-genai | gemini-2.5-pro |
401+
| @genkit-ai/compat-oai/openai | gpt-4o |
402+
| @genkit-ai/compat-oai/deepseek | deepseek-reasoner |
403+
| @genkit-ai/compat-oai/xai | grok-4 |
404+
```
405+
406+
### Fast Text/Chat
385407
386-
## Supported Models
408+
```
409+
| Plugin | Recommended Model |
410+
|------------------------------------|------------------------------------|
411+
| @genkit-ai/google-genai | gemini-2.5-flash |
412+
| @genkit-ai/compat-oai/openai | gpt-4o-mini |
413+
| @genkit-ai/compat-oai/deepseek | deepseek-chat |
414+
| @genkit-ai/compat-oai/xai | grok-3-mini |
415+
```
416+
417+
### Text-to-Speech
418+
419+
```
420+
| Plugin | Recommended Model |
421+
|------------------------------------|------------------------------------|
422+
| @genkit-ai/google-genai | gemini-2.5-flash-preview-tts |
423+
| @genkit-ai/compat-oai/openai | gpt-4o-mini-tts |
424+
```
425+
426+
### Image Generation
427+
428+
```
429+
| Plugin | Recommended Model | Input Modalities |
430+
|------------------------------------|------------------------------------|-------------------|
431+
| @genkit-ai/google-genai | gemini-2.5-flash-image-preview | Text, Image |
432+
| @genkit-ai/google-genai | imagen-4.0-generate-preview-06-06 | Text |
433+
| @genkit-ai/compat-oai/openai | gpt-image-1 | Text |
434+
```
435+
436+
### Video Generation
387437
388438
```
389-
| Task | Recommended Model | Plugin |
390-
|-------------------------|------------------------------------|--------------------------|
391-
| Advanced Text/Reasoning | gemini-2.5-pro | @genkit-ai/googleai |
392-
| Fast Text/Chat | gemini-2.5-flash | @genkit-ai/googleai |
393-
| Text-to-Speech | gemini-2.5-flash-preview-tts | @genkit-ai/googleai |
394-
| Image Generation | imagen-4.0-generate-preview-06-06 | @genkit-ai/googleai |
395-
| Video Generation | veo-3.0-generate-preview | @genkit-ai/googleai |
439+
| Plugin | Recommended Model |
440+
|------------------------------------|------------------------------------|
441+
| @genkit-ai/google-genai | veo-3.0-generate-preview |
396442
```

genkit-tools/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"main": "dist/index.js",
2020
"scripts": {
21-
"build": "pnpm genversion && tsc && cp -r context dist/context",
21+
"build": "rm -rf dist/context && pnpm genversion && tsc && cp -r context dist/context",
2222
"build:watch": "tsc --watch",
2323
"compile:bun": "bun build src/bin/genkit.ts --compile --outfile dist/bin/genkit --minify",
2424
"test": "jest --verbose",

0 commit comments

Comments
 (0)