AWS Bedrock
Provider bedrock. Adapter over Amazon Bedrock, AWS's managed service that
serves models from several vendors (Anthropic Claude, Meta Llama, Amazon
Titan/Nova, Mistral, Cohere…) behind a single API and one bill (AWS's). You
talk to all of them through the same LLM(...).
pip install "jangada-ai[bedrock]"provider=:"bedrock"- Authentication: standard AWS credentials —
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYandAWS_REGION(orAWS_DEFAULT_REGION). Profiles (AWS_PROFILE), IAM roles and EC2/Lambda metadata also work — the same resolution chain asboto3. - Model: the Bedrock model ID (or inference profile), e.g.
anthropic.claude-3-5-sonnet-20241022-v2:0.
from jangada_ai import LLM
# uses AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_REGION from the env
llm = LLM("bedrock", "anthropic.claude-3-5-sonnet-20241022-v2:0")
resp = llm.complete("Summarize {{ topic }} in one sentence.", topic="rafts")
print(resp.text, resp.cost)Configuration via environment
In your .env (or process variables):
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
AWS_REGION=us-east-1Region matters: each model ID only exists in some regions, and inference
profiles (e.g. us.anthropic.claude-3-5-sonnet-...) enable cross-region
routing. boto3-specific arguments (e.g. endpoint_url, region_name) go
through extra=.
What it does
- Text and streaming via Bedrock's Converse API (a unified interface across all models).
- Structured output (
parse): tool-forcing when the model supports tools; otherwise a JSON instruction + validation withmodel_validate_json. - Vision (
images=): on vision-capable models (Claude family, Llama vision, Nova). - Documents (
files=): local text extraction before sending.
When to choose Bedrock
When your stack already lives on AWS and you want unified governance, billing and network isolation (VPC), without spreading each vendor's API keys. Combine it as a fallback for direct Claude (Anthropic) to get cross-cloud redundancy. See Providers and Retry and fallback.
What changed in 1.9.0
- Converse fields passed through:
extra={"additionalModelRequestFields": ...},guardrailConfig,promptVariables,requestMetadata,performanceConfig,serviceTierandadditionalModelResponseFieldPathsgo straight into the call (they used to be silently dropped). tool_choice="none"doesn't send the tools (except when the history already hastoolUse, which the API requires).- Streaming: an error mid-stream (throttling,
ModelStreamErrorException) becomes a normalized error inastreamtoo, and the stream is closed if you stop consuming it. - Native tools (Amazon Nova):
web_search()becomesnova_groundingandcode_execution()becomesnova_code_interpreter(Nova 2). Requiresus.*profiles and thebedrock:InvokeToolIAM permission. See Native tools. - Usage with cache (
cache_read_tokens/cache_write_tokens) and a system message given as parts has its text extracted.
Ollama
Provider ollama. Adapter over Ollama's native API (ollama SDK): local models with no key and Ollama Cloud; num_ctx/keep_alive/think via extra=, structured output with format, tools with nested schemas, vision, embeddings and web search/fetch.
Azure OpenAI
Provider azure. The same OpenAI models (GPT-4o, GPT-4.1, o-series…) served by Azure OpenAI Service, through jangada's normalized API, authenticating with your Azure resource endpoint + key.