From 06be99f1a272a8ac98719081d321b1561589b2cc Mon Sep 17 00:00:00 2001 From: Ben Browning Date: Sat, 7 Jun 2025 19:47:51 -0400 Subject: [PATCH] fix: loosen tool call checks in inference store This loosens up the tool call function name and arguments checks in `tests/integration/inference/test_openai_completion.py::test_inference_store_tool_calls` because the small models we use in CI cannot reliably get the tool call function name or arguments exactly right. Closes #2345 Signed-off-by: Ben Browning --- tests/integration/inference/test_openai_completion.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/integration/inference/test_openai_completion.py b/tests/integration/inference/test_openai_completion.py index 190840f70..461527d18 100644 --- a/tests/integration/inference/test_openai_completion.py +++ b/tests/integration/inference/test_openai_completion.py @@ -372,10 +372,14 @@ def test_inference_store_tool_calls(compat_client, client_with_models, text_mode ) assert input_content == message, retrieved_response tool_calls = retrieved_response.choices[0].message.tool_calls - # sometimes model doesn't ouptut tool calls, but we still want to test that the tool was called + # sometimes model doesn't output tool calls, but we still want to test that the tool was called if tool_calls: + # because we test with small models, just check that we retrieved + # a tool call with a name and arguments string, but ignore contents assert len(tool_calls) == 1 - assert tool_calls[0].function.name == "get_weather" - assert "tokyo" in tool_calls[0].function.arguments.lower() + assert tool_calls[0].function.name + assert tool_calls[0].function.arguments else: + # failed tool call parses show up as a message with content, so ensure + # that the retrieve response content matches the original request assert retrieved_response.choices[0].message.content == content