Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async fn main() {
// Provider: tool call → text response (2-turn conversation)
let provider = MockProvider::new(vec![
MockResponse::ToolCalls(vec![MockToolCall {
provider_metadata: None,
name: "greet".into(),
arguments: serde_json::json!({"name": "World"}),
}]),
Expand Down
1 change: 1 addition & 0 deletions src/agent_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ async fn run_loop(
id,
name,
arguments,
..
} => Some((id.clone(), name.clone(), arguments.clone())),
_ => None,
})
Expand Down
5 changes: 4 additions & 1 deletion src/provider/anthropic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl StreamProvider for AnthropicProvider {
}
AnthropicContentBlock::ToolUse { id, name, .. } => {
while content.len() <= idx {
content.push(Content::ToolCall {
content.push(Content::ToolCall { provider_metadata: None,
id: id.clone(),
name: name.clone(),
arguments: serde_json::Value::Object(Default::default()),
Expand Down Expand Up @@ -438,6 +438,7 @@ fn content_to_anthropic(content: &[Content]) -> Vec<serde_json::Value> {
id,
name,
arguments,
..
} => serde_json::json!({
"type": "tool_use",
"id": id,
Expand Down Expand Up @@ -658,6 +659,7 @@ mod tests {
messages: vec![
Message::Assistant {
content: vec![Content::ToolCall {
provider_metadata: None,
id: "tc-1".into(),
name: "read_file".into(),
arguments: serde_json::json!({"path": "test.png"}),
Expand Down Expand Up @@ -718,6 +720,7 @@ mod tests {
messages: vec![
Message::Assistant {
content: vec![Content::ToolCall {
provider_metadata: None,
id: "tc-1".into(),
name: "bash".into(),
arguments: serde_json::json!({"command": "echo hi"}),
Expand Down
2 changes: 2 additions & 0 deletions src/provider/azure_openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ impl StreamProvider for AzureOpenAiProvider {
let args = serde_json::from_str(&buf.arguments)
.unwrap_or(serde_json::Value::Object(Default::default()));
content.push(Content::ToolCall {
provider_metadata: None,
id: buf.id.clone(),
name: buf.name.clone(),
arguments: args,
Expand Down Expand Up @@ -243,6 +244,7 @@ fn build_azure_request_body(config: &StreamConfig) -> serde_json::Value {
id,
name,
arguments,
..
} => {
input.push(serde_json::json!({
"type": "function_call",
Expand Down
4 changes: 3 additions & 1 deletion src/provider/bedrock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl StreamProvider for BedrockProvider {
BedrockEvent::ContentBlockStart { start, .. } => {
if let Some(tool_use) = start.tool_use {
let idx = content.len();
content.push(Content::ToolCall {
content.push(Content::ToolCall { provider_metadata: None,
id: tool_use.tool_use_id.clone(),
name: tool_use.name.clone(),
arguments: serde_json::Value::Object(Default::default()),
Expand Down Expand Up @@ -315,6 +315,7 @@ fn content_to_bedrock(content: &[Content]) -> Vec<serde_json::Value> {
id,
name,
arguments,
..
} => Some(serde_json::json!({
"toolUse": {"toolUseId": id, "name": name, "input": arguments},
})),
Expand Down Expand Up @@ -432,6 +433,7 @@ mod tests {
text: "hello".into(),
},
Content::ToolCall {
provider_metadata: None,
id: "tc-1".into(),
name: "bash".into(),
arguments: serde_json::json!({"command": "ls"}),
Expand Down
Loading