From 7ab94e438c826e0f172abb042685ab0ba240dddb Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Sat, 11 Apr 2026 02:14:22 -0700 Subject: [PATCH] [Test] Fix flaky `test_function_call_required` by adding `strict=True` (#22586) --- .../function_call/test_openai_function_calling.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/registered/openai_server/function_call/test_openai_function_calling.py b/test/registered/openai_server/function_call/test_openai_function_calling.py index ea02b8951..974e05232 100644 --- a/test/registered/openai_server/function_call/test_openai_function_calling.py +++ b/test/registered/openai_server/function_call/test_openai_function_calling.py @@ -464,6 +464,11 @@ class TestOpenAIServerFunctionCalling(CustomTestCase): ] messages = [{"role": "user", "content": "What is the capital of France?"}] + # strict=True ensures constrained decoding enforces the parameter schema. + # Without it, tool_choice="required" only guarantees a tool call is made + # but arguments are best-effort (may be empty on small models). + for tool in tools: + tool["function"]["strict"] = True response = client.chat.completions.create( model=self.model, max_tokens=2048,