Registry / type-stubs / mypy-boto3-bedrock-runtime

mypy-boto3-bedrock-runtime

JSON →
library1.43.62pypypi✓ verified 23d ago

mypy-boto3-bedrock-runtime provides comprehensive type annotations for the `boto3` Bedrock Runtime service, version 1.42.82. Generated by `mypy-boto3-builder` (version 8.12.0), it enhances developer experience by offering static type checking, auto-completion, and error detection in IDEs like VSCode and PyCharm, and with type checkers like Mypy and Pyright. The library is actively maintained and frequently updated to synchronize with `boto3` releases and schema changes.

pip install mypy-boto3-bedrock-runtime boto3
INSTALL
IMPORT
SIG · MYPY-BOTO3-BEDROCK
M
mypy-boto3-bedrock-runtime
type-stubspythonv1.43.62
Install
3.7s avg
Import
613ms
Disk
50MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.62 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.636s · 52MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.7s · import 0.590s · 53MB
50MB installed
● package 50MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BedrockRuntimeClient
from mypy_boto3_bedrock_runtime import BedrockRuntimeClient
from boto3.client import BedrockRuntimeClient
Client types are provided by the `mypy-boto3` stub package, not directly by `boto3` or `botocore`.
ListAsyncInvokesPaginator
from mypy_boto3_bedrock_runtime.paginator import ListAsyncInvokesPaginator
Paginator types are located in the `paginator` submodule.
AsyncInvokeStatusType
from mypy_boto3_bedrock_runtime.literals import AsyncInvokeStatusType
Literal types (e.g., specific string values) are in the `literals` submodule.
AppliedGuardrailDetailsTypeDef
from mypy_boto3_bedrock_runtime.type_defs import AppliedGuardrailDetailsTypeDef
TypedDicts for API request/response structures are in the `type_defs` submodule.

This quickstart demonstrates how to obtain a type-annotated BedrockRuntime client using `mypy-boto3-bedrock-runtime`. It shows how to call a client method (`invoke_model`) and how to use a paginator (`list_async_invokes`), leveraging `TYPE_CHECKING` for conditional imports. Ensure `boto3` is installed and AWS credentials are configured in your environment or via standard AWS configuration methods.

import boto3 from typing import TYPE_CHECKING import os if TYPE_CHECKING: from mypy_boto3_bedrock_runtime import BedrockRuntimeClient from mypy_boto3_bedrock_runtime.type_defs import InvokeModelResponseTypeDef from mypy_boto3_bedrock_runtime.paginator import ListAsyncInvokesPaginator def get_bedrock_runtime_client() -> "BedrockRuntimeClient": """Returns a typed BedrockRuntime client.""" return boto3.client( "bedrock-runtime", region_name=os.environ.get('AWS_REGION', 'us-east-1'), aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''), aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', ''), aws_session_token=os.environ.get('AWS_SESSION_TOKEN', '') ) def invoke_model_example(): client: BedrockRuntimeClient = get_bedrock_runtime_client() # Example: Invoke a model (replace with actual model_id and body) response: InvokeModelResponseTypeDef = client.invoke_model( modelId="anthropic.claude-v2", contentType="application/json", accept="application/json", body='{"prompt": "Human: Hello, how are you? Assistant:", "max_tokens_to_sample": 200}' ) print(f"Model invocation response: {response['body'].read().decode('utf-8')}") def list_async_invokes_paginator_example(): client: BedrockRuntimeClient = get_bedrock_runtime_client() paginator: ListAsyncInvokesPaginator = client.get_paginator("list_async_invokes") for page in paginator.paginate(): print(f"Async invokes page: {page.get('asyncInvokes')}") if __name__ == "__main__": invoke_model_example() list_async_invokes_paginator_example()
Debug
Known issues
breakingStarting with `mypy-boto3-builder` version 8.12.0, support for Python 3.8 has been removed. All generated packages, including `mypy-boto3-bedrock-runtime`, now require Python 3.9 or newer.
fix
Upgrade your Python environment to 3.9 or a later version.
affects: mypy-boto3-builder >=8.12.0
breakingVersion 8.9.0 of `mypy-boto3-builder` introduced breaking changes in TypeDef naming conventions. Specifically, `RequestRequestTypeDef` suffixes were shortened to `RequestTypeDef`, and `Extra` postfixes were moved to the end of TypeDef names (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`). While `mypy-boto3-bedrock-runtime` specific changes might be rare, these builder-wide changes affect how you reference TypeDefs across all `mypy-boto3` stubs.
fix
Review your TypeDef imports and usages, adjusting names according to the new conventions.
affects: mypy-boto3-builder >=8.9.0
gotchaIt is best practice to wrap type stub imports within an `if TYPE_CHECKING:` block. This ensures that the type stubs are only loaded during static analysis by tools like Mypy and Pyright, preventing them from becoming runtime dependencies in your production environment.
fix
Encapsulate `mypy-boto3-*` imports within `from typing import TYPE_CHECKING` and `if TYPE_CHECKING:` blocks.
affects: All versions
gotchaThe `mypy-boto3-bedrock-runtime` package is generated for a specific `boto3` version (1.42.82 in this case). Mismatching `boto3` runtime versions with the installed stub version can lead to incorrect type hints or unresolved attributes, as the API might have changed between `boto3` versions.
fix
Ensure that your `boto3` installation closely matches the version indicated in the `mypy-boto3-bedrock-runtime` package name (e.g., `mypy-boto3-bedrock-runtime==1.42.82` for `boto3==1.42.82`).
affects: All versions
gotchaWhile `mypy` can often infer types, explicitly annotating the return type of `boto3.client("bedrock-runtime")` with `BedrockRuntimeClient` (and similarly for paginators and waiters) provides the most robust type checking and significantly improves auto-completion in IDEs like VSCode and PyCharm, especially for `boto3`'s dynamically generated clients.
fix
Add explicit type annotations when initializing `boto3` clients, paginators, and waiters, e.g., `client: BedrockRuntimeClient = boto3.client("bedrock-runtime")`.
affects: All versions
Upgrade
Version history
1.43.62latest on PyPI · released Jul 31, 2026
Audit
Dependencies
boto3requiredProvides the AWS SDK for Python that these stubs type-check.
mypyoptionalA static type checker that consumes these stubs.
pythonrequiredRequires Python 3.9 or newer.
Agent activity
19 hits · last 30 days
node
14
OpenAI (training)
1
Resources