summaryrefslogtreecommitdiff
path: root/makima/src/llm/groq.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2025-12-23 18:24:42 +0000
committersoryu <soryu@soryu.co>2025-12-23 18:24:42 +0000
commit3c0adec8e3a9dd3bc34251e87e0fb5314793426d (patch)
tree9dfe61e55bd703aa09df03abfcbf8e7a8b2babce /makima/src/llm/groq.rs
parent555061b179b8ec034cb70f9a2dd6c823ced0f637 (diff)
downloadsoryu-3c0adec8e3a9dd3bc34251e87e0fb5314793426d.tar.gz
soryu-3c0adec8e3a9dd3bc34251e87e0fb5314793426d.zip
Add claude opus/sonnet support
Diffstat (limited to 'makima/src/llm/groq.rs')
-rw-r--r--makima/src/llm/groq.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/makima/src/llm/groq.rs b/makima/src/llm/groq.rs
index be0e2bc..ee01fcf 100644
--- a/makima/src/llm/groq.rs
+++ b/makima/src/llm/groq.rs
@@ -92,6 +92,8 @@ struct MessageResponse {
pub struct ChatResult {
pub content: Option<String>,
pub tool_calls: Vec<ToolCall>,
+ /// Raw tool call responses for including in subsequent messages
+ pub raw_tool_calls: Vec<ToolCallResponse>,
pub finish_reason: String,
}
@@ -154,14 +156,13 @@ impl GroqClient {
.next()
.ok_or_else(|| GroqError::Api("No choices in response".to_string()))?;
- let tool_calls = choice
- .message
- .tool_calls
- .unwrap_or_default()
- .into_iter()
+ let raw_tool_calls = choice.message.tool_calls.unwrap_or_default();
+
+ let tool_calls = raw_tool_calls
+ .iter()
.map(|tc| ToolCall {
- id: tc.id,
- name: tc.function.name,
+ id: tc.id.clone(),
+ name: tc.function.name.clone(),
arguments: serde_json::from_str(&tc.function.arguments).unwrap_or_default(),
})
.collect();
@@ -169,6 +170,7 @@ impl GroqClient {
Ok(ChatResult {
content: choice.message.content,
tool_calls,
+ raw_tool_calls,
finish_reason: choice.finish_reason,
})
}