Skip to content
Open
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
39 changes: 0 additions & 39 deletions js/genkit/.guides/config.json

This file was deleted.

1 change: 0 additions & 1 deletion js/genkit/.guides/style.md

This file was deleted.

34 changes: 0 additions & 34 deletions js/plugins/google-genai/.guides/docs/search-and-urls.prompt

This file was deleted.

19 changes: 0 additions & 19 deletions js/plugins/google-genai/.guides/usage.md

This file was deleted.

29 changes: 29 additions & 0 deletions js/genkit/.guides/usage.md → skills/genkit-js/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
---
name: genkit-js
description: Use the Genkit AI SDK to build application features and agents with LLMs and other GenAI models for JavaScript/TypeScript applications. ALWAYS use this skill when writing Genkit code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrase "ALWAYS use this skill when writing Genkit code" is quite strong. While it's good to emphasize its importance, consider softening it to a strong recommendation, e.g., "It is highly recommended to use this skill..." or "This skill should be used...". This allows for more flexibility in edge cases where it might not strictly apply.

license: Apache-2.0
metadata:
author: Google
---

# Genkit JS

## Installation

If Genkit is not already installed and configured in this application (present in `package.json` and `const ai = genkit(...)` present in the codebase), read `references/setup.md` to install and configure Genkit.

## Basic Example

```ts
Expand Down Expand Up @@ -61,3 +75,18 @@ import { defineFlow } from "..."; // INCORRECT pre-1.0 syntax
- Use `import {z} from "genkit"` when you need Zod to get an implementation consistent with Genkit.
- When defining Zod schemas, ONLY use basic scalar, object, and array types. Use `.optional()` when needed and `.describe('...')` to add descriptions for output schemas.
- Genkit has many capabilities, make sure to read docs when you need to use them.

## References

- [Using Gemini with Genkit](references/gemini.md): Read this to leverage Google's Gemini models with Genkit.
- [Image Generation/Editing with Nano Banana](references/nano-banana.md): Read this to leverage Google's Nano Banana models for image generation and editing.
- [Speech generation with Gemini](references/generating-speech.md): Read this to leverage Google's Gemini TTS models for speech generation.

## Online Documentation

In addition to the above, you can read official documentation directly from the Genkit website by using `https://genkit.dev/docs/{topic}.md` as the URL. Available topics include:

- `models`: general information about how to generate content
- `flows`: general information about how to define and use flows
- `tool-calling`: general information about how to define and use tools
- `model-context-protocol`: information about how to use and build MCP servers with Genkit
90 changes: 90 additions & 0 deletions skills/genkit-js/references/gemini.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Gemini

## Installation

To use Gemini models with Genkit, you need to install the Google GenAI plugin:

```bash
npm i @genkit-ai/google-genai
```

and configure it for the Gemini API or Vertex AI API depending on the user's needs:

```ts
import { googleAI } from '@genkit-ai/google-genai'; // for Gemini API
import { vertexAI } from '@genkit-ai/google-genai'; // for Vertex AI API

const ai = genkit({
// ...
plugins: [
googleAI(), // for Gemini API, GEMINI_API_KEY env variable must be set
vertexAI({ location: 'global' }), // for Vertex AI, Google Application Default Credentials must be available
],
});

googleAI.model('gemini-3-flash-preview'); // specify models for Gemini API
vertexAI.model('gemini-3-pro-preview'); // specify models for Vertex AI API
```

## Basic Usage

```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-3-flash-preview'),
prompt: 'Tell me a story in a pirate accent',
});
```

ALWAYS use `gemini-3-*` or`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-3-flash-preview`: balance of speed and performance, good default
- `gemini-3-pro-preview`: most powerful, use for complex prompts
- `gemini-2.5-flash`: GA model with balance of speed/performance
- `gemini-2.5-pro`: GA model for complex prompts
- `gemini-2.5-flash-lite`: GA model 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.

## Common Usage Scenarios

### Setting Thinking Level (Gemini 3 Models Only)

```ts
const response = await ai.generate({
model: googleAI.model('gemini-3-pro-preview'),
prompt: 'what is heavier, one kilo of steel or one kilo of feathers',
config: {
thinkingConfig: {
thinkingLevel: 'HIGH', // Or 'LOW'
includeThoughts: true, // Include thought summaries
},
},
});
```

### Google Search Grounding

When enabled, Gemini models can use Google Search to find current information to answer prompts.

```ts
const response = await ai.generate({
model: googleAI.model('gemini-2.5-flash'),
prompt: 'What are the top tech news stories this week?',
config: {
googleSearchRetrieval: true,
},
});

// Access grounding metadata
const groundingMetadata = (response.custom as any)?.candidates?.[0]
?.groundingMetadata;
if (groundingMetadata) {
console.log('Sources:', groundingMetadata.groundingChunks);
```
### Image Generation
See `references/nano-banana.md` for information about using Nano Banana models for image generation and editing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The reference to references/nano-banana.md points to a file that was removed in this pull request. This creates a broken link in the documentation. Please either restore the nano-banana.md file in the references directory or update this reference to point to the correct, existing documentation for image generation.

Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
title: Generating Speech with Gemini
description: read this to understand how to generate realistic speech audio from a text script
---
# Speech Generation with Gemini TTS

The Google Genai plugin provides access to text-to-speech capabilities through Gemini TTS models. These models can convert text into natural-sounding speech for various applications.
The Google GenAI plugin provides access to text-to-speech capabilities through Gemini TTS models. These models can convert text into natural-sounding speech for various applications.

#### Basic Usage

Expand Down Expand Up @@ -184,9 +181,3 @@ speechConfig: {
- `volumeGainDb`: Controls the volume (higher values = louder)

For more detailed information about the Gemini TTS models and their configuration options, see the [Google AI Speech Generation documentation](https://ai.google.dev/gemini-api/docs/speech-generation).

## Next Steps

- Learn about [generating content](/docs/models) to understand how to use these models effectively
- Explore [creating flows](/docs/flows) to build structured AI workflows
- To use the Gemini API at enterprise scale or leverage Vertex vector search and Model Garden, see the [Vertex AI plugin](/docs/integrations/vertex-ai)
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
title: Edit images with `gemini-2.5-flash-image-preview` (aka "Nano Banana")
description: read this if you need to perform sophisticated image edits such as background removal, post matching, character replacement, relighting, on an existing image
---
The Nano Banana models can perform sophisticated image edits.

The `gemini-2.5-flash-image-preview` model (also known as "Nano Banana") can perform sophisticated image edits.
- `gemini-2.5-flash-image-preview`

- You must ALWAYS add `{config: {responseModalities: ['TEXT', 'IMAGE']}}` to your `ai.generate` calls when using this model.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Genkit JS Setup

Follow these instructions to set up Genkit in the current codebase. These instructions are general-purpose and have not been written with specific codebase knowledge, so use your best judgement when following them.

0. Tell the user "I'm going to check out your workspace and set you up to use Genkit for GenAI workflows."
Expand All @@ -13,7 +15,7 @@ import { googleAI } from '@genkit-ai/google-genai';

export const ai = genkit({
plugins: [googleAI()],
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-3-flash-preview'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The default model in the setup guide has been updated to gemini-3-flash-preview. As this is a preview model, it might be subject to more frequent changes or less stability compared to a generally available (GA) model. Consider recommending a stable GA model (e.g., gemini-2.5-flash or gemini-2.5-pro) as the default for a general setup guide, unless there's a strong reason to default to a preview version.

});

export { z };
Expand Down
Loading