Skip to main content

Module response

Module response 

Source
Expand description

Bedrock Converse API response types and helpers.

These types mirror the JSON shape returned from the /converse endpoint and provide a small helper to translate it into the crate’s generic CompletionResponse.

§Examples

use codetether_agent::provider::bedrock::parse_converse_response;

let json = serde_json::json!({
    "output": {"message": {"role": "assistant", "content": [{"text": "hi"}]}},
    "stopReason": "end_turn",
    "usage": {"inputTokens": 3, "outputTokens": 1, "totalTokens": 4}
});
let resp = parse_converse_response(&json.to_string()).unwrap();
assert_eq!(resp.usage.total_tokens, 4);

Structs§

BedrockError
Error body returned by Bedrock when a request is rejected.

Functions§

parse_converse_response
Parse a Bedrock Converse API response JSON string into a CompletionResponse.