File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ describe('Vertex Gemini request compatibility', () => {
143143 it . each ( [
144144 [ 'vertex/gemini-3.6-flash' , 'MINIMAL' ] ,
145145 [ 'vertex/gemini-3.8-flash' , 'LOW' ] ,
146+ [ 'vertex/projects/p/locations/global/publishers/google/models/gemini-3.8-flash' , 'LOW' ] ,
146147 ] ) ( "sends the lowest thinking level for 'none' on %s" , async ( model , thinkingLevel ) => {
147148 const generateContent = vi . fn ( ) . mockResolvedValue ( textTurn ( ) )
148149 await run ( model , generateContent , { thinkingLevel : 'none' } )
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ import {
5757 prepareToolExecution ,
5858 prepareToolsWithUsageControl ,
5959 sumToolCosts ,
60+ toBareGeminiModelId ,
6061} from '@/providers/utils'
6162import type { ExecutionState , GeminiProviderType , GeminiUsage } from './types'
6263
@@ -1013,9 +1014,11 @@ export async function executeGeminiRequest(
10131014 const isGemini3 = isGemini3OrLaterModel ( model )
10141015 // Gemini 3 has no off switch and omitting thinkingConfig means the model's default level, so
10151016 // 'none' sends the lowest declared level (levels are listed lowest-first; MINIMAL is closest to off).
1017+ // The catalog keys Vertex entries as vertex/<bare id>, so resource-name IDs are reduced first.
1018+ const catalogModelId = `${ providerType === 'vertex' ? 'vertex/' : '' } ${ toBareGeminiModelId ( model ) } `
10161019 const thinkingLevel =
10171020 isGemini3 && request . thinkingLevel === 'none'
1018- ? getThinkingLevelsForModel ( request . model ) ?. [ 0 ]
1021+ ? getThinkingLevelsForModel ( catalogModelId ) ?. [ 0 ]
10191022 : request . thinkingLevel
10201023 if ( thinkingLevel && thinkingLevel !== 'none' ) {
10211024 const thinkingConfig : ThinkingConfig = { includeThoughts : request . agentEvents === true }
Original file line number Diff line number Diff line change @@ -1491,16 +1491,23 @@ export function isDeepResearchModel(model: string): boolean {
14911491 return MODELS_WITH_DEEP_RESEARCH . includes ( model . toLowerCase ( ) )
14921492}
14931493
1494- /** Accepts bare Gemini IDs, google/ or vertex/ prefixes, and Google publisher resource names. */
1495- export function isGemini3OrLaterModel ( model : string ) : boolean {
1496- const normalized = model
1494+ /**
1495+ * Reduces a Gemini model reference to its bare lowercase ID (`gemini-3.8-flash`). Accepts bare
1496+ * Gemini IDs, google/ or vertex/ prefixes, and Google publisher resource names.
1497+ */
1498+ export function toBareGeminiModelId ( model : string ) : string {
1499+ return model
14971500 . toLowerCase ( )
14981501 . replace ( / ^ v e r t e x \/ / , '' )
14991502 . replace (
15001503 / ^ (?: g o o g l e \/ | (?: p r o j e c t s \/ [ ^ / ] + \/ l o c a t i o n s \/ [ ^ / ] + \/ ) ? p u b l i s h e r s \/ g o o g l e \/ m o d e l s \/ ) / ,
15011504 ''
15021505 )
1503- return Number ( normalized . match ( / ^ g e m i n i - ( \d + ) (?: [ . - ] | $ ) / ) ?. [ 1 ] ) >= 3
1506+ }
1507+
1508+ /** Accepts bare Gemini IDs, google/ or vertex/ prefixes, and Google publisher resource names. */
1509+ export function isGemini3OrLaterModel ( model : string ) : boolean {
1510+ return Number ( toBareGeminiModelId ( model ) . match ( / ^ g e m i n i - ( \d + ) (?: [ . - ] | $ ) / ) ?. [ 1 ] ) >= 3
15041511}
15051512
15061513/**
You can’t perform that action at this time.
0 commit comments