Skip to content

Commit ee0f366

Browse files
author
ochafik
committed
test for non-empty id in test_tool_call.py
1 parent a117630 commit ee0f366

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

examples/server/tests/unit/test_tool_call.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def do_test_completion_with_required_tool_tiny(server: ServerProcess, tool: dict
9292
assert tool_calls and len(tool_calls) == 1, f'Expected 1 tool call in {choice["message"]}'
9393
tool_call = tool_calls[0]
9494
assert choice["message"].get("content") in (None, ""), f'Expected no content in {choice["message"]}'
95+
assert len(tool_call.get("id", "")) > 0, f'Expected non empty tool call id in {tool_call}'
9596
expected_function_name = "python" if tool["type"] == "code_interpreter" else tool["function"]["name"]
9697
assert expected_function_name == tool_call["function"]["name"]
9798
actual_arguments = tool_call["function"]["arguments"]
@@ -373,6 +374,7 @@ def do_test_weather(server: ServerProcess, **kwargs):
373374
tool_call = tool_calls[0]
374375
# assert choice["message"].get("content") in (None, ""), f'Expected no content in {choice["message"]}'
375376
assert tool_call["function"]["name"] == WEATHER_TOOL["function"]["name"], f'Expected weather tool call, got {tool_call["function"]["name"]}'
377+
assert len(tool_call.get("id", "")) > 0, f'Expected non empty tool call id in {tool_call}'
376378
actual_arguments = json.loads(tool_call["function"]["arguments"])
377379
assert 'location' in actual_arguments, f"location not found in {json.dumps(actual_arguments)}"
378380
location = actual_arguments["location"]
@@ -596,6 +598,7 @@ def do_test_hello_world(server: ServerProcess, **kwargs):
596598
tool_call = tool_calls[0]
597599
# assert choice["message"].get("content") in (None, ""), f'Expected no content in {choice["message"]}'
598600
assert tool_call["function"]["name"] == PYTHON_TOOL["function"]["name"]
601+
assert len(tool_call.get("id", "")) > 0, f'Expected non empty tool call id in {tool_call}'
599602
actual_arguments = json.loads(tool_call["function"]["arguments"])
600603
assert 'code' in actual_arguments, f"code not found in {json.dumps(actual_arguments)}"
601604
code = actual_arguments["code"]

0 commit comments

Comments
 (0)