Skip to content

Commit 14a0263

Browse files
committed
Merge branch '@invertase/migrate-googlegenai-plugin' of https://github.com/firebase/genkit into @invertase/migrate-googlegenai-plugin
2 parents 9c0d3e2 + 387027d commit 14a0263

File tree

5 files changed

+9
-30
lines changed

5 files changed

+9
-30
lines changed

js/plugins/google-genai/src/googleai/embedder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const KNOWN_MODELS = {
9090
};
9191
export type KnownModels = keyof typeof KNOWN_MODELS; // For autocomplete
9292

93-
export function createModelRef(
93+
export function createEmbedderRef(
9494
version: string,
9595
config: EmbeddingConfig = {}
9696
): EmbedderReference<ConfigSchemaType> {
@@ -112,7 +112,7 @@ export function listActions(models: Model[]): ActionMetadata[] {
112112
// Filter out deprecated
113113
.filter((m) => !m.description || !m.description.includes('deprecated'))
114114
.map((m) => {
115-
const ref = createModelRef(m.name);
115+
const ref = createEmbedderRef(m.name);
116116
return embedderActionMetadata({
117117
name: ref.name,
118118
info: ref.info,
@@ -133,7 +133,7 @@ export function defineEmbedder(
133133
pluginOptions?: GoogleAIPluginOptions
134134
): EmbedderAction {
135135
checkApiKey(pluginOptions?.apiKey);
136-
const ref = createModelRef(name);
136+
const ref = createEmbedderRef(name);
137137

138138
return embedder(
139139
{

js/plugins/google-genai/src/googleai/imagen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const KNOWN_MODELS = {
126126
} as const;
127127
export type KnownModels = keyof typeof KNOWN_MODELS; // For autocomplete
128128

129-
// For conditional types in index.ts model
129+
// For conditional types in index.ts model()
130130
export type ImagenModelName = `imagen-${string}`;
131131
export function isImagenModelName(value?: string): value is ImagenModelName {
132132
return !!value?.startsWith('imagen-');

js/plugins/google-genai/src/googleai/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ googleAI.embedder = (
172172
name: string,
173173
config?: embedder.EmbeddingConfig
174174
): EmbedderReference<embedder.EmbeddingConfigSchemaType> => {
175-
return embedder.createModelRef(name, config);
175+
return embedder.createEmbedderRef(name, config);
176176
};
177177

178178
export default googleAI;

js/plugins/google-genai/src/vertexai/embedder.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import {
18-
ActionMetadata,
19-
embedderActionMetadata,
20-
z,
21-
type Document,
22-
} from 'genkit';
17+
import { z, type Document } from 'genkit';
2318
import {
2419
EmbedderInfo,
2520
embedderRef,
@@ -34,7 +29,6 @@ import {
3429
EmbeddingInstance,
3530
EmbeddingPrediction,
3631
EmbeddingResult,
37-
Model,
3832
TaskTypeSchema,
3933
VertexPluginOptions,
4034
isMultimodalEmbeddingPrediction,
@@ -122,7 +116,7 @@ export function isEmbedderModelName(
122116
return !!value?.includes('embedding');
123117
}
124118

125-
export function createModelRef(
119+
export function createEmbedderRef(
126120
version: string,
127121
config: EmbeddingConfig = {}
128122
): EmbedderReference<ConfigSchemaType> {
@@ -159,21 +153,6 @@ export function createModelRef(
159153
});
160154
}
161155

162-
// Takes a full list of models, filters for current Veo models only
163-
// and returns a modelActionMetadata for each.
164-
export function listActions(models: Model[]): ActionMetadata[] {
165-
return models
166-
.filter((m: Model) => isEmbedderModelName(m.name))
167-
.map((m: Model) => {
168-
const ref = createModelRef(m.name);
169-
return embedderActionMetadata({
170-
name: ref.name,
171-
info: ref.info,
172-
configSchema: ref.configSchema,
173-
});
174-
});
175-
}
176-
177156
export function defineKnownModels(
178157
clientOptions: ClientOptions,
179158
pluginOptions?: VertexPluginOptions
@@ -188,7 +167,7 @@ export function defineEmbedder(
188167
clientOptions: ClientOptions,
189168
pluginOptions?: VertexPluginOptions
190169
): EmbedderAction<any> {
191-
const ref = createModelRef(name);
170+
const ref = createEmbedderRef(name);
192171

193172
return embedder(
194173
{

js/plugins/google-genai/src/vertexai/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ vertexAI.embedder = (
156156
name: string,
157157
config?: embedder.EmbeddingConfig
158158
): EmbedderReference<embedder.EmbeddingConfigSchemaType> => {
159-
return embedder.createModelRef(name, config);
159+
return embedder.createEmbedderRef(name, config);
160160
};
161161

162162
export default vertexAI;

0 commit comments

Comments
 (0)