mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-11 19:59:50 +08:00
fix(provider): serialize Claude tool results as JSON strings
This commit is contained in:
@@ -538,6 +538,15 @@ mod tests {
|
||||
converted["messages"][2]["content"][0]["tool_use_id"],
|
||||
"call_1"
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<Value>(
|
||||
converted["messages"][2]["content"][0]["content"]
|
||||
.as_str()
|
||||
.expect("object tool result content should be serialized for Claude")
|
||||
)
|
||||
.expect("serialized tool result content should remain JSON"),
|
||||
json!({"rows": 1})
|
||||
);
|
||||
assert_eq!(converted["tool_choice"]["type"], "auto");
|
||||
assert_eq!(converted["stream"], true);
|
||||
}
|
||||
|
||||
@@ -835,6 +835,15 @@ mod tests {
|
||||
provider_request_body["messages"][2]["content"][0]["type"],
|
||||
"tool_result"
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<Value>(
|
||||
provider_request_body["messages"][2]["content"][0]["content"]
|
||||
.as_str()
|
||||
.expect("object tool result content should be serialized for Claude")
|
||||
)
|
||||
.expect("serialized tool result content should remain JSON"),
|
||||
json!({"rows": 1})
|
||||
);
|
||||
assert_eq!(provider_request_body["tool_choice"]["type"], "auto");
|
||||
assert_eq!(provider_request_body["stream"], true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user