From b89cb5360b855db5485d5b0f5154132b301d2e6c Mon Sep 17 00:00:00 2001 From: Pavel Jbanov Date: Wed, 22 May 2024 13:15:58 -0400 Subject: [PATCH] Export textEmbeddingGecko001 for googleai (#217) --- docs/plugins/google-genai.md | 15 ++++++++++++++- js/plugins/googleai/src/index.ts | 9 ++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/plugins/google-genai.md b/docs/plugins/google-genai.md index 9bbaf016f..4cc4e856a 100644 --- a/docs/plugins/google-genai.md +++ b/docs/plugins/google-genai.md @@ -61,7 +61,11 @@ configureGenkit({ This plugin statically exports references to its supported models: ```js -import { geminiPro, geminiProVision } from '@genkit-ai/googleai'; +import { + geminiPro, + geminiProVision, + textEmbeddingGecko001, +} from '@genkit-ai/googleai'; ``` You can use these references to specify which model `generate()` uses: @@ -72,3 +76,12 @@ const llmResponse = await generate({ prompt: 'Tell me a joke.', }); ``` + +or use embedders (ex. `textEmbeddingGecko001`) with `embed` or retrievers: + +```js +const embedding = await embed({ + embedder: textEmbeddingGecko001, + content: input, +}); +``` diff --git a/js/plugins/googleai/src/index.ts b/js/plugins/googleai/src/index.ts index 6c436de26..9a8e649d0 100644 --- a/js/plugins/googleai/src/index.ts +++ b/js/plugins/googleai/src/index.ts @@ -17,6 +17,7 @@ import { genkitPlugin, Plugin } from '@genkit-ai/core'; import { SUPPORTED_MODELS as EMBEDDER_MODELS, + textEmbeddingGecko001, textEmbeddingGeckoEmbedder, } from './embedder.js'; import { @@ -28,7 +29,13 @@ import { SUPPORTED_V15_MODELS, SUPPORTED_V1_MODELS, } from './gemini.js'; -export { gemini15Flash, gemini15Pro, geminiPro, geminiProVision }; +export { + gemini15Flash, + gemini15Pro, + geminiPro, + geminiProVision, + textEmbeddingGecko001, +}; export interface PluginOptions { apiKey?: string;