diff options
| author | Julian Blank <blankjul@outlook.com> | 2025-03-03 06:41:16 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-03 22:41:16 +0800 |
| commit | 26034f5103f50559f3ee274026669799725441a4 (patch) | |
| tree | fda201e96a9d8271d4687ce46bc3656f0c21f564 | |
| parent | 67af61590295dba14b2e9f9b6561cde255411218 (diff) | |
| download | aichat-26034f5103f50559f3ee274026669799725441a4.tar.gz | |
fix: bedrock handles empty tool call arguments (#1213)
| -rw-r--r-- | src/client/bedrock.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/client/bedrock.rs b/src/client/bedrock.rs index 0dc84ca..16ea5d0 100644 --- a/src/client/bedrock.rs +++ b/src/client/bedrock.rs @@ -222,6 +222,9 @@ async fn chat_completions_streaming( json_str_from_map(tool_use, "name"), ) { if !function_name.is_empty() { + if function_arguments.is_empty() { + function_arguments = String::from("{}"); + } let arguments: Value = function_arguments.parse().with_context(|| { format!("Tool call '{function_name}' have non-JSON arguments '{function_arguments}'") @@ -259,6 +262,9 @@ async fn chat_completions_streaming( reasoning_state = 0; } if !function_name.is_empty() { + if function_arguments.is_empty() { + function_arguments = String::from("{}"); + } let arguments: Value = function_arguments.parse().with_context(|| { format!("Tool call '{function_name}' have non-JSON arguments '{function_arguments}'") })?; |
