Skip to content

Commit

Permalink
Export textEmbeddingGecko001 for googleai (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelgj authored May 22, 2024
1 parent 4feb8af commit b89cb53
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
15 changes: 14 additions & 1 deletion docs/plugins/google-genai.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
});
```
9 changes: 8 additions & 1 deletion js/plugins/googleai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import { genkitPlugin, Plugin } from '@genkit-ai/core';
import {
SUPPORTED_MODELS as EMBEDDER_MODELS,
textEmbeddingGecko001,
textEmbeddingGeckoEmbedder,
} from './embedder.js';
import {
Expand All @@ -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;
Expand Down

0 comments on commit b89cb53

Please sign in to comment.