Update tests/snapshots

This commit is contained in:
Daniël de Kok 2024-11-22 16:40:20 +00:00
parent f5e55ad7d9
commit 639dc07088
7 changed files with 37 additions and 36 deletions

View File

@ -1,7 +1,7 @@
{ {
"choices": [ "choices": [
{ {
"finish_reason": "eos_token", "finish_reason": "stop",
"index": 0, "index": 0,
"logprobs": null, "logprobs": null,
"message": { "message": {
@ -13,12 +13,12 @@
"function": { "function": {
"arguments": { "arguments": {
"format": "celsius", "format": "celsius",
"location": "Brooklyn" "location": "Brooklyn, New York"
}, },
"description": null, "description": null,
"name": "get_current_weather" "name": "get_current_weather"
}, },
"id": 0, "id": "0",
"type": "function" "type": "function"
} }
] ]
@ -26,14 +26,14 @@
"usage": null "usage": null
} }
], ],
"created": 1712782670, "created": 1732293383,
"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": "2.0.1-native", "system_fingerprint": "2.4.1-dev0-native",
"usage": { "usage": {
"completion_tokens": 37, "completion_tokens": 30,
"prompt_tokens": 524, "prompt_tokens": 615,
"total_tokens": 561 "total_tokens": 645
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"choices": [ "choices": [
{ {
"finish_reason": "eos_token", "finish_reason": "stop",
"index": 0, "index": 0,
"logprobs": null, "logprobs": null,
"message": { "message": {
@ -13,12 +13,12 @@
"function": { "function": {
"arguments": { "arguments": {
"format": "celsius", "format": "celsius",
"location": "Brooklyn" "location": "Brooklyn, New York"
}, },
"description": null, "description": null,
"name": "get_current_weather" "name": "get_current_weather"
}, },
"id": 0, "id": "0",
"type": "function" "type": "function"
} }
] ]
@ -26,14 +26,14 @@
"usage": null "usage": null
} }
], ],
"created": 1712787937, "created": 1732293384,
"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": "2.0.1-native", "system_fingerprint": "2.4.1-dev0-native",
"usage": { "usage": {
"completion_tokens": 37, "completion_tokens": 30,
"prompt_tokens": 524, "prompt_tokens": 615,
"total_tokens": 561 "total_tokens": 645
} }
} }

View File

@ -18,10 +18,10 @@
"logprobs": null "logprobs": null
} }
], ],
"created": 1729084854, "created": 1732293254,
"id": "", "id": "",
"model": "meta-llama/Llama-3.1-8B-Instruct", "model": "meta-llama/Llama-3.1-8B-Instruct",
"object": "chat.completion.chunk", "object": "chat.completion.chunk",
"system_fingerprint": "2.3.2-dev0-native", "system_fingerprint": "2.4.1-dev0-native",
"usage": null "usage": null
} }

View File

@ -19,10 +19,10 @@
"logprobs": null "logprobs": null
} }
], ],
"created": 1729084850, "created": 1732293246,
"id": "", "id": "",
"model": "meta-llama/Llama-3.1-8B-Instruct", "model": "meta-llama/Llama-3.1-8B-Instruct",
"object": "chat.completion.chunk", "object": "chat.completion.chunk",
"system_fingerprint": "2.3.2-dev0-native", "system_fingerprint": "2.4.1-dev0-native",
"usage": null "usage": null
} }

View File

@ -6,7 +6,7 @@
"role": "assistant", "role": "assistant",
"tool_calls": { "tool_calls": {
"function": { "function": {
"arguments": "</s>", "arguments": "<|eot_id|>",
"name": null "name": null
}, },
"id": "", "id": "",
@ -14,14 +14,15 @@
"type": "function" "type": "function"
} }
}, },
"finish_reason": "eos_token", "finish_reason": "stop",
"index": 0, "index": 0,
"logprobs": null "logprobs": null
} }
], ],
"created": 1712788218, "created": 1732293235,
"id": "", "id": "",
"model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", "model": "meta-llama/Llama-3.1-8B-Instruct",
"object": "text_completion", "object": "chat.completion.chunk",
"system_fingerprint": "2.0.1-native" "system_fingerprint": "2.4.1-dev0-native",
"usage": null
} }

View File

@ -55,7 +55,7 @@ async def test_grammar_response_format_llama_json(llama_grammar, response_snapsh
called = chat_completion["choices"][0]["message"]["content"] called = chat_completion["choices"][0]["message"]["content"]
assert response.status_code == 200 assert response.status_code == 200
assert called == '{ "temperature": [ 26, 30, 33, 29 ] ,"unit": "Fahrenheit" }' assert called == '{ "unit": "fahrenheit", "temperature": [ 72, 79, 88 ] }'
assert chat_completion == response_snapshot assert chat_completion == response_snapshot

View File

@ -101,7 +101,7 @@ async def test_flash_llama_grammar_tools(flash_llama_grammar_tools, response_sna
"function": { "function": {
"description": None, "description": None,
"name": "get_current_weather", "name": "get_current_weather",
"arguments": {"format": "celsius", "location": "Brooklyn, NY"}, "arguments": {"format": "celsius", "location": "Brooklyn, New York"},
}, },
} }
] ]
@ -138,7 +138,7 @@ async def test_flash_llama_grammar_tools_auto(
"function": { "function": {
"description": None, "description": None,
"name": "get_current_weather", "name": "get_current_weather",
"arguments": {"format": "celsius", "location": "Brooklyn, NY"}, "arguments": {"format": "celsius", "location": "Brooklyn, New York"},
}, },
} }
] ]
@ -219,7 +219,7 @@ async def test_flash_llama_grammar_tools_stream(
assert ( assert (
tool_calls_generated tool_calls_generated
== '{"function": {"_name": "get_current_weather", "format": "celsius", "location": "Paris, France"}}<|eot_id|>' == '{"function": {"_name": "get_current_weather", "location": "Paris, France", "format": "celsius"}}<|eot_id|>'
) )
assert count == 28 assert count == 28
assert last_response == response_snapshot assert last_response == response_snapshot
@ -366,7 +366,7 @@ async def test_flash_llama_grammar_tools_sea_creatures_stream_required(
assert count == 29 assert count == 29
assert ( assert (
tool_calls_generated tool_calls_generated
== '{"function": {"_name": "get_current_weather", "format": "celsius", "location": "San Francisco, CA"}}<|eot_id|>' == '{"function": {"_name": "get_current_weather", "location": "San Francisco, CA", "format": "celsius"}}<|eot_id|>'
) )
assert last_response == response_snapshot assert last_response == response_snapshot
@ -465,6 +465,6 @@ async def test_flash_llama_grammar_tools_sea_creatures_stream_function_object(
assert count == 39 assert count == 39
assert ( assert (
tool_calls_generated tool_calls_generated
== '{"function": {"_name": "get_n_day_weather_forecast", "format": "celsius", "location": "San Francisco, CA", "num_days":3}}<|eot_id|>' == '{"function": {"_name": "get_n_day_weather_forecast", "location": "San Francisco, CA", "format": "celsius", "num_days":3}}<|eot_id|>'
) )
assert last_response == response_snapshot assert last_response == response_snapshot