fix: improve test to avoid notify_error

This commit is contained in:
David Holtz 2024-10-01 15:30:59 +00:00
parent 88121b3e4e
commit 04b409e7ae
2 changed files with 11 additions and 27 deletions

View File

@ -1,38 +1,26 @@
{ {
"choices": [ "choices": [
{ {
"finish_reason": "eos_token", "finish_reason": "stop",
"index": 0, "index": 0,
"logprobs": null, "logprobs": null,
"message": { "message": {
"content": null, "content": "There is a huge storm in the ocean",
"name": null, "name": null,
"role": "assistant", "role": "assistant",
"tool_calls": [ "tool_calls": null
{
"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"
}
]
}, },
"usage": null "usage": null
} }
], ],
"created": 1712852597, "created": 1727796440,
"id": "", "id": "",
"model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", "model": "meta-llama/Llama-3.1-8B-Instruct",
"object": "text_completion", "object": "chat.completion",
"system_fingerprint": "1.4.5-native", "system_fingerprint": "2.3.1-dev0-native",
"usage": { "usage": {
"completion_tokens": 39, "completion_tokens": 25,
"prompt_tokens": 496, "prompt_tokens": 600,
"total_tokens": 535 "total_tokens": 625
} }
} }

View File

@ -225,10 +225,6 @@ async def test_flash_llama_grammar_tools_insufficient_information(
tools=tools, tools=tools,
tool_choice="auto", tool_choice="auto",
messages=[ messages=[
{
"role": "system",
"content": "STRICTLY ONLY RESPOND IF THE USER ASKS A WEATHER RELATED QUESTION",
},
{ {
"role": "user", "role": "user",
"content": "Tell me a story about 3 sea creatures", "content": "Tell me a story about 3 sea creatures",
@ -239,6 +235,6 @@ async def test_flash_llama_grammar_tools_insufficient_information(
assert ( assert (
responses.choices[0].message.content 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 assert responses == response_snapshot