pub fn parse_converse_response(text: &str) -> Result<CompletionResponse>Expand description
Parse a Bedrock Converse API response JSON string into a
CompletionResponse.
§Errors
Returns anyhow::Error if the string is not valid JSON in the expected
Converse response shape.
§Examples
use codetether_agent::provider::bedrock::parse_converse_response;
use codetether_agent::provider::{ContentPart, Role};
let body = r#"{"output":{"message":{"role":"assistant","content":[{"text":"hi"}]}},"stopReason":"end_turn"}"#;
let resp = parse_converse_response(body).unwrap();
assert!(matches!(resp.message.role, Role::Assistant));
assert!(matches!(&resp.message.content[0], ContentPart::Text { text } if text == "hi"));