-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(groq): return final Response (#206)
- Loading branch information
Showing
7 changed files
with
135 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 1 addition & 47 deletions
48
tests/Fixtures/groq/generate-text-with-multiple-tools-1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1 @@ | ||
{ | ||
"id": "chatcmpl-2f85156f-4864-4621-a977-6767e74251b5", | ||
"object": "chat.completion", | ||
"created": 1730035768, | ||
"model": "llama3-groq-70b-8192-tool-use-preview", | ||
"choices": [ | ||
{ | ||
"index": 0, | ||
"message": { | ||
"role": "assistant", | ||
"tool_calls": [ | ||
{ | ||
"id": "call_4b20", | ||
"type": "function", | ||
"function": { | ||
"name": "search", | ||
"arguments": "{\"query\": \"tigers game today in Detroit\"}" | ||
} | ||
}, | ||
{ | ||
"id": "call_hvk7", | ||
"type": "function", | ||
"function": { | ||
"name": "weather", | ||
"arguments": "{\"city\": \"Detroit\"}" | ||
} | ||
} | ||
] | ||
}, | ||
"logprobs": null, | ||
"finish_reason": "tool_calls" | ||
} | ||
], | ||
"usage": { | ||
"queue_time": 0.012132366000000002, | ||
"prompt_tokens": 296, | ||
"prompt_time": 0.02126043, | ||
"completion_tokens": 55, | ||
"completion_time": 0.173039707, | ||
"total_tokens": 351, | ||
"total_time": 0.194300137 | ||
}, | ||
"system_fingerprint": "fp_ee4b521143", | ||
"x_groq": { | ||
"id": "req_01jb72npr0fj0t9p423mrdt52h" | ||
} | ||
} | ||
{"id":"chatcmpl-1cbf7b0f-c99a-4807-a820-e8d91c585015","object":"chat.completion","created":1740311145,"model":"llama-3.3-70b-versatile","choices":[{"index":0,"message":{"role":"assistant","tool_calls":[{"id":"call_3whd","type":"function","function":{"name":"weather","arguments":"{\"city\": \"Detroit\"}"}},{"id":"call_6xxk","type":"function","function":{"name":"search","arguments":"{\"query\": \"Tigers game time today in Detroit\"}"}}]},"logprobs":null,"finish_reason":"tool_calls"}],"usage":{"queue_time":0.233586791,"prompt_tokens":310,"prompt_time":0.016113644,"completion_tokens":32,"completion_time":0.116363636,"total_tokens":342,"total_time":0.13247728},"system_fingerprint":"fp_7b42aeb9fa","x_groq":{"id":"req_01jmsa1b8tfmb9h9k7gh9tej8x"}} |
31 changes: 1 addition & 30 deletions
31
tests/Fixtures/groq/generate-text-with-multiple-tools-2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1 @@ | ||
{ | ||
"id": "chatcmpl-e4daf477-4536-4f23-9c3e-de490185423f", | ||
"object": "chat.completion", | ||
"created": 1730035716, | ||
"model": "llama3-groq-70b-8192-tool-use-preview", | ||
"choices": [ | ||
{ | ||
"index": 0, | ||
"message": { | ||
"role": "assistant", | ||
"content": "The Tigers game is at 3pm in Detroit. Given the weather is 75° and sunny, it's likely to be warm, so you might not need a coat. However, it's always a good idea to check the weather closer to the game time as it can change." | ||
}, | ||
"logprobs": null, | ||
"finish_reason": "stop" | ||
} | ||
], | ||
"usage": { | ||
"queue_time": 0.027946203000000003, | ||
"prompt_tokens": 48, | ||
"prompt_time": 0.006288822, | ||
"completion_tokens": 59, | ||
"completion_time": 0.187873195, | ||
"total_tokens": 107, | ||
"total_time": 0.194162017 | ||
}, | ||
"system_fingerprint": "fp_ee4b521143", | ||
"x_groq": { | ||
"id": "req_01jb72m451f7yr7cmtb0bb7yxs" | ||
} | ||
} | ||
{"id":"chatcmpl-6c7d4a2f-5950-4430-bb08-4e12d7e94e04","object":"chat.completion","created":1740311147,"model":"llama-3.3-70b-versatile","choices":[{"index":0,"message":{"role":"assistant","tool_calls":[{"id":"call_hmv6","type":"function","function":{"name":"weather","arguments":"{\"city\": \"Detroit\"}"}}]},"logprobs":null,"finish_reason":"tool_calls"}],"usage":{"queue_time":0.268621691,"prompt_tokens":377,"prompt_time":0.019224374,"completion_tokens":26,"completion_time":0.094545455,"total_tokens":403,"total_time":0.113769829},"system_fingerprint":"fp_0a4b7a8df3","x_groq":{"id":"req_01jmsa1c7cf6pb1efvnwzbkk8n"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"id":"chatcmpl-8288c3f5-e381-4ca1-8472-f926970b8392","object":"chat.completion","created":1740311147,"model":"llama-3.3-70b-versatile","choices":[{"index":0,"message":{"role":"assistant","content":"Based on the weather, you won't need a coat for the Tigers game today in Detroit. It's going to be 75° and sunny. The game starts at 3 pm."},"logprobs":null,"finish_reason":"stop"}],"usage":{"queue_time":0.281927537,"prompt_tokens":409,"prompt_time":0.021915109,"completion_tokens":39,"completion_time":0.141818182,"total_tokens":448,"total_time":0.163733291},"system_fingerprint":"fp_7b42aeb9fa","x_groq":{"id":"req_01jmsa1ct3frb8vhbq3ppbaky8"}} |
2 changes: 1 addition & 1 deletion
2
tests/Fixtures/groq/generate-text-with-required-tool-call-1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"id":"chatcmpl-3c1a57b2-da9f-454d-82cd-4ab1b0cc2456","object":"chat.completion","created":1730556571,"model":"llama3-groq-70b-8192-tool-use-preview","choices":[{"index":0,"message":{"role":"assistant","tool_calls":[{"id":"call_2rps","type":"function","function":{"name":"weather","arguments":"{\"city\": \"New York\"}"}},{"id":"call_gzsm","type":"function","function":{"name":"weather","arguments":"{\"city\": \"Los Angeles\"}"}},{"id":"call_b0by","type":"function","function":{"name":"weather","arguments":"{\"city\": \"Chicago\"}"}},{"id":"call_h6gq","type":"function","function":{"name":"weather","arguments":"{\"city\": \"Houston\"}"}},{"id":"call_zyrx","type":"function","function":{"name":"weather","arguments":"{\"city\": \"Philadelphia\"}"}},{"id":"call_d427","type":"function","function":{"name":"weather","arguments":"{\"city\": \"Phoenix\"}"}},{"id":"call_kd8c","type":"function","function":{"name":"weather","arguments":"{\"city\": \"San Antonio\"}"}},{"id":"call_w6w4","type":"function","function":{"name":"weather","arguments":"{\"city\": \"San Diego\"}"}},{"id":"call_7qsn","type":"function","function":{"name":"weather","arguments":"{\"city\": \"Dallas\"}"}},{"id":"call_p7mz","type":"function","function":{"name":"weather","arguments":"{\"city\": \"San Jose\"}"}}]},"logprobs":null,"finish_reason":"tool_calls"}],"usage":{"queue_time":0.012363021000000002,"prompt_tokens":299,"prompt_time":0.021131387,"completion_tokens":187,"completion_time":0.5974724,"total_tokens":486,"total_time":0.618603787},"system_fingerprint":"fp_ee4b521143","x_groq":{"id":"req_01jbpkbc6kfe2ag6btbxqypb4z"}} | ||
{"id":"chatcmpl-753b3c7d-6f5b-4a0c-bf32-66d05e44ba1a","object":"chat.completion","created":1740311332,"model":"llama-3.3-70b-versatile","choices":[{"index":0,"message":{"role":"assistant","tool_calls":[{"id":"call_qc7n","type":"function","function":{"name":"weather","arguments":"{\"city\": \"New York\"}"}}]},"logprobs":null,"finish_reason":"tool_calls"}],"usage":{"queue_time":0.234223463,"prompt_tokens":312,"prompt_time":0.015721485,"completion_tokens":11,"completion_time":0.04,"total_tokens":323,"total_time":0.055721485},"system_fingerprint":"fp_5f849c5a0b","x_groq":{"id":"req_01jmsa71nke0zrnk8n4acyh6kh"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters