Expand description
Amazon Bedrock provider for the Converse API.
Supports both AWS IAM SigV4 credentials and opaque bearer tokens (e.g.
from an API Gateway fronting Bedrock). Dispatches chat completions, tool
calls, and model discovery via the bedrock-runtime and bedrock
management APIs.
§Quick Start
use codetether_agent::provider::Provider;
use codetether_agent::provider::bedrock::{AwsCredentials, BedrockProvider};
let creds = AwsCredentials::from_environment().expect("creds");
let region = AwsCredentials::detect_region().unwrap_or_else(|| "us-west-2".into());
let provider = BedrockProvider::with_credentials(creds, region).unwrap();
let models = provider.list_models().await.unwrap();
assert!(!models.is_empty());§Architecture
auth— credential loading, SigV4/bearer auth mode enumaliases— short-name to full model ID mappingsigv4— SigV4 signing + HTTP dispatchestimates— context-window / max-output heuristicsconvert— [Message] → Converse API JSON translationbody— Converse request body builderresponse— Converse response parserdiscovery— dynamic model list via management APIs
Re-exports§
pub use aliases::resolve_model_id;pub use auth::AwsCredentials;pub use auth::BedrockAuth;pub use body::build_converse_body;pub use convert::convert_messages;pub use convert::convert_tools;pub use estimates::estimate_context_window;pub use estimates::estimate_max_output;pub use response::BedrockError;pub use response::parse_converse_response;
Modules§
- aliases
- Short-name aliases for common Bedrock model IDs.
- auth
- AWS credential loading and auth mode selection for the Bedrock provider.
- body
- Build the JSON body for a Bedrock Converse API request.
- convert
- Convert the crate’s generic
Messageformat to the Bedrock Converse API’s JSON schema, and back-convert tool definitions. - discovery
- Dynamic model discovery via Bedrock management APIs.
- estimates
- Context-window and max-output-token estimates for Bedrock models.
- eventstream
- Minimal parser for the AWS
vnd.amazon.eventstreambinary frame format. - response
- Bedrock Converse API response types and helpers.
- retry
- Retry helper for transient Bedrock errors.
- sigv4
- AWS SigV4 request signing and HTTP dispatch for Bedrock.
- stream
- Real streaming adapter for Bedrock’s
/converse-streamendpoint.
Structs§
- Bedrock
Provider - Amazon Bedrock provider implementation.
Constants§
- DEFAULT_
REGION - Default AWS region when none is configured via env or config file.