diff --git a/providers/google/google.go b/providers/google/google.go index 6fb1e3e20..f82314102 100644 --- a/providers/google/google.go +++ b/providers/google/google.go @@ -235,7 +235,8 @@ func (g languageModel) prepareParams(call fantasy.Call) (*genai.GenerateContentC } } - systemInstructions, content, warnings := toGooglePrompt(call.Prompt) + isVertexAI := g.providerOptions.backend == genai.BackendVertexAI + systemInstructions, content, warnings := toGooglePrompt(call.Prompt, isVertexAI) if providerOptions.ThinkingConfig != nil { if providerOptions.ThinkingConfig.IncludeThoughts != nil && @@ -347,7 +348,7 @@ func (g languageModel) prepareParams(call fantasy.Call) (*genai.GenerateContentC return config, content, warnings, nil } -func toGooglePrompt(prompt fantasy.Prompt) (*genai.Content, []*genai.Content, []fantasy.CallWarning) { //nolint: unparam +func toGooglePrompt(prompt fantasy.Prompt, isVertexAI bool) (*genai.Content, []*genai.Content, []fantasy.CallWarning) { //nolint: unparam var systemInstructions *genai.Content var content []*genai.Content var warnings []fantasy.CallWarning @@ -462,6 +463,11 @@ func toGooglePrompt(prompt fantasy.Prompt) (*genai.Content, []*genai.Content, [] Args: result, }, } + + // Vertex breaks with a 400 if this field be present. + if isVertexAI { + geminiPart.FunctionCall.ID = "" + } if currentReasoningMetadata != nil { geminiPart.ThoughtSignature = []byte(currentReasoningMetadata.Signature) currentReasoningMetadata = nil @@ -506,12 +512,18 @@ func toGooglePrompt(prompt fantasy.Prompt) (*genai.Content, []*genai.Content, [] continue } response := map[string]any{"result": content.Text} + functionResponse := &genai.FunctionResponse{ + ID: result.ToolCallID, + Response: response, + Name: toolCall.ToolName, + } + + // Vertex breaks with a 400 if this field be present. + if isVertexAI { + functionResponse.ID = "" + } parts = append(parts, &genai.Part{ - FunctionResponse: &genai.FunctionResponse{ - ID: result.ToolCallID, - Response: response, - Name: toolCall.ToolName, - }, + FunctionResponse: functionResponse, }) case fantasy.ToolResultContentTypeError: @@ -520,12 +532,18 @@ func toGooglePrompt(prompt fantasy.Prompt) (*genai.Content, []*genai.Content, [] continue } response := map[string]any{"result": content.Error.Error()} + functionResponse := &genai.FunctionResponse{ + ID: result.ToolCallID, + Response: response, + Name: toolCall.ToolName, + } + + // Vertex breaks with a 400 if this field be present. + if isVertexAI { + functionResponse.ID = "" + } parts = append(parts, &genai.Part{ - FunctionResponse: &genai.FunctionResponse{ - ID: result.ToolCallID, - Response: response, - Name: toolCall.ToolName, - }, + FunctionResponse: functionResponse, }) } } diff --git a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/multi_tool.yaml b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/multi_tool.yaml index 46966288b..a9dc94946 100644 --- a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/multi_tool.yaml +++ b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/multi_tool.yaml @@ -93,7 +93,7 @@ interactions: content_length: 1549 host: us-east5-aiplatform.googleapis.com body: | - {"contents":[{"parts":[{"text":"Add and multiply the number 2 and 3"}],"role":"user"},{"parts":[{"functionCall":{"args":{"a":2,"b":3},"id":"1","name":"add"},"thoughtSignature":"CpICAY89a1+Gm+gqy5KEfxpOLwsLfsZBhMovtwfzDW0gEBgOw+bpm9YTJExW/7mXnG4xCDgpd8nOmWA92HX3KWO9umiAKQc6u+TQRe7xqOvAyCdNFjxBVUbzVh8pRroWFnwr3ceqt4+4vMSONorj6Agki5CZ0wl3XHlgxr7kEAMiVuka9Mdi2dYSBB2zfaKSZMHznl8uetDyUXnGvZj4GWPHsayBrFUqYeDko8GyzlqfpN2ZB3SjqobwjWw6L3QpABB613LYDHy52QaSbX3AFyr0YEE38lujZXqDtUmEyRs9v3I7fJ6jsTDUH9tmQ7vdvpp/pNzsfE/qnEP8PF0cGnkQg04x4nOcpK1oGzzhrs6seGYDVQ=="},{"functionCall":{"args":{"a":2,"b":3},"id":"2","name":"multiply"}}],"role":"model"},{"parts":[{"functionResponse":{"id":"1","name":"add","response":{"result":"5"}}},{"functionResponse":{"id":"2","name":"multiply","response":{"result":"6"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant. CRITICAL: Always use both add and multiply at the same time ALWAYS."}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Add two numbers","name":"add","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}},{"description":"Multiply two numbers","name":"multiply","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}}]}]} + {"contents":[{"parts":[{"text":"Add and multiply the number 2 and 3"}],"role":"user"},{"parts":[{"functionCall":{"args":{"a":2,"b":3},"name":"add"},"thoughtSignature":"CpICAY89a1+Gm+gqy5KEfxpOLwsLfsZBhMovtwfzDW0gEBgOw+bpm9YTJExW/7mXnG4xCDgpd8nOmWA92HX3KWO9umiAKQc6u+TQRe7xqOvAyCdNFjxBVUbzVh8pRroWFnwr3ceqt4+4vMSONorj6Agki5CZ0wl3XHlgxr7kEAMiVuka9Mdi2dYSBB2zfaKSZMHznl8uetDyUXnGvZj4GWPHsayBrFUqYeDko8GyzlqfpN2ZB3SjqobwjWw6L3QpABB613LYDHy52QaSbX3AFyr0YEE38lujZXqDtUmEyRs9v3I7fJ6jsTDUH9tmQ7vdvpp/pNzsfE/qnEP8PF0cGnkQg04x4nOcpK1oGzzhrs6seGYDVQ=="},{"functionCall":{"args":{"a":2,"b":3},"name":"multiply"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"add","response":{"result":"5"}}},{"functionResponse":{"name":"multiply","response":{"result":"6"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant. CRITICAL: Always use both add and multiply at the same time ALWAYS."}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Add two numbers","name":"add","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}},{"description":"Multiply two numbers","name":"multiply","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}}]}]} headers: Content-Type: - application/json diff --git a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/multi_tool_streaming.yaml b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/multi_tool_streaming.yaml index 402d8b1ee..e3f389007 100644 --- a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/multi_tool_streaming.yaml +++ b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/multi_tool_streaming.yaml @@ -41,7 +41,7 @@ interactions: content_length: 1580 host: us-east5-aiplatform.googleapis.com body: | - {"contents":[{"parts":[{"text":"Add and multiply the number 2 and 3"}],"role":"user"},{"parts":[{"functionCall":{"args":{"a":2,"b":3},"id":"1","name":"add"},"thoughtSignature":"Ci8Bjz1rXzqIUO4hDWx0cIAcS3Hli+/00t0xZ4R9333aTdPmmlba6GoelrnrKuw/5QpYAY89a1+iCNlnCLeZt0CFSSVel5kXqgPJj48xE+/YrJEhlVDNA03z0nIXONvDkvD+rzRU6eVqyqW/DXnkzlDMZfPtb+fkfZAbxATyw7AZKiLraxgziRvSgAp3AY89a19GL62f0CVqxq8XDq1IDLBlTjD225ayNTwB8S84TC6uBdF/KD8K9qz5o3Zcu8F4cqUuA0b8jvyuMrjS8Wyv5ZNuUgruWTbdjpuZV+JkjU74hDoom9EwIdI3A8AavPrGZiLXAdAkKQfAksXiEQOjlPiFwGYKNAGPPWtf/eKZatmuUApeWonkTgVe57SlMCNW/afNRK3Iw/inXuM2Y5IFJV0ogxj9SUEUsT0="},{"functionCall":{"args":{"a":2,"b":3},"id":"2","name":"multiply"}}],"role":"model"},{"parts":[{"functionResponse":{"id":"1","name":"add","response":{"result":"5"}}},{"functionResponse":{"id":"2","name":"multiply","response":{"result":"6"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant. Always use both add and multiply at the same time."}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Add two numbers","name":"add","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}},{"description":"Multiply two numbers","name":"multiply","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}}]}]} + {"contents":[{"parts":[{"text":"Add and multiply the number 2 and 3"}],"role":"user"},{"parts":[{"functionCall":{"args":{"a":2,"b":3},"name":"add"},"thoughtSignature":"Ci8Bjz1rXzqIUO4hDWx0cIAcS3Hli+/00t0xZ4R9333aTdPmmlba6GoelrnrKuw/5QpYAY89a1+iCNlnCLeZt0CFSSVel5kXqgPJj48xE+/YrJEhlVDNA03z0nIXONvDkvD+rzRU6eVqyqW/DXnkzlDMZfPtb+fkfZAbxATyw7AZKiLraxgziRvSgAp3AY89a19GL62f0CVqxq8XDq1IDLBlTjD225ayNTwB8S84TC6uBdF/KD8K9qz5o3Zcu8F4cqUuA0b8jvyuMrjS8Wyv5ZNuUgruWTbdjpuZV+JkjU74hDoom9EwIdI3A8AavPrGZiLXAdAkKQfAksXiEQOjlPiFwGYKNAGPPWtf/eKZatmuUApeWonkTgVe57SlMCNW/afNRK3Iw/inXuM2Y5IFJV0ogxj9SUEUsT0="},{"functionCall":{"args":{"a":2,"b":3},"name":"multiply"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"add","response":{"result":"5"}}},{"functionResponse":{"name":"multiply","response":{"result":"6"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant. Always use both add and multiply at the same time."}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Add two numbers","name":"add","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}},{"description":"Multiply two numbers","name":"multiply","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}}]}]} form: alt: - sse diff --git a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/tool.yaml b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/tool.yaml index 3882020a9..8d8a42408 100644 --- a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/tool.yaml +++ b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/tool.yaml @@ -83,7 +83,7 @@ interactions: content_length: 1100 host: us-east5-aiplatform.googleapis.com body: | - {"contents":[{"parts":[{"text":"What's the weather in Florence,Italy?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"location":"Florence,Italy"},"id":"1","name":"weather"},"thoughtSignature":"CogCAY89a18llPaHtTc0RYmJYfqVzv67knJ0LLYW0uvvORLIbJ1go3t6f8qRUiA9NNmQPcujynZUv2T+UE/FdtglMNc4+tdvkjKNGp3YGstAa8NRco+/eUOWLdiYI793P8hzr2XCRmu7kPt6nQiLOauQseZ7Ldf/eYAHVZRVYmO1GcMtQYIpUI2n6w5eO1HIDdkB74FgZujPNJHICHGMt7nuI1M1t2yNkLh1v12Iht1NJEhu1JdkCGXQtrE9P1k6B2qlVG0+IL7el9ZsQKMs7Z0Cjqx8nIkjJnMGoBP8MQbP+mHxyNs6ClqGxQcy4gCtktP0/BB2Kh2ebnQA8Nu+W3bzKZxlx+G2IfoK"}],"role":"model"},{"parts":[{"functionResponse":{"id":"1","name":"weather","response":{"result":"40 C"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant"}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Get weather information for a location","name":"weather","parameters":{"properties":{"location":{"description":"the city","type":"STRING"}},"required":["location"],"type":"OBJECT"}}]}]} + {"contents":[{"parts":[{"text":"What's the weather in Florence,Italy?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"location":"Florence,Italy"},"name":"weather"},"thoughtSignature":"CogCAY89a18llPaHtTc0RYmJYfqVzv67knJ0LLYW0uvvORLIbJ1go3t6f8qRUiA9NNmQPcujynZUv2T+UE/FdtglMNc4+tdvkjKNGp3YGstAa8NRco+/eUOWLdiYI793P8hzr2XCRmu7kPt6nQiLOauQseZ7Ldf/eYAHVZRVYmO1GcMtQYIpUI2n6w5eO1HIDdkB74FgZujPNJHICHGMt7nuI1M1t2yNkLh1v12Iht1NJEhu1JdkCGXQtrE9P1k6B2qlVG0+IL7el9ZsQKMs7Z0Cjqx8nIkjJnMGoBP8MQbP+mHxyNs6ClqGxQcy4gCtktP0/BB2Kh2ebnQA8Nu+W3bzKZxlx+G2IfoK"}],"role":"model"},{"parts":[{"functionResponse":{"name":"weather","response":{"result":"40 C"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant"}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Get weather information for a location","name":"weather","parameters":{"properties":{"location":{"description":"the city","type":"STRING"}},"required":["location"],"type":"OBJECT"}}]}]} headers: Content-Type: - application/json diff --git a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/tool_streaming.yaml b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/tool_streaming.yaml index 5fb36de3d..b5c4e8e8f 100644 --- a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/tool_streaming.yaml +++ b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-flash/tool_streaming.yaml @@ -41,7 +41,7 @@ interactions: content_length: 1236 host: us-east5-aiplatform.googleapis.com body: | - {"contents":[{"parts":[{"text":"What's the weather in Florence,Italy?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"location":"Florence,Italy"},"id":"1","name":"weather"},"thoughtSignature":"CiwBjz1rX5J0Jni1UwQkH3SeTysS4TF4kGuzSS99EDy6+inHVbJu1Xo0pYpXeQprAY89a18NHhloDuIj0yld57PAo2oNpG6rOh/35G9rcOwGsXkiTJHGjRY2kvEit3Re266ZMK2YpihBVAkZllpxOWlb/QZN7Cial15OT3HGih3VCgpPirbUHnr1W3xjYncuUEWiboS9GunS2foKegGPPWtfqxLOOBCOHYMB1vAbHSWDwTHtlQmKO8gOjjB+E7rIAvoI5c/zje1zY9TIePouZwvtbh4hW0W0RkY1X0JqcVVCsdoxAa177NpMX32OsBI4ADKGIJWKfyUxHqYVTWqRPQCUm+vMMcCBkhEpQl1e4h+elfClBEXzClYBjz1rX3o0PFc+JJWTsLa7RFOQY12RaETWEvaTPmkUSJjWK0s+pMC6adOFzZMC/3NY4wPGdqSA/P5xnES40TQMQNvL9zL7G8O1sU6LExlHc9wVoyeOcw=="}],"role":"model"},{"parts":[{"functionResponse":{"id":"1","name":"weather","response":{"result":"40 C"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant"}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Get weather information for a location","name":"weather","parameters":{"properties":{"location":{"description":"the city","type":"STRING"}},"required":["location"],"type":"OBJECT"}}]}]} + {"contents":[{"parts":[{"text":"What's the weather in Florence,Italy?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"location":"Florence,Italy"},"name":"weather"},"thoughtSignature":"CiwBjz1rX5J0Jni1UwQkH3SeTysS4TF4kGuzSS99EDy6+inHVbJu1Xo0pYpXeQprAY89a18NHhloDuIj0yld57PAo2oNpG6rOh/35G9rcOwGsXkiTJHGjRY2kvEit3Re266ZMK2YpihBVAkZllpxOWlb/QZN7Cial15OT3HGih3VCgpPirbUHnr1W3xjYncuUEWiboS9GunS2foKegGPPWtfqxLOOBCOHYMB1vAbHSWDwTHtlQmKO8gOjjB+E7rIAvoI5c/zje1zY9TIePouZwvtbh4hW0W0RkY1X0JqcVVCsdoxAa177NpMX32OsBI4ADKGIJWKfyUxHqYVTWqRPQCUm+vMMcCBkhEpQl1e4h+elfClBEXzClYBjz1rX3o0PFc+JJWTsLa7RFOQY12RaETWEvaTPmkUSJjWK0s+pMC6adOFzZMC/3NY4wPGdqSA/P5xnES40TQMQNvL9zL7G8O1sU6LExlHc9wVoyeOcw=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"weather","response":{"result":"40 C"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant"}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Get weather information for a location","name":"weather","parameters":{"properties":{"location":{"description":"the city","type":"STRING"}},"required":["location"],"type":"OBJECT"}}]}]} form: alt: - sse diff --git a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/multi_tool.yaml b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/multi_tool.yaml index 7881deac2..e07beedd9 100644 --- a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/multi_tool.yaml +++ b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/multi_tool.yaml @@ -93,7 +93,7 @@ interactions: content_length: 1541 host: us-east5-aiplatform.googleapis.com body: | - {"contents":[{"parts":[{"text":"Add and multiply the number 2 and 3"}],"role":"user"},{"parts":[{"functionCall":{"args":{"a":2,"b":3},"id":"1","name":"add"},"thoughtSignature":"CowCAY89a1/vAaqniXrmhElp8qu3tCETdO3UfyX6GAedsXE7vdfpKTvda4xMGK9wFBEmw0aN24fmJRBi5AmBiHSc9Vo9JMEjyusxOednzWJCXbVjmyyz2e7L8Y2XN4azmNC2YVxOIP00SBFByCBSz2Ev1cqQY1UYl+u9mtAC5PvlPx6gOTGFZdnN+0C8j9DkPpTgPqE4M/tD0NVZU7kVLk25+Bz+WvGUAhdstMDl2LZQ3NiTyeMr+QUu/e5BB8ePV/BbKIlMbQFOwKPmna4kOCaQPO31HfWGA0tJ2ZT4SyQEYj7vLrgQ4TyTfBG/NPFT7Ud37LZpSFY29312jvmR3aArX4nztAlsG6hpoAGFRg=="},{"functionCall":{"args":{"a":2,"b":3},"id":"2","name":"multiply"}}],"role":"model"},{"parts":[{"functionResponse":{"id":"1","name":"add","response":{"result":"5"}}},{"functionResponse":{"id":"2","name":"multiply","response":{"result":"6"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant. CRITICAL: Always use both add and multiply at the same time ALWAYS."}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Add two numbers","name":"add","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}},{"description":"Multiply two numbers","name":"multiply","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}}]}]} + {"contents":[{"parts":[{"text":"Add and multiply the number 2 and 3"}],"role":"user"},{"parts":[{"functionCall":{"args":{"a":2,"b":3},"name":"add"},"thoughtSignature":"CowCAY89a1/vAaqniXrmhElp8qu3tCETdO3UfyX6GAedsXE7vdfpKTvda4xMGK9wFBEmw0aN24fmJRBi5AmBiHSc9Vo9JMEjyusxOednzWJCXbVjmyyz2e7L8Y2XN4azmNC2YVxOIP00SBFByCBSz2Ev1cqQY1UYl+u9mtAC5PvlPx6gOTGFZdnN+0C8j9DkPpTgPqE4M/tD0NVZU7kVLk25+Bz+WvGUAhdstMDl2LZQ3NiTyeMr+QUu/e5BB8ePV/BbKIlMbQFOwKPmna4kOCaQPO31HfWGA0tJ2ZT4SyQEYj7vLrgQ4TyTfBG/NPFT7Ud37LZpSFY29312jvmR3aArX4nztAlsG6hpoAGFRg=="},{"functionCall":{"args":{"a":2,"b":3},"name":"multiply"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"add","response":{"result":"5"}}},{"functionResponse":{"name":"multiply","response":{"result":"6"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant. CRITICAL: Always use both add and multiply at the same time ALWAYS."}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Add two numbers","name":"add","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}},{"description":"Multiply two numbers","name":"multiply","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}}]}]} headers: Content-Type: - application/json diff --git a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/multi_tool_streaming.yaml b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/multi_tool_streaming.yaml index c4a944cfd..bc288f712 100644 --- a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/multi_tool_streaming.yaml +++ b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/multi_tool_streaming.yaml @@ -41,7 +41,7 @@ interactions: content_length: 1704 host: us-east5-aiplatform.googleapis.com body: | - {"contents":[{"parts":[{"text":"Add and multiply the number 2 and 3"}],"role":"user"},{"parts":[{"functionCall":{"args":{"a":2,"b":3},"id":"1","name":"add"},"thoughtSignature":"CiQBjz1rX9vXzx2kuVvHI7K1og7PRomR1HnReMQI5SRJMSPzcAIKXgGPPWtfnWtXrgO5+AzYP5pnrCj2zZQuYQN0+s8HD4ukcOblaIEB1+ol370baALNpJqz131WB7VTe7FEKvlvrDglcKIAp9nu+AFphYHm4M1jyYxVoWtN2SmsDrBzWbgKZwGPPWtfbCiEax2Ys/D5UxclK7OD6tuXVaguLSieWuIZbMLU1yx9Q1Z611Uf6Gw/IQHGuYR/muyUGA74rs7AXi+cJ38x7djHGaQR3AOaLOotrGqyGbtbrGu6hCqf1Acp/jDPLdMhnukKdgGPPWtfw7FXMbV6/HUhP8gPUid+InjyPPe7Y6yxaPYEt13mNS8LGh85JJrF6v6LyW8QlR+EnGoQxHWJzAKo1Da46RmjiSqftdKOWWFux+S5eULdHwSSp+YsdgMcEmp1I/HeqT13UiOLtlRHj3iXGAZWshN5rjwKLwGPPWtfCFqQYyE6rXmQXNrcKMx4VdDSMTkXfdt7Cz4P6h75QRfLYlBcupiVk7GR"},{"functionCall":{"args":{"a":2,"b":3},"id":"2","name":"multiply"}}],"role":"model"},{"parts":[{"functionResponse":{"id":"1","name":"add","response":{"result":"5"}}},{"functionResponse":{"id":"2","name":"multiply","response":{"result":"6"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant. Always use both add and multiply at the same time."}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Add two numbers","name":"add","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}},{"description":"Multiply two numbers","name":"multiply","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}}]}]} + {"contents":[{"parts":[{"text":"Add and multiply the number 2 and 3"}],"role":"user"},{"parts":[{"functionCall":{"args":{"a":2,"b":3},"name":"add"},"thoughtSignature":"CiQBjz1rX9vXzx2kuVvHI7K1og7PRomR1HnReMQI5SRJMSPzcAIKXgGPPWtfnWtXrgO5+AzYP5pnrCj2zZQuYQN0+s8HD4ukcOblaIEB1+ol370baALNpJqz131WB7VTe7FEKvlvrDglcKIAp9nu+AFphYHm4M1jyYxVoWtN2SmsDrBzWbgKZwGPPWtfbCiEax2Ys/D5UxclK7OD6tuXVaguLSieWuIZbMLU1yx9Q1Z611Uf6Gw/IQHGuYR/muyUGA74rs7AXi+cJ38x7djHGaQR3AOaLOotrGqyGbtbrGu6hCqf1Acp/jDPLdMhnukKdgGPPWtfw7FXMbV6/HUhP8gPUid+InjyPPe7Y6yxaPYEt13mNS8LGh85JJrF6v6LyW8QlR+EnGoQxHWJzAKo1Da46RmjiSqftdKOWWFux+S5eULdHwSSp+YsdgMcEmp1I/HeqT13UiOLtlRHj3iXGAZWshN5rjwKLwGPPWtfCFqQYyE6rXmQXNrcKMx4VdDSMTkXfdt7Cz4P6h75QRfLYlBcupiVk7GR"},{"functionCall":{"args":{"a":2,"b":3},"name":"multiply"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"add","response":{"result":"5"}}},{"functionResponse":{"name":"multiply","response":{"result":"6"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant. Always use both add and multiply at the same time."}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Add two numbers","name":"add","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}},{"description":"Multiply two numbers","name":"multiply","parameters":{"properties":{"a":{"description":"first number","type":"INTEGER"},"b":{"description":"second number","type":"INTEGER"}},"required":["a","b"],"type":"OBJECT"}}]}]} form: alt: - sse diff --git a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/tool.yaml b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/tool.yaml index e86fdab20..65e92953a 100644 --- a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/tool.yaml +++ b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/tool.yaml @@ -83,7 +83,7 @@ interactions: content_length: 1445 host: us-east5-aiplatform.googleapis.com body: | - {"contents":[{"parts":[{"text":"What's the weather in Florence,Italy?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"location":"Florence, Italy"},"id":"1","name":"weather"},"thoughtSignature":"CogEAY89a18AxcmSDT2p07Co1JRtGBB7Agd75Vj9UZkgbukirUDDeNDjpGrNB9hCvNnkXEp6Cmi1w/XoCg9ucdiWUcB3XBygzRsHEopx6+pLGO7QPFK8N+js2l+iH2YF6xjA9nTI7CAhtMS78tEdlMykkwe4tU6e1wyEDmRLYwema/Q9oaV6ziqkbYOKPix6IjZhgkJSz0rmwMXN1S1whHKC4Qd7IhOodVIp7TaNzLAxMAij6EkusUjLsCYMpuDm2NvdjlwQWsYjiZSYRDU5KNWuc6P+RgrozZj4n3bLp9g29QzPAd2qnJW8CjMsGBDVx0bTzfy2EdMkX5P0ZZre1EvkOyMTA64hDz1o4wChM6BcMKBMgs2z5Hl/yRN4eAjrC4NO/MM57kS1Lg836onZVfE5Te8vn9W0nv4M+o0NnF79xeeIXVdg9csNnfrhxlFFU300fgAk+EEQ4keVn/r4EdSsaUqdV/WUMr3GS2sbQZvP6PNJuOoc0lmLrJVpy6BEdlrofphYcFlOObgkUeYw6x9/u6zRke7PQbOiU/w2D41e0AIhrnItM3gvrQnFmjjJhj2J8aV+/MD7Vxc0OY+2DcJMhty3VUGgTvhUkTJ5gu65/waRYZcQI53hejjnmAjrmKPJzfbypYf8LLZGmNHbP88nXoEPxdL28k/2AmXq/hg7bIisyk2Q+POUhQ=="}],"role":"model"},{"parts":[{"functionResponse":{"id":"1","name":"weather","response":{"result":"40 C"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant"}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Get weather information for a location","name":"weather","parameters":{"properties":{"location":{"description":"the city","type":"STRING"}},"required":["location"],"type":"OBJECT"}}]}]} + {"contents":[{"parts":[{"text":"What's the weather in Florence,Italy?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"location":"Florence, Italy"},"name":"weather"},"thoughtSignature":"CogEAY89a18AxcmSDT2p07Co1JRtGBB7Agd75Vj9UZkgbukirUDDeNDjpGrNB9hCvNnkXEp6Cmi1w/XoCg9ucdiWUcB3XBygzRsHEopx6+pLGO7QPFK8N+js2l+iH2YF6xjA9nTI7CAhtMS78tEdlMykkwe4tU6e1wyEDmRLYwema/Q9oaV6ziqkbYOKPix6IjZhgkJSz0rmwMXN1S1whHKC4Qd7IhOodVIp7TaNzLAxMAij6EkusUjLsCYMpuDm2NvdjlwQWsYjiZSYRDU5KNWuc6P+RgrozZj4n3bLp9g29QzPAd2qnJW8CjMsGBDVx0bTzfy2EdMkX5P0ZZre1EvkOyMTA64hDz1o4wChM6BcMKBMgs2z5Hl/yRN4eAjrC4NO/MM57kS1Lg836onZVfE5Te8vn9W0nv4M+o0NnF79xeeIXVdg9csNnfrhxlFFU300fgAk+EEQ4keVn/r4EdSsaUqdV/WUMr3GS2sbQZvP6PNJuOoc0lmLrJVpy6BEdlrofphYcFlOObgkUeYw6x9/u6zRke7PQbOiU/w2D41e0AIhrnItM3gvrQnFmjjJhj2J8aV+/MD7Vxc0OY+2DcJMhty3VUGgTvhUkTJ5gu65/waRYZcQI53hejjnmAjrmKPJzfbypYf8LLZGmNHbP88nXoEPxdL28k/2AmXq/hg7bIisyk2Q+POUhQ=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"weather","response":{"result":"40 C"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant"}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Get weather information for a location","name":"weather","parameters":{"properties":{"location":{"description":"the city","type":"STRING"}},"required":["location"],"type":"OBJECT"}}]}]} headers: Content-Type: - application/json diff --git a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/tool_streaming.yaml b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/tool_streaming.yaml index 1e70c3038..29fdf67e6 100644 --- a/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/tool_streaming.yaml +++ b/providertests/testdata/TestGoogleCommon/vertex-gemini-2-5-pro/tool_streaming.yaml @@ -41,7 +41,7 @@ interactions: content_length: 1677 host: us-east5-aiplatform.googleapis.com body: | - {"contents":[{"parts":[{"text":"What's the weather in Florence,Italy?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"location":"Florence, Italy"},"id":"1","name":"weather"},"thoughtSignature":"CiIBjz1rXyc3Jt0wjS9Mp9TZrLGwfhh2I4z86q6IZHflISCYCmcBjz1rXx+KC1eUkDiRSogUY8M9UnL2bbN9IL9BFB99rjNJ8jKqVtrTC5SncrQnBBqYo8EuWgvrv1+5FSI9Cr2nhvTwyyTpoiqxks9Xz4OTzqCTha5hpdTkLT846P9pER0Xf5aVPOXtCmEBjz1rXwxN0lNIdN5KMrHQmICcs0vijgyfM9OW6oEZIVB3mMx8vGktc9TmDsrA2+CwjcR2l49yFw35r7XPxk/Ng0DRvD3DxUrB/okaGO/ZD4hxM3c2OrFup+zFvfHd/XCcCqcBAY89a1+CIQmUJvHDk2M4F+N7Fs0l3b3lZ9iWGGM/co8kDRr54mxTDiyfwqQ8aDUwwh9glTbmvAjoUvkf8UTN22Bhvv7wdSD31CCBpIsxs6Cdio0H3rP926aZqJBVDKDok8lxfUmDZeJjnQ0o2aIHJefPfibnqzcUhEisidSiOB6ykdSnJUc1wrCqntx0g9UTuF1+rqGk2kDQMiw7OYBl9tdBdtdJerYKqAEBjz1rX+ztDgupxPgCbZALhEbGh9rxJf+DYlYGm5Me0BtIKtOzaol4Mhmn/TeoFz+uzJuK70YK5HFCj82q2aEDNza9W5jO7aYoceFhS4YCyNFTMRIg6IEWVJxS3sUe78ELLsDtGz4/wwwmz5R7ewdNgAY3++XEMwWmNcur6M+kJo8A0Rdd05lcqI9x7bIeHK26JSFNKP0q92ueLb+nFwHj6tv0wWQixz0KdAGPPWtfJWCT44joV6wQkimuxiqvNYu/QESgs3eTypb23NNIgfv49xVM0VW7RHiqw/OXFXtxl5V9VST5DCLK8ShuRYYGDvCVtsGhK75pwJqLWMG/B781gSh9LChcF/n74RT6e21GTFtKGvMGywQTkZrYJVEe"}],"role":"model"},{"parts":[{"functionResponse":{"id":"1","name":"weather","response":{"result":"40 C"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant"}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Get weather information for a location","name":"weather","parameters":{"properties":{"location":{"description":"the city","type":"STRING"}},"required":["location"],"type":"OBJECT"}}]}]} + {"contents":[{"parts":[{"text":"What's the weather in Florence,Italy?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"location":"Florence, Italy"},"name":"weather"},"thoughtSignature":"CiIBjz1rXyc3Jt0wjS9Mp9TZrLGwfhh2I4z86q6IZHflISCYCmcBjz1rXx+KC1eUkDiRSogUY8M9UnL2bbN9IL9BFB99rjNJ8jKqVtrTC5SncrQnBBqYo8EuWgvrv1+5FSI9Cr2nhvTwyyTpoiqxks9Xz4OTzqCTha5hpdTkLT846P9pER0Xf5aVPOXtCmEBjz1rXwxN0lNIdN5KMrHQmICcs0vijgyfM9OW6oEZIVB3mMx8vGktc9TmDsrA2+CwjcR2l49yFw35r7XPxk/Ng0DRvD3DxUrB/okaGO/ZD4hxM3c2OrFup+zFvfHd/XCcCqcBAY89a1+CIQmUJvHDk2M4F+N7Fs0l3b3lZ9iWGGM/co8kDRr54mxTDiyfwqQ8aDUwwh9glTbmvAjoUvkf8UTN22Bhvv7wdSD31CCBpIsxs6Cdio0H3rP926aZqJBVDKDok8lxfUmDZeJjnQ0o2aIHJefPfibnqzcUhEisidSiOB6ykdSnJUc1wrCqntx0g9UTuF1+rqGk2kDQMiw7OYBl9tdBdtdJerYKqAEBjz1rX+ztDgupxPgCbZALhEbGh9rxJf+DYlYGm5Me0BtIKtOzaol4Mhmn/TeoFz+uzJuK70YK5HFCj82q2aEDNza9W5jO7aYoceFhS4YCyNFTMRIg6IEWVJxS3sUe78ELLsDtGz4/wwwmz5R7ewdNgAY3++XEMwWmNcur6M+kJo8A0Rdd05lcqI9x7bIeHK26JSFNKP0q92ueLb+nFwHj6tv0wWQixz0KdAGPPWtfJWCT44joV6wQkimuxiqvNYu/QESgs3eTypb23NNIgfv49xVM0VW7RHiqw/OXFXtxl5V9VST5DCLK8ShuRYYGDvCVtsGhK75pwJqLWMG/B781gSh9LChcF/n74RT6e21GTFtKGvMGywQTkZrYJVEe"}],"role":"model"},{"parts":[{"functionResponse":{"name":"weather","response":{"result":"40 C"}}}],"role":"user"}],"generationConfig":{"maxOutputTokens":4000},"systemInstruction":{"parts":[{"text":"You are a helpful assistant"}],"role":"user"},"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}},"tools":[{"functionDeclarations":[{"description":"Get weather information for a location","name":"weather","parameters":{"properties":{"location":{"description":"the city","type":"STRING"}},"required":["location"],"type":"OBJECT"}}]}]} form: alt: - sse