Skip to content

Commit

Permalink
Update tests/snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldk committed Nov 22, 2024
1 parent b187141 commit 2792e8d
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"choices": [
{
"finish_reason": "eos_token",
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
Expand All @@ -13,27 +13,27 @@
"function": {
"arguments": {
"format": "celsius",
"location": "Brooklyn"
"location": "Brooklyn, New York"
},
"description": null,
"name": "get_current_weather"
},
"id": 0,
"id": "0",
"type": "function"
}
]
},
"usage": null
}
],
"created": 1712782670,
"created": 1732293383,
"id": "",
"model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
"object": "text_completion",
"system_fingerprint": "2.0.1-native",
"model": "meta-llama/Llama-3.1-8B-Instruct",
"object": "chat.completion",
"system_fingerprint": "2.4.1-dev0-native",
"usage": {
"completion_tokens": 37,
"prompt_tokens": 524,
"total_tokens": 561
"completion_tokens": 30,
"prompt_tokens": 615,
"total_tokens": 645
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"choices": [
{
"finish_reason": "eos_token",
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
Expand All @@ -13,27 +13,27 @@
"function": {
"arguments": {
"format": "celsius",
"location": "Brooklyn"
"location": "Brooklyn, New York"
},
"description": null,
"name": "get_current_weather"
},
"id": 0,
"id": "0",
"type": "function"
}
]
},
"usage": null
}
],
"created": 1712787937,
"created": 1732293384,
"id": "",
"model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
"object": "text_completion",
"system_fingerprint": "2.0.1-native",
"model": "meta-llama/Llama-3.1-8B-Instruct",
"object": "chat.completion",
"system_fingerprint": "2.4.1-dev0-native",
"usage": {
"completion_tokens": 37,
"prompt_tokens": 524,
"total_tokens": 561
"completion_tokens": 30,
"prompt_tokens": 615,
"total_tokens": 645
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"logprobs": null
}
],
"created": 1729084854,
"created": 1732293254,
"id": "",
"model": "meta-llama/Llama-3.1-8B-Instruct",
"object": "chat.completion.chunk",
"system_fingerprint": "2.3.2-dev0-native",
"system_fingerprint": "2.4.1-dev0-native",
"usage": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"logprobs": null
}
],
"created": 1729084850,
"created": 1732293246,
"id": "",
"model": "meta-llama/Llama-3.1-8B-Instruct",
"object": "chat.completion.chunk",
"system_fingerprint": "2.3.2-dev0-native",
"system_fingerprint": "2.4.1-dev0-native",
"usage": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@
"role": "assistant",
"tool_calls": {
"function": {
"arguments": "</s>",
"arguments": "<|eot_id|>",
"name": null
},
"id": "",
"index": 0,
"type": "function"
}
},
"finish_reason": "eos_token",
"finish_reason": "stop",
"index": 0,
"logprobs": null
}
],
"created": 1712788218,
"created": 1732293235,
"id": "",
"model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
"object": "text_completion",
"system_fingerprint": "2.0.1-native"
"model": "meta-llama/Llama-3.1-8B-Instruct",
"object": "chat.completion.chunk",
"system_fingerprint": "2.4.1-dev0-native",
"usage": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Weather(BaseModel):
called = chat_completion["choices"][0]["message"]["content"]

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


Expand Down
10 changes: 5 additions & 5 deletions integration-tests/models/test_tools_llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def test_flash_llama_grammar_tools(flash_llama_grammar_tools, response_sna
"function": {
"description": None,
"name": "get_current_weather",
"arguments": {"format": "celsius", "location": "Brooklyn, NY"},
"arguments": {"format": "celsius", "location": "Brooklyn, New York"},
},
}
]
Expand Down Expand Up @@ -138,7 +138,7 @@ async def test_flash_llama_grammar_tools_auto(
"function": {
"description": None,
"name": "get_current_weather",
"arguments": {"format": "celsius", "location": "Brooklyn, NY"},
"arguments": {"format": "celsius", "location": "Brooklyn, New York"},
},
}
]
Expand Down Expand Up @@ -219,7 +219,7 @@ async def test_flash_llama_grammar_tools_stream(

assert (
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 last_response == response_snapshot
Expand Down Expand Up @@ -366,7 +366,7 @@ async def test_flash_llama_grammar_tools_sea_creatures_stream_required(
assert count == 29
assert (
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

Expand Down Expand Up @@ -465,6 +465,6 @@ async def test_flash_llama_grammar_tools_sea_creatures_stream_function_object(
assert count == 39
assert (
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

0 comments on commit 2792e8d

Please sign in to comment.