@@ -40,7 +40,6 @@ import {
4040 toGeminiSystemInstruction ,
4141 toGeminiTool ,
4242} from '../common/converters' ;
43- import { cleanSchema } from '../common/utils' ;
4443import {
4544 generateContent ,
4645 generateContentStream ,
@@ -59,7 +58,13 @@ import {
5958 Tool ,
6059 ToolConfig ,
6160} from './types' ;
62- import { calculateApiKey , checkApiKey , checkModelName } from './utils' ;
61+ import {
62+ calculateApiKey ,
63+ checkApiKey ,
64+ checkModelName ,
65+ cleanSchema ,
66+ extractVersion ,
67+ } from './utils' ;
6368
6469/**
6570 * See https://ai.google.dev/gemini-api/docs/safety-settings#safety-filters.
@@ -360,7 +365,6 @@ export function model(
360365 if ( isTTSModelName ( name ) ) {
361366 return modelRef ( {
362367 name : `googleai/${ name } ` ,
363- version : name ,
364368 config,
365369 configSchema : GeminiTtsConfigSchema ,
366370 info : { ...GENERIC_TTS_MODEL . info } ,
@@ -370,7 +374,6 @@ export function model(
370374 if ( isGemmaModelName ( name ) ) {
371375 return modelRef ( {
372376 name : `googleai/${ name } ` ,
373- version : name ,
374377 config,
375378 configSchema : GemmaConfigSchema ,
376379 info : { ...GENERIC_GEMMA_MODEL . info } ,
@@ -379,7 +382,6 @@ export function model(
379382
380383 return modelRef ( {
381384 name : `googleai/${ name } ` ,
382- version : name ,
383385 config,
384386 configSchema : GeminiConfigSchema ,
385387 info : { ...GENERIC_MODEL . info } ,
@@ -562,7 +564,7 @@ export function defineModel(
562564 contents : messages . map ( ( message ) => toGeminiMessage ( message , ref ) ) ,
563565 } ;
564566
565- const modelVersion = ( versionFromConfig || ref . version ) as string ;
567+ const modelVersion = versionFromConfig || extractVersion ( ref ) ;
566568
567569 const generateApiKey = calculateApiKey (
568570 pluginOptions ?. apiKey ,
0 commit comments