Fixed some typos in tool call error messages

This commit is contained in:
2026-01-30 12:25:57 -07:00
parent cdd829199f
commit d79e4b9dff
5 changed files with 9 additions and 8 deletions
+2 -2
View File
@@ -234,7 +234,7 @@ async fn chat_completions_streaming(
} }
let arguments: Value = let arguments: Value =
function_arguments.parse().with_context(|| { function_arguments.parse().with_context(|| {
format!("Tool call '{function_name}' have non-JSON arguments '{function_arguments}'") format!("Tool call '{function_name}' has non-JSON arguments '{function_arguments}'")
})?; })?;
handler.tool_call(ToolCall::new( handler.tool_call(ToolCall::new(
function_name.clone(), function_name.clone(),
@@ -272,7 +272,7 @@ async fn chat_completions_streaming(
function_arguments = String::from("{}"); function_arguments = String::from("{}");
} }
let arguments: Value = function_arguments.parse().with_context(|| { let arguments: Value = function_arguments.parse().with_context(|| {
format!("Tool call '{function_name}' have non-JSON arguments '{function_arguments}'") format!("Tool call '{function_name}' has non-JSON arguments '{function_arguments}'")
})?; })?;
handler.tool_call(ToolCall::new( handler.tool_call(ToolCall::new(
function_name.clone(), function_name.clone(),
+2 -2
View File
@@ -95,7 +95,7 @@ pub async fn claude_chat_completions_streaming(
if !function_name.is_empty() { if !function_name.is_empty() {
let arguments: Value = let arguments: Value =
function_arguments.parse().with_context(|| { function_arguments.parse().with_context(|| {
format!("Tool call '{function_name}' have non-JSON arguments '{function_arguments}'") format!("Tool call '{function_name}' has non-JSON arguments '{function_arguments}'")
})?; })?;
handler.tool_call(ToolCall::new( handler.tool_call(ToolCall::new(
function_name.clone(), function_name.clone(),
@@ -134,7 +134,7 @@ pub async fn claude_chat_completions_streaming(
json!({}) json!({})
} else { } else {
function_arguments.parse().with_context(|| { function_arguments.parse().with_context(|| {
format!("Tool call '{function_name}' have non-JSON arguments '{function_arguments}'") format!("Tool call '{function_name}' has non-JSON arguments '{function_arguments}'")
})? })?
}; };
handler.tool_call(ToolCall::new( handler.tool_call(ToolCall::new(
+2 -2
View File
@@ -167,7 +167,7 @@ async fn chat_completions_streaming(
"tool-call-end" => { "tool-call-end" => {
if !function_name.is_empty() { if !function_name.is_empty() {
let arguments: Value = function_arguments.parse().with_context(|| { let arguments: Value = function_arguments.parse().with_context(|| {
format!("Tool call '{function_name}' have non-JSON arguments '{function_arguments}'") format!("Tool call '{function_name}' has non-JSON arguments '{function_arguments}'")
})?; })?;
handler.tool_call(ToolCall::new( handler.tool_call(ToolCall::new(
function_name.clone(), function_name.clone(),
@@ -230,7 +230,7 @@ fn extract_chat_completions(data: &Value) -> Result<ChatCompletionsOutput> {
call["id"].as_str(), call["id"].as_str(),
) { ) {
let arguments: Value = arguments.parse().with_context(|| { let arguments: Value = arguments.parse().with_context(|| {
format!("Tool call '{name}' have non-JSON arguments '{arguments}'") format!("Tool call '{name}' has non-JSON arguments '{arguments}'")
})?; })?;
tool_calls.push(ToolCall::new( tool_calls.push(ToolCall::new(
name.to_string(), name.to_string(),
+2 -2
View File
@@ -164,7 +164,7 @@ pub async fn openai_chat_completions_streaming(
function_arguments = String::from("{}"); function_arguments = String::from("{}");
} }
let arguments: Value = function_arguments.parse().with_context(|| { let arguments: Value = function_arguments.parse().with_context(|| {
format!("Tool call '{function_name}' have non-JSON arguments '{function_arguments}'") format!("Tool call '{function_name}' has non-JSON arguments '{function_arguments}'")
})?; })?;
handler.tool_call(ToolCall::new( handler.tool_call(ToolCall::new(
function_name.clone(), function_name.clone(),
@@ -370,7 +370,7 @@ pub fn openai_extract_chat_completions(data: &Value) -> Result<ChatCompletionsOu
call["id"].as_str(), call["id"].as_str(),
) { ) {
let arguments: Value = arguments.parse().with_context(|| { let arguments: Value = arguments.parse().with_context(|| {
format!("Tool call '{name}' have non-JSON arguments '{arguments}'") format!("Tool call '{name}' has non-JSON arguments '{arguments}'")
})?; })?;
tool_calls.push(ToolCall::new( tool_calls.push(ToolCall::new(
name.to_string(), name.to_string(),
+1
View File
@@ -57,6 +57,7 @@ impl SseHandler {
pub fn tool_call(&mut self, call: ToolCall) -> Result<()> { pub fn tool_call(&mut self, call: ToolCall) -> Result<()> {
self.tool_calls.push(call); self.tool_calls.push(call);
Ok(()) Ok(())
} }