mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
fix: send empty object instead of null for bedrock tool input (#8121)
Signed-off-by: Extra Small <littleshuai.bot@gmail.com> Signed-off-by: Douwe Osinga <douwe@squareup.com> Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
@@ -298,7 +298,7 @@ jobs:
|
||||
- name: Create Release Pull Request or Publish to npm
|
||||
if: inputs.dry-run != true && github.ref == 'refs/heads/main'
|
||||
id: changesets
|
||||
uses: changesets/action@6d3568c53fbe1db6c1f9ab1c7fbf9092bc18627f # v1
|
||||
uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf # v1.7.0
|
||||
with:
|
||||
publish: pnpm run release
|
||||
version: pnpm run version
|
||||
|
||||
@@ -72,7 +72,7 @@ pub fn to_bedrock_message_content(content: &MessageContent) -> Result<bedrock::C
|
||||
bedrock::ToolUseBlock::builder()
|
||||
.tool_use_id(tool_use_id)
|
||||
.name(call.name.to_string())
|
||||
.input(to_bedrock_json(&Value::from(call.arguments.clone())))
|
||||
.input(to_bedrock_json(&args_to_value(call.arguments.clone())))
|
||||
.build()
|
||||
} else {
|
||||
bedrock::ToolUseBlock::builder()
|
||||
@@ -87,7 +87,7 @@ pub fn to_bedrock_message_content(content: &MessageContent) -> Result<bedrock::C
|
||||
bedrock::ToolUseBlock::builder()
|
||||
.tool_use_id(tool_use_id)
|
||||
.name(call.name.to_string())
|
||||
.input(to_bedrock_json(&Value::from(call.arguments.clone())))
|
||||
.input(to_bedrock_json(&args_to_value(call.arguments.clone())))
|
||||
.build()
|
||||
} else {
|
||||
bedrock::ToolUseBlock::builder()
|
||||
@@ -226,6 +226,13 @@ pub fn to_bedrock_tool(tool: &Tool) -> Result<bedrock::Tool> {
|
||||
))
|
||||
}
|
||||
|
||||
fn args_to_value(args: Option<serde_json::Map<String, Value>>) -> Value {
|
||||
match args {
|
||||
Some(map) => Value::Object(map),
|
||||
None => Value::Object(serde_json::Map::new()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_bedrock_json(value: &Value) -> Document {
|
||||
match value {
|
||||
Value::Null => Document::Null,
|
||||
|
||||
Reference in New Issue
Block a user