Skip to content

Commit db7a169

Browse files
committed
chore(plugins/googleai): better variable names
1 parent 2a17d13 commit db7a169

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

js/plugins/googleai/src/index.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ async function listActions(options?: PluginOptions): Promise<ActionMetadata[]> {
139139
// Filter out deprecated
140140
.filter((m) => !m.description || !m.description.includes('deprecated'))
141141
.map((m) => {
142-
const name = m.name.split('/').at(-1)!;
142+
const imagenModelName = m.name.split('/').at(-1)!;
143143

144144
return modelActionMetadata({
145-
name: name,
145+
name: imagenModelName,
146146
info: { ...GENERIC_IMAGEN_INFO },
147147
configSchema: ImagenConfigSchema,
148148
});
@@ -157,10 +157,10 @@ async function listActions(options?: PluginOptions): Promise<ActionMetadata[]> {
157157
// Filter out deprecated
158158
.filter((m) => !m.description || !m.description.includes('deprecated'))
159159
.map((m) => {
160-
const name = m.name.split('/').at(-1)!;
160+
const veoModelName = m.name.split('/').at(-1)!;
161161

162162
return modelActionMetadata({
163-
name: name, // Return unprefixed name for v2
163+
name: veoModelName,
164164
info: { ...GENERIC_VEO_INFO },
165165
configSchema: VeoConfigSchema,
166166
background: true,
@@ -172,13 +172,13 @@ async function listActions(options?: PluginOptions): Promise<ActionMetadata[]> {
172172
// Filter out deprecated
173173
.filter((m) => !m.description || !m.description.includes('deprecated'))
174174
.map((m) => {
175-
const bare = m.name.startsWith('models/')
175+
const modelName = m.name.startsWith('models/')
176176
? m.name.substring('models/'.length)
177177
: m.name;
178-
const ref = gemini(bare);
178+
const ref = gemini(modelName);
179179

180180
return modelActionMetadata({
181-
name: bare, // Return unprefixed name for v2
181+
name: modelName,
182182
info: ref.info,
183183
configSchema: GeminiConfigSchema,
184184
});
@@ -189,16 +189,16 @@ async function listActions(options?: PluginOptions): Promise<ActionMetadata[]> {
189189
// Filter out deprecated
190190
.filter((m) => !m.description || !m.description.includes('deprecated'))
191191
.map((m) => {
192-
const bare = m.name.startsWith('models/')
192+
const embedderName = m.name.startsWith('models/')
193193
? m.name.substring('models/'.length)
194194
: m.name;
195195

196196
return embedderActionMetadata({
197-
name: bare, // Return unprefixed name for v2
197+
name: embedderName,
198198
configSchema: GeminiEmbeddingConfigSchema,
199199
info: {
200200
dimensions: 768,
201-
label: `Google Gen AI - ${bare}`,
201+
label: `Google Gen AI - ${embedderName}`,
202202
supports: {
203203
input: ['text'],
204204
},
@@ -216,7 +216,6 @@ export function googleAIPlugin(options?: PluginOptions): GenkitPluginV2 {
216216
return genkitPluginV2({
217217
name: 'googleai',
218218
async init() {
219-
// Eagerly return actions to register.
220219
const actions: any[] = [];
221220
const apiVersions = Array.isArray(options?.apiVersion)
222221
? options!.apiVersion
@@ -300,7 +299,6 @@ export function googleAIPlugin(options?: PluginOptions): GenkitPluginV2 {
300299
},
301300
async list() {
302301
if (listActionsCache) return listActionsCache;
303-
// Must return UNNAMESPACED names in v2. Genkit will prefix them.
304302
listActionsCache = await listActions(options);
305303
return listActionsCache;
306304
},

0 commit comments

Comments
 (0)