From 04b409e7ae00c1b9c8ff1fb9349ea387b707e10b Mon Sep 17 00:00:00 2001 From: David Holtz Date: Tue, 1 Oct 2024 15:30:59 +0000 Subject: [PATCH] fix: improve test to avoid notify_error --- ...rammar_tools_insufficient_information.json | 32 ++++++------------- integration-tests/models/test_tools_llama.py | 6 +--- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_insufficient_information.json b/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_insufficient_information.json index 0cd3c67f..7f7f7884 100644 --- a/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_insufficient_information.json +++ b/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_insufficient_information.json @@ -1,38 +1,26 @@ { "choices": [ { - "finish_reason": "eos_token", + "finish_reason": "stop", "index": 0, "logprobs": null, "message": { - "content": null, + "content": "There is a huge storm in the ocean", "name": null, "role": "assistant", - "tool_calls": [ - { - "function": { - "arguments": { - "error": "Cannot get current weather forecast from specified location and temperature unit. Please try again with different options." - }, - "description": null, - "name": "notify_error" - }, - "id": 0, - "type": "function" - } - ] + "tool_calls": null }, "usage": null } ], - "created": 1712852597, + "created": 1727796440, "id": "", - "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", - "object": "text_completion", - "system_fingerprint": "1.4.5-native", + "model": "meta-llama/Llama-3.1-8B-Instruct", + "object": "chat.completion", + "system_fingerprint": "2.3.1-dev0-native", "usage": { - "completion_tokens": 39, - "prompt_tokens": 496, - "total_tokens": 535 + "completion_tokens": 25, + "prompt_tokens": 600, + "total_tokens": 625 } } diff --git a/integration-tests/models/test_tools_llama.py b/integration-tests/models/test_tools_llama.py index a03b0780..5f3dba9c 100644 --- a/integration-tests/models/test_tools_llama.py +++ b/integration-tests/models/test_tools_llama.py @@ -225,10 +225,6 @@ async def test_flash_llama_grammar_tools_insufficient_information( tools=tools, tool_choice="auto", messages=[ - { - "role": "system", - "content": "STRICTLY ONLY RESPOND IF THE USER ASKS A WEATHER RELATED QUESTION", - }, { "role": "user", "content": "Tell me a story about 3 sea creatures", @@ -239,6 +235,6 @@ async def test_flash_llama_grammar_tools_insufficient_information( assert ( responses.choices[0].message.content - == "Cannot get current weather forecast from specified location and temperature unit. Please try again with different options." + == "There is a huge storm in the ocean" ) assert responses == response_snapshot