BedrockRuntimeClient#
Index > BedrockRuntime > BedrockRuntimeClient
Auto-generated documentation for BedrockRuntime type annotations stubs module types-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 types_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.ConflictException,
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 types_boto3_bedrock_runtime.client import Exceptions
def handle_error(exc: Exceptions.AccessDeniedException) -> None:
...
Methods#
can_paginate#
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:
...
generate_presigned_url#
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:
...
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)
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] = ...,
requestMetadata: Mapping[str, str] = ...,
performanceConfig: PerformanceConfigurationTypeDef = ..., # (7)
) -> ConverseResponseTypeDef: # (8)
...
- See MessageTypeDef MessageOutputTypeDef
- See SystemContentBlockTypeDef
- See InferenceConfigurationTypeDef
- See ToolConfigurationTypeDef
- See GuardrailConfigurationTypeDef
- See PromptVariableValuesTypeDef
- See PerformanceConfigurationTypeDef
- 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] = ...,
requestMetadata: Mapping[str, str] = ...,
performanceConfig: PerformanceConfigurationTypeDef = ..., # (7)
) -> ConverseStreamResponseTypeDef: # (8)
...
- See MessageTypeDef
- See SystemContentBlockTypeDef
- See InferenceConfigurationTypeDef
- See ToolConfigurationTypeDef
- See GuardrailStreamConfigurationTypeDef
- See PromptVariableValuesTypeDef
- See PerformanceConfigurationTypeDef
- See ConverseStreamResponseTypeDef
# converse_stream method usage example with argument unpacking
kwargs: ConverseStreamRequestRequestTypeDef = { # (1)
"modelId": ...,
}
parent.converse_stream(**kwargs)
get_async_invoke#
Retrieve information about an asynchronous invocation.
Type annotations and code completion for boto3.client("bedrock-runtime").get_async_invoke
method.
boto3 documentation
# get_async_invoke method definition
def get_async_invoke(
self,
*,
invocationArn: str,
) -> GetAsyncInvokeResponseTypeDef: # (1)
...
# get_async_invoke method usage example with argument unpacking
kwargs: GetAsyncInvokeRequestRequestTypeDef = { # (1)
"invocationArn": ...,
}
parent.get_async_invoke(**kwargs)
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 = ...,
performanceConfigLatency: PerformanceConfigLatencyType = ..., # (2)
) -> InvokeModelResponseTypeDef: # (3)
...
# 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 = ...,
performanceConfigLatency: PerformanceConfigLatencyType = ..., # (2)
) -> InvokeModelWithResponseStreamResponseTypeDef: # (3)
...
# invoke_model_with_response_stream method usage example with argument unpacking
kwargs: InvokeModelWithResponseStreamRequestRequestTypeDef = { # (1)
"modelId": ...,
}
parent.invoke_model_with_response_stream(**kwargs)
list_async_invokes#
Lists asynchronous invocations.
Type annotations and code completion for boto3.client("bedrock-runtime").list_async_invokes
method.
boto3 documentation
# list_async_invokes method definition
def list_async_invokes(
self,
*,
submitTimeAfter: TimestampTypeDef = ...,
submitTimeBefore: TimestampTypeDef = ...,
statusEquals: AsyncInvokeStatusType = ..., # (1)
maxResults: int = ...,
nextToken: str = ...,
sortBy: SortAsyncInvocationByType = ..., # (2)
sortOrder: SortOrderType = ..., # (3)
) -> ListAsyncInvokesResponseTypeDef: # (4)
...
- See AsyncInvokeStatusType
- See SortAsyncInvocationByType
- See SortOrderType
- See ListAsyncInvokesResponseTypeDef
# list_async_invokes method usage example with argument unpacking
kwargs: ListAsyncInvokesRequestRequestTypeDef = { # (1)
"submitTimeAfter": ...,
}
parent.list_async_invokes(**kwargs)
start_async_invoke#
Starts an asynchronous invocation.
Type annotations and code completion for boto3.client("bedrock-runtime").start_async_invoke
method.
boto3 documentation
# start_async_invoke method definition
def start_async_invoke(
self,
*,
modelId: str,
modelInput: Mapping[str, Any],
outputDataConfig: AsyncInvokeOutputDataConfigTypeDef, # (1)
clientRequestToken: str = ...,
tags: Sequence[TagTypeDef] = ..., # (2)
) -> StartAsyncInvokeResponseTypeDef: # (3)
...
# start_async_invoke method usage example with argument unpacking
kwargs: StartAsyncInvokeRequestRequestTypeDef = { # (1)
"modelId": ...,
"modelInput": ...,
"outputDataConfig": ...,
}
parent.start_async_invoke(**kwargs)
get_paginator#
Type annotations and code completion for boto3.client("bedrock-runtime").get_paginator
method with overloads.
client.get_paginator("list_async_invokes")
-> ListAsyncInvokesPaginator