From f2dcdae467ea5f449917605340921b59bc29807f Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Tue, 26 Aug 2025 15:50:47 -0400 Subject: [PATCH] fix(standard-tests): update `function_args` to match `my_adder_tool` param types (#32689) **Description:** https://api.llama.com implements strong type checking, which results in a false negative. with type mismatch (expected integer, received string) - ``` $ curl -X POST "https://api.llama.com/compat/v1/chat/completions" \ -H "Authorization: Bearer API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "Llama-3.3-70B-Instruct", "messages": [ {"role": "user", "content": "What is 1 + 2"}, {"role": "assistant", "content": "", "tool_calls": [{"id": "abc123", "type": "function", "function": {"name": "my_adder_tool", "arguments": "{\"a\": \"1\", \"b\": \"2\"}"}}]}, {"role": "tool", "tool_call_id": "abc123", "content": "{\"result\": 3}"} ], "tools": [{"type": "function", "function": {"name": "my_adder_tool", "description": "Sum two integers", "parameters": {"properties": {"a": {"type": "integer"}, "b": {"type": "integer"}}, "required": ["a", "b"], "type": "object"}}}] }' {"title":"Bad request","detail":"Unexpected param value `a`: \"1\"","status":400} ``` with correct type - ``` $ curl -X POST "https://api.llama.com/compat/v1/chat/completions" \ -H "Authorization: Bearer API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "Llama-3.3-70B-Instruct", "messages": [ {"role": "user", "content": "What is 1 + 2"}, {"role": "assistant", "content": "", "tool_calls": [{"id": "abc123", "type": "function", "function": {"name": "my_adder_tool", "arguments": "{\"a\": 1, \"b\": 2}"}}]}, {"role": "tool", "tool_call_id": "abc123", "content": "{\"result\": 3}"} ], "tools": [{"type": "function", "function": {"name": "my_adder_tool", "description": "Sum two integers", "parameters": {"properties": {"a": {"type": "integer"}, "b": {"type": "integer"}}, "required": ["a", "b"], "type": "object"}}}] }' {"id":"AhMwBbuaa5payFr_xsOHzxX","model":"Llama-3.3-70B-Instruct","choices":[{"finish_reason":"stop","index":0,"message":{"refusal":"","role":"assistant","content":"The result of 1 + 2 is 3.","id":"AhMwBbuaa5payFr_xsOHzxX"},"logprobs":null}],"created":1756167668,"object":"chat.completions","usage":{"prompt_tokens":248,"completion_tokens":17,"total_tokens":265}} ``` --- .../langchain_tests/integration_tests/chat_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/standard-tests/langchain_tests/integration_tests/chat_models.py b/libs/standard-tests/langchain_tests/integration_tests/chat_models.py index 1750e8bdefd..ee7f9ed94bb 100644 --- a/libs/standard-tests/langchain_tests/integration_tests/chat_models.py +++ b/libs/standard-tests/langchain_tests/integration_tests/chat_models.py @@ -1564,7 +1564,7 @@ class ChatModelIntegrationTests(ChatModelTests): model_with_tools = model.bind_tools([my_adder_tool]) function_name = "my_adder_tool" - function_args = {"a": "1", "b": "2"} + function_args = {"a": 1, "b": 2} messages_string_content = [ HumanMessage("What is 1 + 2"),