Skip to content

BedrockRuntimeClient#

Index > BedrockRuntime > BedrockRuntimeClient

Auto-generated documentation for BedrockRuntime type annotations stubs module mypy-boto3-bedrock-runtime.

BedrockRuntimeClient#

Type annotations and code completion for boto3.client("bedrock-runtime"). boto3 documentation

# BedrockRuntimeClient usage example

from boto3.session import Session
from mypy_boto3_bedrock_runtime.client import BedrockRuntimeClient

def get_bedrock-runtime_client() -> BedrockRuntimeClient:
    return Session().client("bedrock-runtime")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("bedrock-runtime").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("bedrock-runtime")

try:
    do_something(client)
except (
    client.exceptions.AccessDeniedException,
    client.exceptions.ClientError,
    client.exceptions.InternalServerException,
    client.exceptions.ModelErrorException,
    client.exceptions.ModelNotReadyException,
    client.exceptions.ModelStreamErrorException,
    client.exceptions.ModelTimeoutException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.ServiceQuotaExceededException,
    client.exceptions.ThrottlingException,
    client.exceptions.ValidationException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_bedrock_runtime.client import Exceptions

def handle_error(exc: Exceptions.AccessDeniedException) -> None:
    ...

Methods#

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("bedrock-runtime").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

close#

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("bedrock-runtime").close method. boto3 documentation

# close method definition

def close(
    self,
) -> None:
    ...

generate_presigned_url#

Generate a presigned url given a client, its method, and arguments.

Type annotations and code completion for boto3.client("bedrock-runtime").generate_presigned_url method. boto3 documentation

# generate_presigned_url method definition

def generate_presigned_url(
    self,
    ClientMethod: str,
    Params: Mapping[str, Any] = ...,
    ExpiresIn: int = 3600,
    HttpMethod: str = ...,
) -> str:
    ...

invoke_model#

Invokes the specified Bedrock model to run inference using the input provided in the request body.

Type annotations and code completion for boto3.client("bedrock-runtime").invoke_model method. boto3 documentation

# invoke_model method definition

def invoke_model(
    self,
    *,
    body: Union[str, bytes, IO[Any], StreamingBody],
    modelId: str,
    contentType: str = ...,
    accept: str = ...,
) -> InvokeModelResponseTypeDef:  # (1)
    ...
  1. See InvokeModelResponseTypeDef
# invoke_model method usage example with argument unpacking

kwargs: InvokeModelRequestRequestTypeDef = {  # (1)
    "body": ...,
    "modelId": ...,
}

parent.invoke_model(**kwargs)
  1. See InvokeModelRequestRequestTypeDef

invoke_model_with_response_stream#

Invoke the specified Bedrock model to run inference using the input provided.

Type annotations and code completion for boto3.client("bedrock-runtime").invoke_model_with_response_stream method. boto3 documentation

# invoke_model_with_response_stream method definition

def invoke_model_with_response_stream(
    self,
    *,
    body: Union[str, bytes, IO[Any], StreamingBody],
    modelId: str,
    contentType: str = ...,
    accept: str = ...,
) -> InvokeModelWithResponseStreamResponseTypeDef:  # (1)
    ...
  1. See InvokeModelWithResponseStreamResponseTypeDef
# invoke_model_with_response_stream method usage example with argument unpacking

kwargs: InvokeModelWithResponseStreamRequestRequestTypeDef = {  # (1)
    "body": ...,
    "modelId": ...,
}

parent.invoke_model_with_response_stream(**kwargs)
  1. See InvokeModelWithResponseStreamRequestRequestTypeDef