From 9419e75d600a932861494dbddba9076f871679a7 Mon Sep 17 00:00:00 2001 From: Chang Su Date: Tue, 29 Apr 2025 15:54:53 -0700 Subject: [PATCH] [CI] Add test_function_calling.py to run_suite.py (#5896) --- test/srt/run_suite.py | 1 + test/srt/test_function_calling.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/test/srt/run_suite.py b/test/srt/run_suite.py index 0c0ed04fd..ee6f0cbad 100644 --- a/test/srt/run_suite.py +++ b/test/srt/run_suite.py @@ -36,6 +36,7 @@ suites = { TestFile("test_fa3.py", 376), TestFile("test_fim_completion.py", 40), TestFile("test_fp8_kernel.py", 8), + TestFile("test_function_calling.py", 35), TestFile("test_fused_moe.py", 30), TestFile("test_hicache.py", 116), TestFile("test_hicache_mla.py", 254), diff --git a/test/srt/test_function_calling.py b/test/srt/test_function_calling.py index 9eaa93027..ebe052aec 100644 --- a/test/srt/test_function_calling.py +++ b/test/srt/test_function_calling.py @@ -182,16 +182,17 @@ class TestOpenAIServerFunctionCalling(CustomTestCase): "type": "object", "properties": { "a": { - "type": "int", + "type": "integer", "description": "First integer", }, "b": { - "type": "int", + "type": "integer", "description": "Second integer", }, }, "required": ["a", "b"], }, + "strict": True, # Llama-3.2-1B is flaky in tool call. It won't always respond with parameters unless we set strict. }, } ] @@ -218,7 +219,7 @@ class TestOpenAIServerFunctionCalling(CustomTestCase): # Record the function name on first occurrence function_name = tool_call.function.name or function_name # In case of multiple chunks, JSON fragments may need to be concatenated - if tool_call.function.arguments: + if tool_call.function.arguments is not None: argument_fragments.append(tool_call.function.arguments) self.assertEqual(function_name, "add", "Function name should be 'add'") @@ -258,11 +259,11 @@ class TestOpenAIServerFunctionCalling(CustomTestCase): "type": "object", "properties": { "int_a": { - "type": "int", + "type": "integer", "description": "First integer", }, "int_b": { - "type": "int", + "type": "integer", "description": "Second integer", }, },