AWS Bedrock provider for lmux
Project description
lmux-aws-bedrock
AWS Bedrock provider for lmux. Uses boto3, aiobotocore, and the Converse API.
Supports chat completions, streaming, and embeddings.
Part of the lmux ecosystem: standardized interface, cost tracking on every response, and registry-based routing across providers.
Optional Extras
lmux-aws-bedrock[async]: async support viaaiobotocore
Auth
Uses boto3's default credential chain (env vars, AWS config, instance metadata). No extra setup needed if your AWS credentials are already configured.
from lmux_aws_bedrock import BedrockProvider
provider = BedrockProvider()
# Or specify a region
provider = BedrockProvider(region="us-east-1")
For explicit session configuration:
from lmux_aws_bedrock import BedrockSessionAuthProvider
provider = BedrockProvider(auth=BedrockSessionAuthProvider(profile_name="my-profile"))
Usage
Chat
from lmux import UserMessage
response = provider.chat("anthropic.claude-sonnet-4-20250514-v1:0", [UserMessage(content="Hello")])
print(response.content)
print(response.cost)
Streaming
for chunk in provider.chat_stream("anthropic.claude-sonnet-4-20250514-v1:0", [UserMessage(content="Hello")]):
if chunk.delta:
print(chunk.delta, end="")
Embeddings
response = provider.embed("amazon.titan-embed-text-v2:0", "Hello")
print(response.embeddings)
Async
Requires the [async] extra. All methods have async variants: achat, achat_stream, aembed.
Bedrock also supports lmux response_format, mapped to Converse outputConfig.textFormat.
Registry
Use with the lmux registry to route across multiple providers:
from lmux import Registry
registry = Registry()
registry.register("bedrock", provider)
response = registry.chat("bedrock/anthropic.claude-sonnet-4-20250514-v1:0", messages)
Provider Params
from lmux_aws_bedrock import BedrockParams, GuardrailConfig
response = provider.chat(
"anthropic.claude-sonnet-4-20250514-v1:0",
messages,
provider_params=BedrockParams(
guardrail_config=GuardrailConfig(
guardrail_identifier="my-guardrail",
guardrail_version="1",
),
),
)
| Parameter | Type | Description |
|---|---|---|
guardrail_config |
GuardrailConfig |
Bedrock guardrail to apply |
additional_model_request_fields |
dict |
Extra fields passed to the model |
additional_model_response_field_paths |
list[str] |
Extra response fields to return |
Constructor Options
BedrockProvider(
auth=..., # AuthProvider, default: BedrockEnvAuthProvider()
region=..., # AWS region
endpoint_url=..., # Custom endpoint URL
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lmux_aws_bedrock-0.3.0.tar.gz.
File metadata
- Download URL: lmux_aws_bedrock-0.3.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6420cb54f73b43af3af70b16b985c33d2ba9ac4fdf529ba75b38a111a01bbff8
|
|
| MD5 |
bfb2ade5d5cdec5eed4e96eea0812b0e
|
|
| BLAKE2b-256 |
25264c3f339caa6aae06b3dcf9328f35deca3ad352c4a92101b09397ffae2d84
|
Provenance
The following attestation bundles were made for lmux_aws_bedrock-0.3.0.tar.gz:
Publisher:
publish.yml on cluebbehusen/lmux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lmux_aws_bedrock-0.3.0.tar.gz -
Subject digest:
6420cb54f73b43af3af70b16b985c33d2ba9ac4fdf529ba75b38a111a01bbff8 - Sigstore transparency entry: 1218385903
- Sigstore integration time:
-
Permalink:
cluebbehusen/lmux@b9c6a46bfe0da3f5221fff58f89d269858fb4afa -
Branch / Tag:
refs/tags/lmux-aws-bedrock-v0.3.0 - Owner: https://github.com/cluebbehusen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b9c6a46bfe0da3f5221fff58f89d269858fb4afa -
Trigger Event:
push
-
Statement type:
File details
Details for the file lmux_aws_bedrock-0.3.0-py3-none-any.whl.
File metadata
- Download URL: lmux_aws_bedrock-0.3.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f5b3d7ab2a21a96f1df7303c19fa193a302897766da675d5c48190e8f854af0
|
|
| MD5 |
978b355768d6c2c3a30861f740941548
|
|
| BLAKE2b-256 |
00eb0d38023bb650df5dfc093ed9001c14a6924e6abeb858d51c71ea86a0b4a3
|
Provenance
The following attestation bundles were made for lmux_aws_bedrock-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on cluebbehusen/lmux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lmux_aws_bedrock-0.3.0-py3-none-any.whl -
Subject digest:
2f5b3d7ab2a21a96f1df7303c19fa193a302897766da675d5c48190e8f854af0 - Sigstore transparency entry: 1218385970
- Sigstore integration time:
-
Permalink:
cluebbehusen/lmux@b9c6a46bfe0da3f5221fff58f89d269858fb4afa -
Branch / Tag:
refs/tags/lmux-aws-bedrock-v0.3.0 - Owner: https://github.com/cluebbehusen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b9c6a46bfe0da3f5221fff58f89d269858fb4afa -
Trigger Event:
push
-
Statement type: