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.ServiceUnavailableException,
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#
apply_guardrail#
The action to apply a guardrail.
Type annotations and code completion for boto3.client("bedrock-runtime").apply_guardrail
method.
boto3 documentation
# apply_guardrail method definition
def apply_guardrail(
self,
*,
guardrailIdentifier: str,
guardrailVersion: str,
source: GuardrailContentSourceType, # (1)
content: Sequence[GuardrailContentBlockTypeDef], # (2)
) -> ApplyGuardrailResponseTypeDef: # (3)
...
# apply_guardrail method usage example with argument unpacking
kwargs: ApplyGuardrailRequestRequestTypeDef = { # (1)
"guardrailIdentifier": ...,
"guardrailVersion": ...,
"source": ...,
"content": ...,
}
parent.apply_guardrail(**kwargs)
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:
...
converse#
Sends messages to the specified Amazon Bedrock model.
Type annotations and code completion for boto3.client("bedrock-runtime").converse
method.
boto3 documentation
# converse method definition
def converse(
self,
*,
modelId: str,
messages: Sequence[MessageUnionTypeDef] = ..., # (1)
system: Sequence[SystemContentBlockTypeDef] = ..., # (2)
inferenceConfig: InferenceConfigurationTypeDef = ..., # (3)
toolConfig: ToolConfigurationTypeDef = ..., # (4)
guardrailConfig: GuardrailConfigurationTypeDef = ..., # (5)
additionalModelRequestFields: Mapping[str, Any] = ...,
promptVariables: Mapping[str, PromptVariableValuesTypeDef] = ..., # (6)
additionalModelResponseFieldPaths: Sequence[str] = ...,
) -> ConverseResponseTypeDef: # (7)
...
- See MessageTypeDef MessageOutputTypeDef
- See SystemContentBlockTypeDef
- See InferenceConfigurationTypeDef
- See ToolConfigurationTypeDef
- See GuardrailConfigurationTypeDef
- See PromptVariableValuesTypeDef
- See ConverseResponseTypeDef
# converse method usage example with argument unpacking
kwargs: ConverseRequestRequestTypeDef = { # (1)
"modelId": ...,
}
parent.converse(**kwargs)
converse_stream#
Sends messages to the specified Amazon Bedrock model and returns the response in a stream.
Type annotations and code completion for boto3.client("bedrock-runtime").converse_stream
method.
boto3 documentation
# converse_stream method definition
def converse_stream(
self,
*,
modelId: str,
messages: Sequence[MessageTypeDef] = ..., # (1)
system: Sequence[SystemContentBlockTypeDef] = ..., # (2)
inferenceConfig: InferenceConfigurationTypeDef = ..., # (3)
toolConfig: ToolConfigurationTypeDef = ..., # (4)
guardrailConfig: GuardrailStreamConfigurationTypeDef = ..., # (5)
additionalModelRequestFields: Mapping[str, Any] = ...,
promptVariables: Mapping[str, PromptVariableValuesTypeDef] = ..., # (6)
additionalModelResponseFieldPaths: Sequence[str] = ...,
) -> ConverseStreamResponseTypeDef: # (7)
...
- See MessageTypeDef
- See SystemContentBlockTypeDef
- See InferenceConfigurationTypeDef
- See ToolConfigurationTypeDef
- See GuardrailStreamConfigurationTypeDef
- See PromptVariableValuesTypeDef
- See ConverseStreamResponseTypeDef
# converse_stream method usage example with argument unpacking
kwargs: ConverseStreamRequestRequestTypeDef = { # (1)
"modelId": ...,
}
parent.converse_stream(**kwargs)
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 Amazon Bedrock model to run inference using the prompt and inference parameters 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,
*,
modelId: str,
body: BlobTypeDef = ...,
contentType: str = ...,
accept: str = ...,
trace: TraceType = ..., # (1)
guardrailIdentifier: str = ...,
guardrailVersion: str = ...,
) -> InvokeModelResponseTypeDef: # (2)
...
- See TraceType
- See InvokeModelResponseTypeDef
# invoke_model method usage example with argument unpacking
kwargs: InvokeModelRequestRequestTypeDef = { # (1)
"modelId": ...,
}
parent.invoke_model(**kwargs)
invoke_model_with_response_stream#
Invoke the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body.
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,
*,
modelId: str,
body: BlobTypeDef = ...,
contentType: str = ...,
accept: str = ...,
trace: TraceType = ..., # (1)
guardrailIdentifier: str = ...,
guardrailVersion: str = ...,
) -> InvokeModelWithResponseStreamResponseTypeDef: # (2)
...
# invoke_model_with_response_stream method usage example with argument unpacking
kwargs: InvokeModelWithResponseStreamRequestRequestTypeDef = { # (1)
"modelId": ...,
}
parent.invoke_model_with_response_stream(**kwargs)