mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-01 19:12:42 +00:00
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}} ```
This commit is contained in:
committed by
GitHub
parent
dbebe2ca97
commit
f2dcdae467
@@ -1564,7 +1564,7 @@ class ChatModelIntegrationTests(ChatModelTests):
|
|||||||
|
|
||||||
model_with_tools = model.bind_tools([my_adder_tool])
|
model_with_tools = model.bind_tools([my_adder_tool])
|
||||||
function_name = "my_adder_tool"
|
function_name = "my_adder_tool"
|
||||||
function_args = {"a": "1", "b": "2"}
|
function_args = {"a": 1, "b": 2}
|
||||||
|
|
||||||
messages_string_content = [
|
messages_string_content = [
|
||||||
HumanMessage("What is 1 + 2"),
|
HumanMessage("What is 1 + 2"),
|
||||||
|
Reference in New Issue
Block a user