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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions js/plugins/googleai/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import { getClientHeader as defaultGetClientHeader } from 'genkit';
import process from 'process';

/**
* @deprecated
*/
export function getApiKeyFromEnvVar(): string | undefined {
return (
process.env.GEMINI_API_KEY ||
Expand All @@ -25,6 +28,9 @@ export function getApiKeyFromEnvVar(): string | undefined {
);
}

/**
* @deprecated
*/
export function getGenkitClientHeader() {
if (process.env.MONOSPACE_ENV == 'true') {
return defaultGetClientHeader() + ' firebase-studio-vm';
Expand Down
27 changes: 27 additions & 0 deletions js/plugins/googleai/src/embedder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,24 @@ import { embedderRef } from 'genkit/embedder';
import { getApiKeyFromEnvVar } from './common.js';
import type { PluginOptions } from './index.js';

/**
* @deprecated
*/
export const TaskTypeSchema = z.enum([
'RETRIEVAL_DOCUMENT',
'RETRIEVAL_QUERY',
'SEMANTIC_SIMILARITY',
'CLASSIFICATION',
'CLUSTERING',
]);
/**
* @deprecated
*/
export type TaskType = z.infer<typeof TaskTypeSchema>;

/**
* @deprecated
*/
export const GeminiEmbeddingConfigSchema = z.object({
/** Override the API key provided at plugin initialization. */
apiKey: z.string().optional(),
Expand All @@ -58,8 +67,14 @@ export const GeminiEmbeddingConfigSchema = z.object({
outputDimensionality: z.number().min(1).max(768).optional(),
});

/**
* @deprecated
*/
export type GeminiEmbeddingConfig = z.infer<typeof GeminiEmbeddingConfigSchema>;

/**
* @deprecated
*/
export const textEmbeddingGecko001 = embedderRef({
name: 'googleai/embedding-001',
configSchema: GeminiEmbeddingConfigSchema,
Expand All @@ -72,6 +87,9 @@ export const textEmbeddingGecko001 = embedderRef({
},
});

/**
* @deprecated
*/
export const textEmbedding004 = embedderRef({
name: 'googleai/text-embedding-004',
configSchema: GeminiEmbeddingConfigSchema,
Expand All @@ -84,6 +102,9 @@ export const textEmbedding004 = embedderRef({
},
});

/**
* @deprecated
*/
export const geminiEmbedding001 = embedderRef({
name: 'googleai/gemini-embedding-001',
configSchema: GeminiEmbeddingConfigSchema,
Expand All @@ -96,12 +117,18 @@ export const geminiEmbedding001 = embedderRef({
},
});

/**
* @deprecated
*/
export const SUPPORTED_MODELS = {
'embedding-001': textEmbeddingGecko001,
'text-embedding-004': textEmbedding004,
'gemini-embedding-001': geminiEmbedding001,
};

/**
* @deprecated
*/
export function defineGoogleAIEmbedder(
ai: Genkit,
name: string,
Expand Down
Loading