anthropic: Use an empty object if no tool input is provided (#26144)
This PR changes the default value when no input is provided with a tool use from `null` to `{}`. This fixes an issue I was seeing where tools that didn't accept input were not being called correctly. Release Notes: - N/A
This commit is contained in:
parent
87b3fefdd1
commit
d0c2bef8c3
1 changed files with 3 additions and 1 deletions
|
@ -639,7 +639,9 @@ pub fn map_to_language_model_completion_events(
|
|||
id: tool_use.id.into(),
|
||||
name: tool_use.name.into(),
|
||||
input: if tool_use.input_json.is_empty() {
|
||||
serde_json::Value::Null
|
||||
serde_json::Value::Object(
|
||||
serde_json::Map::default(),
|
||||
)
|
||||
} else {
|
||||
serde_json::Value::from_str(
|
||||
&tool_use.input_json,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue