Skip to main content

Module bedrock

Module bedrock 

Source
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 enum
  • aliases — short-name to full model ID mapping
  • sigv4 — SigV4 signing + HTTP dispatch
  • estimates — context-window / max-output heuristics
  • convert — [Message] → Converse API JSON translation
  • body — Converse request body builder
  • response — Converse response parser
  • discovery — 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 Message format 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.eventstream binary 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-stream endpoint.

Structs§

BedrockProvider
Amazon Bedrock provider implementation.

Constants§

DEFAULT_REGION
Default AWS region when none is configured via env or config file.