@@ -90,7 +90,7 @@ export namespace ProviderTransform {
9090 if (
9191 model . providerID === "mistral" ||
9292 model . api . id . toLowerCase ( ) . includes ( "mistral" ) ||
93- model . api . id . toLocaleLowerCase ( ) . includes ( "devstral" )
93+ model . api . id . toLowerCase ( ) . includes ( "devstral" )
9494 ) {
9595 const result : ModelMessage [ ] = [ ]
9696 for ( let i = 0 ; i < msgs . length ; i ++ ) {
@@ -296,7 +296,7 @@ export namespace ProviderTransform {
296296 if ( id . includes ( "gemini" ) ) return 1.0
297297 if ( id . includes ( "glm-4.6" ) ) return 1.0
298298 if ( id . includes ( "glm-4.7" ) ) return 1.0
299- if ( id . includes ( "minimax-m2" ) ) return 1.0
299+ if ( id . includes ( "minimax-m2" ) || id . includes ( "minimax-m3" ) ) return 1.0
300300 if ( id . includes ( "kimi-k2" ) ) {
301301 // kimi-k2-thinking & kimi-k2.5 && kimi-k2p5
302302 if ( id . includes ( "thinking" ) || id . includes ( "k2." ) || id . includes ( "k2p" ) ) {
@@ -310,16 +310,16 @@ export namespace ProviderTransform {
310310 export function topP ( model : Provider . Model ) {
311311 const id = model . id . toLowerCase ( )
312312 if ( id . includes ( "qwen" ) ) return 1
313- if ( id . includes ( "minimax-m2" ) || id . includes ( "kimi-k2.5" ) || id . includes ( "kimi-k2p5" ) || id . includes ( "gemini" ) ) {
313+ if ( id . includes ( "minimax-m2" ) || id . includes ( "minimax-m3" ) || id . includes ( " kimi-k2.5") || id . includes ( "kimi-k2p5" ) || id . includes ( "gemini" ) ) {
314314 return 0.95
315315 }
316316 return undefined
317317 }
318318
319319 export function topK ( model : Provider . Model ) {
320320 const id = model . id . toLowerCase ( )
321- if ( id . includes ( "minimax-m2" ) ) {
322- if ( id . includes ( "m2.1" ) ) return 40
321+ if ( id . includes ( "minimax-m2" ) || id . includes ( "minimax-m3" ) ) {
322+ if ( id . includes ( "m2.1" ) || id . includes ( "m3" ) ) return 40
323323 return 20
324324 }
325325 if ( id . includes ( "gemini" ) ) return 64
@@ -1011,8 +1011,8 @@ export namespace ProviderTransform {
10111011 }
10121012
10131013 export function schema ( model : Provider . Model , schema : JSONSchema . BaseSchema | JSONSchema7 ) : JSONSchema7 {
1014- // Sanitize MCP tool schemas for OpenAI/Azure compatibility
1015- if ( model . api . npm === "@ai-sdk/openai" || model . api . npm === "@ai-sdk/azure" ) {
1014+ // Sanitize MCP tool schemas for OpenAI/Azure/Copilot compatibility
1015+ if ( model . api . npm === "@ai-sdk/openai" || model . api . npm === "@ai-sdk/azure" || model . api . npm === "@ai-sdk/github-copilot" ) {
10161016 schema = sanitizeOpenAISchema ( schema ) as JSONSchema7
10171017 }
10181018
@@ -1059,12 +1059,25 @@ export namespace ProviderTransform {
10591059 }
10601060 }
10611061
1062+ // Gemini does not support type arrays like ["string", "null"].
1063+ // Flatten to the first non-null type, or fall back to "string".
1064+ if ( Array . isArray ( result . type ) ) {
1065+ const nonNull = ( result . type as string [ ] ) . filter ( ( t ) => t !== "null" )
1066+ result . type = nonNull [ 0 ] ?? "string"
1067+ result . nullable = true
1068+ }
1069+
10621070 // Remove properties/required from non-object types (Gemini rejects these)
10631071 if ( result . type && result . type !== "object" ) {
10641072 delete result . properties
10651073 delete result . required
1074+ delete result . additionalProperties
10661075 }
10671076
1077+ // Gemini does not support $defs / definitions
1078+ delete result . $defs
1079+ delete result . definitions
1080+
10681081 return result
10691082 }
10701083
0 commit comments