File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2228,10 +2228,22 @@ function getProviderThinkingModelCompat(model: Model): ProviderThinkingModelComp
22282228 if ( ! compat || typeof compat !== "object" ) {
22292229 return undefined ;
22302230 }
2231- if ( "thinkingFormat" in compat || "supportedReasoningEfforts" in compat ) {
2232- return compat as ProviderThinkingModelCompat ;
2233- }
2234- return undefined ;
2231+ const record = compat as Record < string , unknown > ;
2232+ const thinkingFormat =
2233+ typeof record . thinkingFormat === "string" ? record . thinkingFormat : undefined ;
2234+ const supportedReasoningEfforts =
2235+ Array . isArray ( record . supportedReasoningEfforts ) &&
2236+ record . supportedReasoningEfforts . every ( ( value ) => typeof value === "string" )
2237+ ? record . supportedReasoningEfforts
2238+ : record . supportedReasoningEfforts === null
2239+ ? null
2240+ : undefined ;
2241+ return thinkingFormat || supportedReasoningEfforts !== undefined
2242+ ? {
2243+ ...( thinkingFormat ? { thinkingFormat } : { } ) ,
2244+ ...( supportedReasoningEfforts !== undefined ? { supportedReasoningEfforts } : { } ) ,
2245+ }
2246+ : undefined ;
22352247}
22362248
22372249function resolveGatewayLiveThinkingLevel ( params : { raw ?: string ; smoke : boolean } ) : string {
You can’t perform that action at this time.
0 commit comments