# This file is automatically generated by botocraft. Do not edit directly.
# mypy: disable-error-code="index, override, assignment, union-attr, misc"
from pydantic import Field
from .abstract import (
Boto3Model,
ReadonlyBoto3Model,
PrimaryBoto3Model,
ReadonlyPrimaryBoto3Model,
Boto3ModelManager,
ReadonlyBoto3ModelManager,
)
from botocraft.mixins.bedrock_runtime import ConverseStream
from typing import ClassVar, Literal, Any, cast
from botocraft.mixins.tags import TagsDictMixin
from datetime import datetime
from botocraft.mixins.bedrock_runtime import InvokeModelResponseStream
import builtins
from botocraft.mixins.bedrock_runtime import ConverseStreamResponseMixin
from botocraft.services.common import Tag
from botocraft.mixins.bedrock_runtime import InvokeModelWithResponseStreamResponseMixin
from botocraft.mixins.bedrock_runtime import ConversationManagerMixin
# ===============
# Managers
# ===============
[docs]class ConversationManager(ConversationManagerMixin, ReadonlyBoto3ModelManager):
service_name: str = "bedrock-runtime"
[docs] def converse(
self,
modelId: str,
*,
messages: "builtins.list[BedrockMessage] | None" = None,
system: "builtins.list[SystemContentBlock] | None" = None,
inferenceConfig: "InferenceConfiguration | None" = None,
toolConfig: "ToolConfiguration | None" = None,
guardrailConfig: "GuardrailConfiguration | None" = None,
additionalModelRequestFields: "Document | None" = None,
promptVariables: "dict[str, PromptVariableValues] | None" = None,
additionalModelResponseFieldPaths: "builtins.list[str] | None" = None,
requestMetadata: "dict[str, str] | None" = None,
performanceConfig: "PerformanceConfiguration | None" = None,
serviceTier: "ServiceTier | None" = None,
outputConfig: "OutputConfig | None" = None,
) -> "Conversation":
"""
Sends messages to the specified Amazon Bedrock model. ``Converse`` provides a
consistent interface that works with all models that support messages. This
allows you to write code once and use it with different models. If a model has
unique inference parameters, you can also pass those unique parameters to the
model.
Args:
modelId: Specifies the model or throughput with which to run inference, or the prompt resource to use in inference.
The value depends on the resource that you use:
Keyword Args:
messages: The messages that you want to send to the model.
system: A prompt that provides instructions or context to the model about the task it should perform, or the persona
it should adopt during the conversation.
inferenceConfig: Inference parameters to pass to the model. ``Converse`` and ``ConverseStream`` support a base set
of inference parameters. If you need to pass additional parameters that the model supports, use the
``additionalModelRequestFields`` request field.
toolConfig: Configuration information for the tools that the model can use when generating a response.
guardrailConfig: Configuration information for a guardrail that you want to use in the request. If you include
``guardContent`` blocks in the ``content`` field in the ``messages`` field, the guardrail operates only on those
messages. If you include no ``guardContent`` blocks, the guardrail operates on all messages in the request body and
in any included prompt resource.
additionalModelRequestFields: Additional inference parameters that the model supports, beyond the base set of
inference parameters that ``Converse`` and ``ConverseStream`` support in the ``inferenceConfig`` field. For more
information, see `Model parameters <https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html>`_.
promptVariables: Contains a map of variables in a prompt from Prompt management to objects containing the values to
fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the
``modelId`` field.
additionalModelResponseFieldPaths: Additional model parameters field paths to return in the response. ``Converse``
and ``ConverseStream`` return the requested fields as a JSON Pointer object in the ``additionalModelResponseFields``
field. The following is example JSON for ``additionalModelResponseFieldPaths``.
requestMetadata: Key-value pairs that you can use to filter invocation logs.
performanceConfig: Model performance settings for the request.
serviceTier: Specifies the processing tier configuration used for serving the request.
outputConfig: Output configuration for a model response.
"""
args: dict[str, Any] = dict(
modelId=self.serialize(modelId),
messages=self.serialize(messages),
system=self.serialize(system),
inferenceConfig=self.serialize(inferenceConfig),
toolConfig=self.serialize(toolConfig),
guardrailConfig=self.serialize(guardrailConfig),
additionalModelRequestFields=self.serialize(additionalModelRequestFields),
promptVariables=self.serialize(promptVariables),
additionalModelResponseFieldPaths=self.serialize(
additionalModelResponseFieldPaths
),
requestMetadata=self.serialize(requestMetadata),
performanceConfig=self.serialize(performanceConfig),
serviceTier=self.serialize(serviceTier),
outputConfig=self.serialize(outputConfig),
)
_response = self.client.converse(
**{k: v for k, v in args.items() if v is not None}
)
response = Conversation(**_response)
results: "Conversation" = None
if response is not None:
results = response
self.sessionize(results)
return cast("Conversation", results)
[docs] def converse_stream(
self,
modelId: str,
*,
messages: "builtins.list[BedrockMessage] | None" = None,
system: "builtins.list[SystemContentBlock] | None" = None,
inferenceConfig: "InferenceConfiguration | None" = None,
toolConfig: "ToolConfiguration | None" = None,
guardrailConfig: "GuardrailStreamConfiguration | None" = None,
additionalModelRequestFields: "Document | None" = None,
promptVariables: "dict[str, PromptVariableValues] | None" = None,
additionalModelResponseFieldPaths: "builtins.list[str] | None" = None,
requestMetadata: "dict[str, str] | None" = None,
performanceConfig: "PerformanceConfiguration | None" = None,
serviceTier: "ServiceTier | None" = None,
outputConfig: "OutputConfig | None" = None,
) -> "ConverseStreamResponse":
"""
Sends messages to the specified Amazon Bedrock model and returns the response in
a stream. ``ConverseStream`` provides a consistent API that works with all
Amazon Bedrock models that support messages. This allows you to write code once
and use it with different models. Should a model have unique inference
parameters, you can also pass those unique parameters to the model.
Args:
modelId: Specifies the model or throughput with which to run inference, or the prompt resource to use in inference.
The value depends on the resource that you use:
Keyword Args:
messages: The messages that you want to send to the model.
system: A prompt that provides instructions or context to the model about the task it should perform, or the persona
it should adopt during the conversation.
inferenceConfig: Inference parameters to pass to the model. ``Converse`` and ``ConverseStream`` support a base set
of inference parameters. If you need to pass additional parameters that the model supports, use the
``additionalModelRequestFields`` request field.
toolConfig: Configuration information for the tools that the model can use when generating a response.
guardrailConfig: Configuration information for a guardrail that you want to use in the request. If you include
``guardContent`` blocks in the ``content`` field in the ``messages`` field, the guardrail operates only on those
messages. If you include no ``guardContent`` blocks, the guardrail operates on all messages in the request body and
in any included prompt resource.
additionalModelRequestFields: Additional inference parameters that the model supports, beyond the base set of
inference parameters that ``Converse`` and ``ConverseStream`` support in the ``inferenceConfig`` field. For more
information, see `Model parameters <https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html>`_.
promptVariables: Contains a map of variables in a prompt from Prompt management to objects containing the values to
fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the
``modelId`` field.
additionalModelResponseFieldPaths: Additional model parameters field paths to return in the response. ``Converse``
and ``ConverseStream`` return the requested fields as a JSON Pointer object in the ``additionalModelResponseFields``
field. The following is example JSON for ``additionalModelResponseFieldPaths``.
requestMetadata: Key-value pairs that you can use to filter invocation logs.
performanceConfig: Model performance settings for the request.
serviceTier: Specifies the processing tier configuration used for serving the request.
outputConfig: Output configuration for a model response.
"""
args: dict[str, Any] = dict(
modelId=self.serialize(modelId),
messages=self.serialize(messages),
system=self.serialize(system),
inferenceConfig=self.serialize(inferenceConfig),
toolConfig=self.serialize(toolConfig),
guardrailConfig=self.serialize(guardrailConfig),
additionalModelRequestFields=self.serialize(additionalModelRequestFields),
promptVariables=self.serialize(promptVariables),
additionalModelResponseFieldPaths=self.serialize(
additionalModelResponseFieldPaths
),
requestMetadata=self.serialize(requestMetadata),
performanceConfig=self.serialize(performanceConfig),
serviceTier=self.serialize(serviceTier),
outputConfig=self.serialize(outputConfig),
)
_response = self.client.converse_stream(
**{k: v for k, v in args.items() if v is not None}
)
response = ConverseStreamResponse(**_response)
results: "ConverseStreamResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("ConverseStreamResponse", results)
[docs] def count_tokens(self, modelId: str, input: "CountTokensInput") -> "TokenCount":
"""
Returns the token count for a given inference request. This operation helps you
estimate token usage before sending requests to foundation models by returning
the token count that would be used if the same input were sent to the model in
an inference request.
Args:
modelId: The unique identifier or ARN of the foundation model to use for token counting. Each model processes tokens
differently, so the token count is specific to the model you specify.
input: The input for which to count tokens. The structure of this parameter depends on whether you're counting
tokens for an ``InvokeModel`` or ``Converse`` request:
"""
args: dict[str, Any] = dict(
modelId=self.serialize(modelId), input=self.serialize(input)
)
_response = self.client.count_tokens(
**{k: v for k, v in args.items() if v is not None}
)
response = TokenCount(**_response)
results: "TokenCount" = None
if response is not None:
results = response
self.sessionize(results)
return cast("TokenCount", results)
[docs] def invoke_model(
self,
modelId: str,
*,
body: "bytes | None" = None,
contentType: "str | None" = None,
accept: "str | None" = None,
trace: "Literal['ENABLED', 'DISABLED', 'ENABLED_FULL'] | None" = None,
guardrailIdentifier: "str | None" = None,
guardrailVersion: "str | None" = None,
performanceConfigLatency: "Literal['standard', 'optimized'] | None" = None,
serviceTier: "Literal['priority', 'default', 'flex', 'reserved'] | None" = None,
) -> "InvokeModelResponse":
"""
Invokes the specified Amazon Bedrock model to run inference using the prompt and
inference parameters provided in the request body. You use model inference to
generate text, images, and embeddings.
Args:
modelId: The unique identifier of the model to invoke to run inference.
Keyword Args:
body: The prompt and inference parameters in the format specified in the ``contentType`` in the header. You must
provide the body in JSON format. To see the format and content of the request and response bodies for different
models, refer to `Inference parameters <https://docs.aws.amazon.com/bedrock/latest/userguide/model-
parameters.html>`_. For more information, see `Run inference
<https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html>`_ in the Bedrock User Guide.
contentType: The MIME type of the input data in the request. You must specify ``application/json``.
accept: The desired MIME type of the inference body in the response. The default value is ``application/json``.
trace: Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.
guardrailIdentifier: The unique identifier of the guardrail that you want to use. If you don't provide a value, no
guardrail is applied to the invocation.
guardrailVersion: The version number for the guardrail. The value can also be ``DRAFT``.
performanceConfigLatency: Model performance settings for the request.
serviceTier: Specifies the processing tier type used for serving the request.
"""
args: dict[str, Any] = dict(
modelId=self.serialize(modelId),
body=self.serialize(body),
contentType=self.serialize(contentType),
accept=self.serialize(accept),
trace=self.serialize(trace),
guardrailIdentifier=self.serialize(guardrailIdentifier),
guardrailVersion=self.serialize(guardrailVersion),
performanceConfigLatency=self.serialize(performanceConfigLatency),
serviceTier=self.serialize(serviceTier),
)
_response = self.client.invoke_model(
**{k: v for k, v in args.items() if v is not None}
)
response = InvokeModelResponse(**_response)
results: "InvokeModelResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("InvokeModelResponse", results)
[docs] def invoke_model_with_response_stream(
self,
modelId: str,
*,
body: "bytes | None" = None,
contentType: "str | None" = None,
accept: "str | None" = None,
trace: "Literal['ENABLED', 'DISABLED', 'ENABLED_FULL'] | None" = None,
guardrailIdentifier: "str | None" = None,
guardrailVersion: "str | None" = None,
performanceConfigLatency: "Literal['standard', 'optimized'] | None" = None,
serviceTier: "Literal['priority', 'default', 'flex', 'reserved'] | None" = None,
) -> "InvokeModelWithResponseStreamResponse":
"""
Invoke the specified Amazon Bedrock model to run inference using the prompt and
inference parameters provided in the request body. The response is returned in a
stream.
Args:
modelId: The unique identifier of the model to invoke to run inference.
Keyword Args:
body: The prompt and inference parameters in the format specified in the ``contentType`` in the header. You must
provide the body in JSON format. To see the format and content of the request and response bodies for different
models, refer to `Inference parameters <https://docs.aws.amazon.com/bedrock/latest/userguide/model-
parameters.html>`_. For more information, see `Run inference
<https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html>`_ in the Bedrock User Guide.
contentType: The MIME type of the input data in the request. You must specify ``application/json``.
accept: The desired MIME type of the inference body in the response. The default value is ``application/json``.
trace: Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.
guardrailIdentifier: The unique identifier of the guardrail that you want to use. If you don't provide a value, no
guardrail is applied to the invocation.
guardrailVersion: The version number for the guardrail. The value can also be ``DRAFT``.
performanceConfigLatency: Model performance settings for the request.
serviceTier: Specifies the processing tier type used for serving the request.
"""
args: dict[str, Any] = dict(
modelId=self.serialize(modelId),
body=self.serialize(body),
contentType=self.serialize(contentType),
accept=self.serialize(accept),
trace=self.serialize(trace),
guardrailIdentifier=self.serialize(guardrailIdentifier),
guardrailVersion=self.serialize(guardrailVersion),
performanceConfigLatency=self.serialize(performanceConfigLatency),
serviceTier=self.serialize(serviceTier),
)
_response = self.client.invoke_model_with_response_stream(
**{k: v for k, v in args.items() if v is not None}
)
response = InvokeModelWithResponseStreamResponse(**_response)
results: "InvokeModelWithResponseStreamResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("InvokeModelWithResponseStreamResponse", results)
[docs] def start_async_invoke(
self,
modelId: str,
modelInput: "ModelInputPayload",
outputDataConfig: "AsyncInvokeOutputDataConfig",
*,
clientRequestToken: "str | None" = None,
tags: "builtins.list[Tag] | None" = None,
) -> "StartAsyncInvokeResponse":
"""
Starts an asynchronous invocation.
Args:
modelId: The model to invoke.
modelInput: Input to send to the model.
outputDataConfig: Where to store the output.
Keyword Args:
clientRequestToken: Specify idempotency token to ensure that requests are not duplicated.
tags: Tags to apply to the invocation.
"""
args: dict[str, Any] = dict(
modelId=self.serialize(modelId),
modelInput=self.serialize(modelInput),
outputDataConfig=self.serialize(outputDataConfig),
clientRequestToken=self.serialize(clientRequestToken),
tags=self.serialize(tags),
)
_response = self.client.start_async_invoke(
**{k: v for k, v in args.items() if v is not None}
)
response = StartAsyncInvokeResponse(**_response)
results: "StartAsyncInvokeResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("StartAsyncInvokeResponse", results)
[docs] def get_async_invoke(self, invocationArn: str) -> "GetAsyncInvokeResponse":
"""
Retrieve information about an asynchronous invocation.
Args:
invocationArn: The invocation's ARN.
"""
args: dict[str, Any] = dict(invocationArn=self.serialize(invocationArn))
_response = self.client.get_async_invoke(
**{k: v for k, v in args.items() if v is not None}
)
response = GetAsyncInvokeResponse(**_response)
results: "GetAsyncInvokeResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("GetAsyncInvokeResponse", results)
[docs] def list_async_invokes(
self,
*,
submitTimeAfter: "datetime | None" = None,
submitTimeBefore: "datetime | None" = None,
statusEquals: "Literal['InProgress', 'Completed', 'Failed'] | None" = None,
maxResults: "int | None" = None,
nextToken: "str | None" = None,
sortBy: "Literal['SubmissionTime'] | None" = None,
sortOrder: "Literal['Ascending', 'Descending'] | None" = None,
) -> "ListAsyncInvokesResponse":
"""
Lists asynchronous invocations.
Keyword Args:
submitTimeAfter: Include invocations submitted after this time.
submitTimeBefore: Include invocations submitted before this time.
statusEquals: Filter invocations by status.
maxResults: The maximum number of invocations to return in one page of results.
nextToken: Specify the pagination token from a previous request to retrieve the next page of results.
sortBy: How to sort the response.
sortOrder: The sorting order for the response.
"""
args: dict[str, Any] = dict(
submitTimeAfter=self.serialize(submitTimeAfter),
submitTimeBefore=self.serialize(submitTimeBefore),
statusEquals=self.serialize(statusEquals),
maxResults=self.serialize(maxResults),
nextToken=self.serialize(nextToken),
sortBy=self.serialize(sortBy),
sortOrder=self.serialize(sortOrder),
)
_response = self.client.list_async_invokes(
**{k: v for k, v in args.items() if v is not None}
)
response = ListAsyncInvokesResponse(**_response)
results: "ListAsyncInvokesResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("ListAsyncInvokesResponse", results)
[docs]class GuardrailApplicationManager(ReadonlyBoto3ModelManager):
service_name: str = "bedrock-runtime"
[docs] def apply(
self,
guardrailIdentifier: str,
guardrailVersion: str,
source: Literal["INPUT", "OUTPUT"],
content: "builtins.list[GuardrailContentBlock]",
*,
outputScope: "Literal['INTERVENTIONS', 'FULL'] | None" = None,
) -> "GuardrailApplication":
"""
The action to apply a guardrail.
Args:
guardrailIdentifier: The guardrail identifier used in the request to apply the guardrail.
guardrailVersion: The guardrail version used in the request to apply the guardrail.
source: The source of data used in the request to apply the guardrail.
content: The content details used in the request to apply the guardrail.
Keyword Args:
outputScope: Specifies the scope of the output that you get in the response. Set to ``FULL`` to return the entire
output, including any detected and non-detected entries in the response for enhanced debugging.
"""
args: dict[str, Any] = dict(
guardrailIdentifier=self.serialize(guardrailIdentifier),
guardrailVersion=self.serialize(guardrailVersion),
source=self.serialize(source),
content=self.serialize(content),
outputScope=self.serialize(outputScope),
)
_response = self.client.apply_guardrail(
**{k: v for k, v in args.items() if v is not None}
)
response = GuardrailApplication(**_response)
results: "GuardrailApplication" = None
if response is not None:
results = response
self.sessionize(results)
return cast("GuardrailApplication", results)
# ==============
# Service Models
# ==============
[docs]class S3Location(Boto3Model):
"""
A storage location in an Amazon S3 bucket.
"""
uri: str
"""
An object URI starting with ``s3://``.
"""
bucketOwner: "str | None" = None
"""
If the bucket belongs to another AWS account, specify that account's ID.
"""
[docs]class ImageSource(Boto3Model):
"""
The source for an image.
"""
data: bytes = Field(default=None, alias="bytes")
"""
The raw image bytes for the image.
If you use an AWS SDK, you don't need to encode the image bytes in base64.
"""
s3Location: "S3Location | None" = None
"""
The location of an image object in an Amazon S3 bucket.
To see which models support S3 uploads, see
`Supported models and features for Converse <https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-
features.html>`_.
"""
[docs]class ErrorBlock(Boto3Model):
"""
A block containing error information when content processing fails.
"""
message: "str | None" = None
"""
A human-readable error message describing what went wrong during content processing.
"""
[docs]class ImageBlock(Boto3Model):
"""
Image content for a message.
"""
format: Literal["png", "jpeg", "gif", "webp"]
"""
The format of the image.
"""
source: ImageSource
"""
The source for the image.
"""
error: "ErrorBlock | None" = None
"""
Error information if the image block could not be processed or contains invalid
data.
"""
[docs]class DocumentContentBlock(Boto3Model):
"""
Contains the actual content of a document that can be processed by the model and
potentially cited in the response.
"""
text: "str | None" = None
"""
The text content of the document.
"""
[docs]class DocumentSource(Boto3Model):
"""
Contains the content of a document.
"""
data: bytes = Field(default=None, alias="bytes")
"""
The raw bytes for the document.
If you use an Amazon Web Services SDK, you don't need to encode the bytes in base64.
"""
s3Location: "S3Location | None" = None
"""
The location of a document object in an Amazon S3 bucket.
To see which models support S3 uploads, see
`Supported models and features for Converse <https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-
features.html>`_.
"""
text: "str | None" = None
"""
The text content of the document source.
"""
content: "builtins.list[DocumentContentBlock] | None" = Field(default_factory=list)
"""
The structured content of the document source, which may include various content
blocks such as text, images, or other document elements.
"""
[docs]class CitationsConfig(Boto3Model):
"""
Configuration settings for enabling and controlling document citations in Converse
API responses.
When enabled, the model can include citation information that links generated
content back to specific source documents.
"""
enabled: bool
"""
Specifies whether citations from the selected document should be used in the model's
response.
When set to true, the model can generate citations that reference the source
documents used to inform the response.
"""
[docs]class DocumentBlock(Boto3Model):
"""
A document to include in a message.
"""
format: "Literal['pdf', 'csv', 'doc', 'docx', 'xls', 'xlsx', 'html', 'txt', 'md'] | None" = None
"""
The format of a document, or its extension.
"""
name: str
"""
A name for the document.
The name can only contain the following characters:
"""
source: DocumentSource
"""
Contains the content of the document.
"""
context: "str | None" = None
"""
Contextual information about how the document should be processed or interpreted by
the model when generating citations.
"""
citations: "CitationsConfig | None" = None
"""
Configuration settings that control how citations should be generated for this
specific document.
"""
[docs]class VideoSource(Boto3Model):
"""
A video source.
You can upload a smaller video as a base64-encoded string as long as the encoded
file is less than 25MB. You can also transfer videos up to 1GB in size from an S3
bucket.
"""
data: bytes = Field(default=None, alias="bytes")
"""
Video content encoded in base64.
"""
s3Location: "S3Location | None" = None
"""
The location of a video object in an Amazon S3 bucket.
To see which models support S3 uploads, see
`Supported models and features for Converse <https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-
features.html>`_.
"""
[docs]class VideoBlock(Boto3Model):
"""
A video block.
"""
format: Literal[
"mkv", "mov", "mp4", "webm", "flv", "mpeg", "mpg", "wmv", "three_gp"
]
"""
The block's format.
"""
source: VideoSource
"""
The block's source.
"""
[docs]class AudioSource(Boto3Model):
"""
The source of audio data, which can be provided either as raw bytes or a reference
to an S3 location.
"""
data: bytes = Field(default=None, alias="bytes")
"""
Audio data encoded in base64.
"""
s3Location: "S3Location | None" = None
"""
A reference to audio data stored in an Amazon S3 bucket.
To see which models support S3 uploads, see
`Supported models and features for Converse <https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-
features.html>`_.
"""
[docs]class AudioBlock(Boto3Model):
"""
An audio content block that contains audio data in various supported formats.
"""
format: Literal[
"mp3",
"opus",
"wav",
"aac",
"flac",
"mp4",
"ogg",
"mkv",
"mka",
"x-aac",
"m4a",
"mpeg",
"mpga",
"pcm",
"webm",
]
"""
The format of the audio data, such as MP3, WAV, FLAC, or other supported audio
formats.
"""
source: AudioSource
"""
The source of the audio data, which can be provided as raw bytes or an S3 location.
"""
error: "ErrorBlock | None" = None
"""
Error information if the audio block could not be processed or contains invalid
data.
"""
[docs]class Document(Boto3Model):
pass
[docs]class SearchResultContentBlock(Boto3Model):
"""
A block within a search result that contains the content.
"""
text: str
"""
The actual text content.
"""
[docs]class SearchResultBlock(Boto3Model):
"""
A search result block that enables natural citations with proper source attribution
for retrieved content.
This field is only supported by Anthropic Claude Opus 4.1, Opus 4, Sonnet 4.5,
Sonnet 4, Sonnet 3.7, and 3.5 Haiku models.
"""
source: str
"""
The source URL or identifier for the content.
"""
title: str
"""
A descriptive title for the search result.
"""
content: "builtins.list[SearchResultContentBlock]"
"""
An array of search result content block.
"""
citations: "CitationsConfig | None" = None
"""
Configuration setting for citations.
"""
[docs]class ToolResultContentBlock(Boto3Model):
"""
The tool result content block.
For more information, see
`Call a tool with the Converse API <https://docs.aws.amazon.com/bedrock/latest/userguide/tool-use.html>`_
in the Amazon Bedrock User Guide.
"""
jsonData: Document = Field(default=None, alias="json")
"""
A tool result that is JSON format data.
"""
text: "str | None" = None
"""
A tool result that is text.
"""
image: "ImageBlock | None" = None
"""
A tool result that is an image.
"""
document: "DocumentBlock | None" = None
"""
A tool result that is a document.
"""
video: "VideoBlock | None" = None
"""
A tool result that is video.
"""
searchResult: "SearchResultBlock | None" = None
"""
A tool result that is a search result.
"""
[docs]class GuardrailConverseTextBlock(Boto3Model):
"""
A text block that contains text that you want to assess with a guardrail.
For more information, see
`GuardrailConverseCo ntentBlock <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_GuardrailConverseContentBlock.html>`_.
"""
text: str
"""
The text that you want to guard.
"""
qualifiers: "builtins.list[Literal['grounding_source', 'query', 'guard_content']] | None" = Field(
default_factory=list
)
"""
The qualifier details for the guardrails contextual grounding filter.
"""
[docs]class GuardrailConverseImageSource(Boto3Model):
"""
The image source (image bytes) of the guardrail converse image source.
"""
data: bytes = Field(default=None, alias="bytes")
"""
The raw image bytes for the image.
"""
[docs]class GuardrailConverseImageBlock(Boto3Model):
"""
An image block that contains images that you want to assess with a guardrail.
"""
format: Literal["png", "jpeg"]
"""
The format details for the image type of the guardrail converse image block.
"""
source: GuardrailConverseImageSource
"""
The image source (image bytes) of the guardrail converse image block.
"""
[docs]class GuardrailConverseContentBlock(Boto3Model):
"""A content block for selective guarding with the
`Converse <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html>`_ or
`ConverseStream <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html>`_ API
operations.
"""
text: "GuardrailConverseTextBlock | None" = None
"""
The text to guard.
"""
image: "GuardrailConverseImageBlock | None" = None
"""
Image within converse content block to be evaluated by the guardrail.
"""
[docs]class CachePointBlock(Boto3Model):
"""
Defines a section of content to be cached for reuse in subsequent API calls.
"""
type: Literal["default"]
"""
Specifies the type of cache point within the CachePointBlock.
"""
ttl: "Literal['5m', '1h'] | None" = None
"""
Optional TTL duration for cache entries.
When specified, enables extended TTL caching with the specified duration. When
omitted, uses ``type`` value for caching behavior.
"""
[docs]class ReasoningTextBlock(Boto3Model):
"""
Contains the reasoning that the model used to return the output.
"""
text: str
"""
The reasoning that the model used to return the output.
"""
signature: "str | None" = None
"""
A token that verifies that the reasoning text was generated by the model.
If you pass a reasoning block back to the API in a multi-turn conversation, include
the text and its signature unmodified.
"""
[docs]class ReasoningContentBlock(Boto3Model):
"""
Contains content regarding the reasoning that is carried out by the model with
respect to the content in the content block.
Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the
accuracy of its final response.
"""
reasoningText: "ReasoningTextBlock | None" = None
"""
The reasoning that the model used to return the output.
"""
redactedContent: "bytes | None" = None
"""
The content in the reasoning that was encrypted by the model provider for safety
reasons.
The encryption doesn't affect the quality of responses.
"""
[docs]class CitationGeneratedContent(Boto3Model):
"""
Contains the generated text content that corresponds to or is supported by a
citation from a source document.
"""
text: "str | None" = None
"""
The text content that was generated by the model and is supported by the associated
citation.
"""
[docs]class CitationSourceContent(Boto3Model):
"""
Contains the actual text content from a source document that is being cited or
referenced in the model's response.
"""
text: "str | None" = None
"""
The text content from the source document that is being cited.
"""
[docs]class WebLocation(Boto3Model):
"""
Provides the URL and domain information for the website that was cited when
performing a web search.
"""
url: "str | None" = None
"""
The URL that was cited when performing a web search.
"""
domain: "str | None" = None
"""
The domain that was cited when performing a web search.
"""
[docs]class DocumentCharLocation(Boto3Model):
"""
Specifies a character-level location within a document, providing precise
positioning information for cited content using start and end character indices.
"""
documentIndex: "int | None" = None
"""
The index of the document within the array of documents provided in the request.
"""
start: "int | None" = None
"""
The starting character position of the cited content within the document.
"""
end: "int | None" = None
"""
The ending character position of the cited content within the document.
"""
[docs]class DocumentPageLocation(Boto3Model):
"""
Specifies a page-level location within a document, providing positioning information
for cited content using page numbers.
"""
documentIndex: "int | None" = None
"""
The index of the document within the array of documents provided in the request.
"""
start: "int | None" = None
"""
The starting page number of the cited content within the document.
"""
end: "int | None" = None
"""
The ending page number of the cited content within the document.
"""
[docs]class DocumentChunkLocation(Boto3Model):
"""
Specifies a chunk-level location within a document, providing positioning
information for cited content using logical document segments or chunks.
"""
documentIndex: "int | None" = None
"""
The index of the document within the array of documents provided in the request.
"""
start: "int | None" = None
"""
The starting chunk identifier or index of the cited content within the document.
"""
end: "int | None" = None
"""
The ending chunk identifier or index of the cited content within the document.
"""
[docs]class SearchResultLocation(Boto3Model):
"""
Specifies a search result location within the content array, providing positioning
information for cited content using search result index and block positions.
"""
searchResultIndex: "int | None" = None
"""
The index of the search result content block where the cited content is found.
"""
start: "int | None" = None
"""
The starting position in the content array where the cited content begins.
"""
end: "int | None" = None
"""
The ending position in the content array where the cited content ends.
"""
[docs]class CitationLocation(Boto3Model):
"""
Specifies the precise location within a source document where cited content can be
found.
This can include character- level positions, page numbers, or document chunks
depending on the document type and indexing method.
"""
web: "WebLocation | None" = None
"""
The web URL that was cited for this reference.
"""
documentChar: "DocumentCharLocation | None" = None
"""
The character-level location within the document where the cited content is found.
"""
documentPage: "DocumentPageLocation | None" = None
"""
The page-level location within the document where the cited content is found.
"""
documentChunk: "DocumentChunkLocation | None" = None
"""
The chunk-level location within the document where the cited content is found,
typically used for documents that have been segmented into logical chunks.
"""
searchResultLocation: "SearchResultLocation | None" = None
"""
The search result location where the cited content is found, including the search
result index and block positions within the content array.
"""
[docs]class Citation(Boto3Model):
"""
Contains information about a citation that references a specific source document.
Citations provide traceability between the model's generated response and the source
documents that informed that response.
"""
title: "str | None" = None
"""
The title or identifier of the source document being cited.
"""
source: "str | None" = None
"""
The source from the original search result that provided the cited content.
"""
sourceContent: "builtins.list[CitationSourceContent] | None" = Field(
default_factory=list
)
"""
The specific content from the source document that was referenced or cited in the
generated response.
"""
location: "CitationLocation | None" = None
"""
The precise location within the source document where the cited content can be
found, including character positions, page numbers, or chunk identifiers.
"""
[docs]class CitationsContentBlock(Boto3Model):
"""
A content block that contains both generated text and associated citation
information.
This block type is returned when document citations are enabled, providing
traceability between the generated content and the source documents that informed
the response.
"""
content: "builtins.list[CitationGeneratedContent] | None" = Field(
default_factory=list
)
"""
The generated content that is supported by the associated citations.
"""
citations: "builtins.list[Citation] | None" = Field(default_factory=list)
"""
An array of citations that reference the source documents used to generate the
associated content.
"""
[docs]class ContentBlock(Boto3Model):
"""A block of content for a message that you pass to, or receive from, a model with the
`Converse <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html>`_ or
`ConverseStream <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html>`_ API
operations.
"""
text: "str | None" = None
"""
Text to include in the message.
"""
image: "ImageBlock | None" = None
"""
Image to include in the message.
"""
document: "DocumentBlock | None" = None
"""
A document to include in the message.
"""
video: "VideoBlock | None" = None
"""
Video to include in the message.
"""
audio: "AudioBlock | None" = None
"""
An audio content block containing audio data in the conversation.
"""
toolUse: "ToolUseBlock | None" = None
"""
Information about a tool use request from a model.
"""
toolResult: "ToolResultBlock | None" = None
"""
The result for a tool request that a model makes.
"""
guardContent: "GuardrailConverseContentBlock | None" = None
"""
Contains the content to assess with the guardrail.
If you don't specify ``guardContent`` in a call to the Converse API,
the guardrail (if passed in the Converse API) assesses the entire message.
"""
cachePoint: "CachePointBlock | None" = None
"""
CachePoint to include in the message.
"""
reasoningContent: "ReasoningContentBlock | None" = None
"""
Contains content regarding the reasoning that is carried out by the model.
Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the
accuracy of its final response.
"""
citationsContent: "CitationsContentBlock | None" = None
"""
A content block that contains both generated text and associated citation
information, providing traceability between the response and source documents.
"""
searchResult: "SearchResultBlock | None" = None
"""
Search result to include in the message.
"""
[docs]class BedrockMessage(Boto3Model):
"""A message input, or returned from, a call to
`Converse <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html>`_ or
`ConverseStream <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html>`_.
"""
role: Literal["user", "assistant"]
"""
The role that the message plays in the message.
"""
content: "builtins.list[ContentBlock]"
"""
The message content.
Note the following restrictions:
"""
[docs]class ConverseOutput(Boto3Model):
"""The output from a call to `Converse <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html>`_."""
message: "BedrockMessage | None" = None
"""
The message that the model generates.
"""
[docs]class CacheDetail(Boto3Model):
"""
Cache creation metrics for a specific TTL duration.
"""
ttl: Literal["5m", "1h"]
"""
TTL duration for these cached tokens.
"""
inputTokens: int
"""
Number of tokens written to cache with this TTL (cache creation tokens)
"""
[docs]class TokenUsage(Boto3Model):
"""
The tokens used in a message API inference call.
"""
inputTokens: int
"""
The number of tokens sent in the request to the model.
"""
outputTokens: int
"""
The number of tokens that the model generated for the request.
"""
totalTokens: int
"""
The total of input tokens and tokens generated by the model.
"""
cacheReadInputTokens: "int | None" = None
"""
The number of input tokens read from the cache for the request.
"""
cacheWriteInputTokens: "int | None" = None
"""
The number of input tokens written to the cache for the request.
"""
cacheDetails: "builtins.list[CacheDetail] | None" = Field(default_factory=list)
"""
Detailed breakdown of cache writes by TTL.
Empty if no cache creation occurred. Sorted by TTL duration (1h before 5m).
"""
[docs]class ConverseMetrics(Boto3Model):
"""Metrics for a call to `Converse <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html>`_."""
latencyMs: int
"""
The latency of the call to ``Converse``, in milliseconds.
"""
[docs]class GuardrailTopic(Boto3Model):
"""
Information about a topic guardrail.
"""
name: str
"""
The name for the guardrail.
"""
type: Literal["DENY"]
"""
The type behavior that the guardrail should perform when the model detects the
topic.
"""
action: Literal["BLOCKED", "NONE"]
"""
The action the guardrail should take when it intervenes on a topic.
"""
detected: "bool | None" = None
"""
Indicates whether topic content that breaches the guardrail configuration is
detected.
"""
[docs]class GuardrailTopicPolicyAssessment(Boto3Model):
"""
A behavior assessment of a topic policy.
"""
topics: "builtins.list[GuardrailTopic]"
"""
The topics in the assessment.
"""
[docs]class GuardrailContentFilter(Boto3Model):
"""
The content filter for a guardrail.
"""
type: Literal[
"INSULTS", "HATE", "SEXUAL", "VIOLENCE", "MISCONDUCT", "PROMPT_ATTACK"
]
"""
The guardrail type.
"""
confidence: Literal["NONE", "LOW", "MEDIUM", "HIGH"]
"""
The guardrail confidence.
"""
filterStrength: "Literal['NONE', 'LOW', 'MEDIUM', 'HIGH'] | None" = None
"""
The filter strength setting for the guardrail content filter.
"""
action: Literal["BLOCKED", "NONE"]
"""
The guardrail action.
"""
detected: "bool | None" = None
"""
Indicates whether content that breaches the guardrail configuration is detected.
"""
[docs]class GuardrailContentPolicyAssessment(Boto3Model):
"""
An assessment of a content policy for a guardrail.
"""
filters: "builtins.list[GuardrailContentFilter]"
"""
The content policy filters.
"""
[docs]class GuardrailCustomWord(Boto3Model):
"""
A custom word configured in a guardrail.
"""
match: str
"""
The match for the custom word.
"""
action: Literal["BLOCKED", "NONE"]
"""
The action for the custom word.
"""
detected: "bool | None" = None
"""
Indicates whether custom word content that breaches the guardrail configuration is
detected.
"""
[docs]class GuardrailManagedWord(Boto3Model):
"""
A managed word configured in a guardrail.
"""
match: str
"""
The match for the managed word.
"""
type: Literal["PROFANITY"]
"""
The type for the managed word.
"""
action: Literal["BLOCKED", "NONE"]
"""
The action for the managed word.
"""
detected: "bool | None" = None
"""
Indicates whether managed word content that breaches the guardrail configuration is
detected.
"""
[docs]class GuardrailWordPolicyAssessment(Boto3Model):
"""
The word policy assessment.
"""
customWords: "builtins.list[GuardrailCustomWord]"
"""
Custom words in the assessment.
"""
managedWordLists: "builtins.list[GuardrailManagedWord]"
"""
Managed word lists in the assessment.
"""
[docs]class GuardrailPiiEntityFilter(Boto3Model):
"""
A Personally Identifiable Information (PII) entity configured in a guardrail.
"""
match: str
"""
The PII entity filter match.
"""
type: Literal[
"ADDRESS",
"AGE",
"AWS_ACCESS_KEY",
"AWS_SECRET_KEY",
"CA_HEALTH_NUMBER",
"CA_SOCIAL_INSURANCE_NUMBER",
"CREDIT_DEBIT_CARD_CVV",
"CREDIT_DEBIT_CARD_EXPIRY",
"CREDIT_DEBIT_CARD_NUMBER",
"DRIVER_ID",
"EMAIL",
"INTERNATIONAL_BANK_ACCOUNT_NUMBER",
"IP_ADDRESS",
"LICENSE_PLATE",
"MAC_ADDRESS",
"NAME",
"PASSWORD",
"PHONE",
"PIN",
"SWIFT_CODE",
"UK_NATIONAL_HEALTH_SERVICE_NUMBER",
"UK_NATIONAL_INSURANCE_NUMBER",
"UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",
"URL",
"USERNAME",
"US_BANK_ACCOUNT_NUMBER",
"US_BANK_ROUTING_NUMBER",
"US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
"US_PASSPORT_NUMBER",
"US_SOCIAL_SECURITY_NUMBER",
"VEHICLE_IDENTIFICATION_NUMBER",
]
"""
The PII entity filter type.
"""
action: Literal["ANONYMIZED", "BLOCKED", "NONE"]
"""
The PII entity filter action.
"""
detected: "bool | None" = None
"""
Indicates whether personally identifiable information (PII) that breaches the
guardrail configuration is detected.
"""
[docs]class GuardrailRegexFilter(Boto3Model):
"""
A Regex filter configured in a guardrail.
"""
name: "str | None" = None
"""
The regex filter name.
"""
match: "str | None" = None
"""
The regesx filter match.
"""
regex: "str | None" = None
"""
The regex query.
"""
action: Literal["ANONYMIZED", "BLOCKED", "NONE"]
"""
The region filter action.
"""
detected: "bool | None" = None
"""
Indicates whether custom regex entities that breach the guardrail configuration are
detected.
"""
[docs]class GuardrailContextualGroundingFilter(Boto3Model):
"""
The details for the guardrails contextual grounding filter.
"""
type: Literal["GROUNDING", "RELEVANCE"]
"""
The contextual grounding filter type.
"""
threshold: float
"""
The threshold used by contextual grounding filter to determine whether the content
is grounded or not.
"""
score: float
"""
The score generated by contextual grounding filter.
"""
action: Literal["BLOCKED", "NONE"]
"""
The action performed by the guardrails contextual grounding filter.
"""
detected: "bool | None" = None
"""
Indicates whether content that fails the contextual grounding evaluation (grounding
or relevance score less than the corresponding threshold) was detected.
"""
[docs]class GuardrailContextualGroundingPolicyAssessment(Boto3Model):
"""
The policy assessment details for the guardrails contextual grounding filter.
"""
filters: "builtins.list[GuardrailContextualGroundingFilter] | None" = Field(
default_factory=list
)
"""
The filter details for the guardrails contextual grounding filter.
"""
[docs]class GuardrailAutomatedReasoningStatement(Boto3Model):
"""
A logical statement that includes both formal logic representation and natural
language explanation.
"""
logic: "str | None" = None
"""
The formal logical representation of the statement.
"""
naturalLanguage: "str | None" = None
"""
The natural language explanation of the logical statement.
"""
[docs]class GuardrailAutomatedReasoningInputTextReference(Boto3Model):
"""
References a portion of the original input text that corresponds to logical
elements.
"""
text: "str | None" = None
"""
The specific text from the original input that this reference points to.
"""
[docs]class GuardrailAutomatedReasoningTranslation(Boto3Model):
"""
Contains the logical translation of natural language input into formal logical
statements, including premises, claims, and confidence scores.
"""
premises: "builtins.list[GuardrailAutomatedReasoningStatement] | None" = Field(
default_factory=list
)
"""
The logical statements that serve as the foundation or assumptions for the claims.
"""
claims: "builtins.list[GuardrailAutomatedReasoningStatement] | None" = Field(
default_factory=list
)
"""
The logical statements that are being validated against the premises and policy
rules.
"""
untranslatedPremises: "builtins.list[GuardrailAutomatedReasoningInputTextReference] | None" = Field(
default_factory=list
)
"""
References to portions of the original input text that correspond to the premises
but could not be fully translated.
"""
untranslatedClaims: "builtins.list[GuardrailAutomatedReasoningInputTextReference] | None" = Field(
default_factory=list
)
"""
References to portions of the original input text that correspond to the claims but
could not be fully translated.
"""
confidence: "float | None" = None
"""
A confidence score between 0 and 1 indicating how certain the system is about the
logical translation.
"""
[docs]class GuardrailAutomatedReasoningScenario(Boto3Model):
"""
Represents a logical scenario where claims can be evaluated as true or false,
containing specific logical assignments.
"""
statements: "builtins.list[GuardrailAutomatedReasoningStatement] | None" = Field(
default_factory=list
)
"""
List of logical assignments and statements that define this scenario.
"""
[docs]class GuardrailAutomatedReasoningRule(Boto3Model):
"""
References a specific automated reasoning policy rule that was applied during
evaluation.
"""
identifier: "str | None" = None
"""
The unique identifier of the automated reasoning rule.
"""
policyVersionArn: "str | None" = None
"""
The ARN of the automated reasoning policy version that contains this rule.
"""
[docs]class GuardrailAutomatedReasoningLogicWarning(Boto3Model):
"""
Identifies logical issues in the translated statements that exist independent of any
policy rules, such as statements that are always true or always false.
"""
type: "Literal['ALWAYS_FALSE', 'ALWAYS_TRUE'] | None" = None
"""
The category of the detected logical issue, such as statements that are always true
or always false.
"""
premises: "builtins.list[GuardrailAutomatedReasoningStatement] | None" = Field(
default_factory=list
)
"""
The logical statements that serve as premises under which the claims are validated.
"""
claims: "builtins.list[GuardrailAutomatedReasoningStatement] | None" = Field(
default_factory=list
)
"""
The logical statements that are validated while assuming the policy and premises.
"""
[docs]class GuardrailAutomatedReasoningValidFinding(Boto3Model):
"""
Indicates that the claims are definitively true and logically implied by the
premises, with no possible alternative interpretations.
"""
translation: "GuardrailAutomatedReasoningTranslation | None" = None
"""
The logical translation of the input that this finding validates.
"""
claimsTrueScenario: "GuardrailAutomatedReasoningScenario | None" = None
"""
An example scenario demonstrating how the claims are logically true.
"""
supportingRules: "builtins.list[GuardrailAutomatedReasoningRule] | None" = Field(
default_factory=list
)
"""
The automated reasoning policy rules that support why this result is considered
valid.
"""
logicWarning: "GuardrailAutomatedReasoningLogicWarning | None" = None
"""
Indication of a logic issue with the translation without needing to consider the
automated reasoning policy rules.
"""
[docs]class GuardrailAutomatedReasoningInvalidFinding(Boto3Model):
"""
Indicates that the claims are logically false and contradictory to the established
rules or premises.
"""
translation: "GuardrailAutomatedReasoningTranslation | None" = None
"""
The logical translation of the input that this finding invalidates.
"""
contradictingRules: "builtins.list[GuardrailAutomatedReasoningRule] | None" = Field(
default_factory=list
)
"""
The automated reasoning policy rules that contradict the claims in the input.
"""
logicWarning: "GuardrailAutomatedReasoningLogicWarning | None" = None
"""
Indication of a logic issue with the translation without needing to consider the
automated reasoning policy rules.
"""
[docs]class GuardrailAutomatedReasoningSatisfiableFinding(Boto3Model):
"""
Indicates that the claims could be either true or false depending on additional
assumptions not provided in the input.
"""
translation: "GuardrailAutomatedReasoningTranslation | None" = None
"""
The logical translation of the input that this finding evaluates.
"""
claimsTrueScenario: "GuardrailAutomatedReasoningScenario | None" = None
"""
An example scenario demonstrating how the claims could be logically true.
"""
claimsFalseScenario: "GuardrailAutomatedReasoningScenario | None" = None
"""
An example scenario demonstrating how the claims could be logically false.
"""
logicWarning: "GuardrailAutomatedReasoningLogicWarning | None" = None
"""
Indication of a logic issue with the translation without needing to consider the
automated reasoning policy rules.
"""
[docs]class GuardrailAutomatedReasoningImpossibleFinding(Boto3Model):
"""
Indicates that no valid claims can be made due to logical contradictions in the
premises or rules.
"""
translation: "GuardrailAutomatedReasoningTranslation | None" = None
"""
The logical translation of the input that this finding evaluates.
"""
contradictingRules: "builtins.list[GuardrailAutomatedReasoningRule] | None" = Field(
default_factory=list
)
"""
The automated reasoning policy rules that contradict the claims and/or premises in
the input.
"""
logicWarning: "GuardrailAutomatedReasoningLogicWarning | None" = None
"""
Indication of a logic issue with the translation without needing to consider the
automated reasoning policy rules.
"""
[docs]class GuardrailAutomatedReasoningTranslationOption(Boto3Model):
"""
Represents one possible logical interpretation of ambiguous input content.
"""
translations: "builtins.list[GuardrailAutomatedReasoningTranslation] | None" = (
Field(default_factory=list)
)
"""
Example translations that provide this possible interpretation of the input.
"""
[docs]class GuardrailAutomatedReasoningTranslationAmbiguousFinding(Boto3Model):
"""
Indicates that the input has multiple valid logical interpretations, requiring
additional context or clarification.
"""
options: "builtins.list[GuardrailAutomatedReasoningTranslationOption] | None" = (
Field(default_factory=list)
)
"""
Different logical interpretations that were detected during translation of the
input.
"""
differenceScenarios: "builtins.list[GuardrailAutomatedReasoningScenario] | None" = (
Field(default_factory=list)
)
"""
Scenarios showing how the different translation options differ in meaning.
"""
[docs]class GuardrailAutomatedReasoningTooComplexFinding(Boto3Model):
"""
Indicates that the input exceeds the processing capacity due to the volume or
complexity of the logical information.
"""
[docs]class GuardrailAutomatedReasoningNoTranslationsFinding(Boto3Model):
"""
Indicates that no relevant logical information could be extracted from the input for
validation.
"""
[docs]class GuardrailAutomatedReasoningFinding(Boto3Model):
"""
Represents a logical validation result from automated reasoning policy evaluation.
The finding indicates whether claims in the input are logically valid, invalid,
satisfiable, impossible, or have other logical issues.
"""
valid: "GuardrailAutomatedReasoningValidFinding | None" = None
"""
Contains the result when the automated reasoning evaluation determines that the
claims in the input are logically valid and definitively true based on the provided
premises and policy rules.
"""
invalid: "GuardrailAutomatedReasoningInvalidFinding | None" = None
"""
Contains the result when the automated reasoning evaluation determines that the
claims in the input are logically invalid and contradict the established premises or
policy rules.
"""
satisfiable: "GuardrailAutomatedReasoningSatisfiableFinding | None" = None
"""
Contains the result when the automated reasoning evaluation determines that the
claims in the input could be either true or false depending on additional
assumptions not provided in the input context.
"""
impossible: "GuardrailAutomatedReasoningImpossibleFinding | None" = None
"""
Contains the result when the automated reasoning evaluation determines that no valid
logical conclusions can be drawn due to contradictions in the premises or policy
rules themselves.
"""
translationAmbiguous: "GuardrailAutomatedReasoningTranslationAmbiguousFinding | None" = None
"""
Contains the result when the automated reasoning evaluation detects that the input
has multiple valid logical interpretations, requiring additional context or
clarification to proceed with validation.
"""
tooComplex: "GuardrailAutomatedReasoningTooComplexFinding | None" = None
"""
Contains the result when the automated reasoning evaluation cannot process the input
due to its complexity or volume exceeding the system's processing capacity for
logical analysis.
"""
noTranslations: "GuardrailAutomatedReasoningNoTranslationsFinding | None" = None
"""
Contains the result when the automated reasoning evaluation cannot extract any
relevant logical information from the input that can be validated against the policy
rules.
"""
[docs]class GuardrailAutomatedReasoningPolicyAssessment(Boto3Model):
"""
Contains the results of automated reasoning policy evaluation, including logical
findings about the validity of claims made in the input content.
"""
findings: "builtins.list[GuardrailAutomatedReasoningFinding] | None" = Field(
default_factory=list
)
"""
List of logical validation results produced by evaluating the input content against
automated reasoning policies.
"""
[docs]class GuardrailUsage(Boto3Model):
"""
The details on the use of the guardrail.
"""
topicPolicyUnits: int
"""
The topic policy units processed by the guardrail.
"""
contentPolicyUnits: int
"""
The content policy units processed by the guardrail.
"""
wordPolicyUnits: int
"""
The word policy units processed by the guardrail.
"""
sensitiveInformationPolicyUnits: int
"""
The sensitive information policy units processed by the guardrail.
"""
sensitiveInformationPolicyFreeUnits: int
"""
The sensitive information policy free units processed by the guardrail.
"""
contextualGroundingPolicyUnits: int
"""
The contextual grounding policy units processed by the guardrail.
"""
contentPolicyImageUnits: "int | None" = None
"""
The content policy image units processed by the guardrail.
"""
automatedReasoningPolicyUnits: "int | None" = None
"""
The number of text units processed by the automated reasoning policy.
"""
automatedReasoningPolicies: "int | None" = None
"""
The number of automated reasoning policies that were processed during the guardrail
evaluation.
"""
[docs]class GuardrailTextCharactersCoverage(Boto3Model):
"""
The guardrail coverage for the text characters.
"""
guarded: "int | None" = None
"""
The text characters that were guarded by the guardrail coverage.
"""
total: "int | None" = None
"""
The total text characters by the guardrail coverage.
"""
[docs]class GuardrailImageCoverage(Boto3Model):
"""
The details of the guardrail image coverage.
"""
guarded: "int | None" = None
"""
The count (integer) of images guardrails guarded.
"""
total: "int | None" = None
"""
Represents the total number of images (integer) that were in the request (guarded
and unguarded).
"""
[docs]class GuardrailCoverage(Boto3Model):
"""
The action of the guardrail coverage details.
"""
textCharacters: "GuardrailTextCharactersCoverage | None" = None
"""
The text characters of the guardrail coverage details.
"""
images: "GuardrailImageCoverage | None" = None
"""
The guardrail coverage for images (the number of images that guardrails guarded).
"""
[docs]class GuardrailInvocationMetrics(Boto3Model):
"""
The invocation metrics for the guardrail.
"""
guardrailProcessingLatency: "int | None" = None
"""
The processing latency details for the guardrail invocation metrics.
"""
usage: "GuardrailUsage | None" = None
"""
The usage details for the guardrail invocation metrics.
"""
guardrailCoverage: "GuardrailCoverage | None" = None
"""
The coverage details for the guardrail invocation metrics.
"""
[docs]class AppliedGuardrailDetails(Boto3Model):
"""
Details about the specific guardrail that was applied during this assessment,
including its identifier, version, ARN, origin, and ownership information.
"""
guardrailId: "str | None" = None
"""
The unique ID of the guardrail that was applied.
"""
guardrailVersion: "str | None" = None
"""
The version of the guardrail that was applied.
"""
guardrailArn: "str | None" = None
"""
The ARN of the guardrail that was applied.
"""
guardrailOrigin: "builtins.list[Literal['REQUEST', 'ACCOUNT_ENFORCED', 'ORGANIZATION_ENFORCED']] | None" = Field(
default_factory=list
)
"""
The origin of how the guardrail was applied.
This can be either requested at the API level or enforced at the account or
organization level as a default guardrail.
"""
guardrailOwnership: "Literal['SELF', 'CROSS_ACCOUNT'] | None" = None
"""
The ownership type of the guardrail, indicating whether it is owned by the
requesting account or is a cross-account guardrail shared from another AWS account.
"""
[docs]class GuardrailAssessment(Boto3Model):
"""
A behavior assessment of the guardrail policies used in a call to the Converse API.
"""
topicPolicy: "GuardrailTopicPolicyAssessment | None" = None
"""
The topic policy.
"""
contentPolicy: "GuardrailContentPolicyAssessment | None" = None
"""
The content policy.
"""
wordPolicy: "GuardrailWordPolicyAssessment | None" = None
"""
The word policy.
"""
sensitiveInformationPolicy: "GuardrailSensitiveInformationPolicyAssessment | None" = None
"""
The sensitive information policy.
"""
contextualGroundingPolicy: "GuardrailContextualGroundingPolicyAssessment | None" = (
None
)
"""
The contextual grounding policy used for the guardrail assessment.
"""
automatedReasoningPolicy: "GuardrailAutomatedReasoningPolicyAssessment | None" = (
None
)
"""
The automated reasoning policy assessment results, including logical validation
findings for the input content.
"""
invocationMetrics: "GuardrailInvocationMetrics | None" = None
"""
The invocation metrics for the guardrail assessment.
"""
appliedGuardrailDetails: "AppliedGuardrailDetails | None" = None
"""
Details about the specific guardrail that was applied during this assessment,
including its identifier, version, ARN, origin, and ownership information.
"""
[docs]class GuardrailTraceAssessment(Boto3Model):
"""
A Top level guardrail trace object.
For more information, see
`ConverseTrace <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseTrace.html>`_.
"""
modelOutput: "builtins.list[str] | None" = Field(default_factory=list)
"""
The output from the model.
"""
inputAssessment: "dict[str, GuardrailAssessment] | None" = Field(
default_factory=dict
)
"""
The input assessment.
"""
outputAssessments: "dict[str, builtins.list[GuardrailAssessment]] | None" = Field(
default_factory=dict
)
"""
The output assessments.
"""
actionReason: "str | None" = None
"""
Provides the reason for the action taken when harmful content is detected.
"""
[docs]class PromptRouterTrace(Boto3Model):
"""
A prompt router trace.
"""
invokedModelId: "str | None" = None
"""
The ID of the invoked model.
"""
[docs]class ConverseTrace(Boto3Model):
"""The trace object in a response from
`Converse <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html>`_.
"""
guardrail: "GuardrailTraceAssessment | None" = None
"""
The guardrail trace object.
"""
promptRouter: "PromptRouterTrace | None" = None
"""
The request's prompt router.
"""
[docs]class ServiceTier(Boto3Model):
"""
Specifies the processing tier configuration used for serving the request.
"""
type: Literal["priority", "default", "flex", "reserved"]
"""
Specifies the processing tier type used for serving the request.
"""
[docs]class Conversation(ReadonlyPrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = ConversationManager
output: ConverseOutput
"""
The result from the call to ``Converse``.
"""
stopReason: Literal[
"end_turn",
"tool_use",
"max_tokens",
"stop_sequence",
"guardrail_intervened",
"content_filtered",
"malformed_model_output",
"malformed_tool_use",
"model_context_window_exceeded",
]
"""
The reason why the model stopped generating output.
"""
usage: TokenUsage
"""
The total number of tokens used in the call to ``Converse``.
The total includes the tokens input to the model and the tokens generated by the
model.
"""
metrics: ConverseMetrics
"""
Metrics for the call to ``Converse``.
"""
additionalModelResponseFields: "Document | None" = None
"""
Additional fields in the response that are unique to the model.
"""
trace: "ConverseTrace | None" = None
"""
A trace object that contains information about the Guardrail behavior.
"""
performanceConfig: "PerformanceConfiguration | None" = None
"""
Model performance settings for the request.
"""
serviceTier: "ServiceTier | None" = None
"""
Specifies the processing tier configuration used for serving the request.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`stopReason` attribute.
Returns:
The primary key of the model instance.
"""
return self.stopReason
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`stopReason` attribute.
"""
return hash(self.stopReason)
[docs]class GuardrailOutputContent(Boto3Model):
"""
The output content produced by the guardrail.
"""
text: "str | None" = None
"""
The specific text for the output content produced by the guardrail.
"""
[docs]class GuardrailApplication(ReadonlyPrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = GuardrailApplicationManager
usage: GuardrailUsage
"""
The usage details in the response from the guardrail.
"""
action: Literal["NONE", "GUARDRAIL_INTERVENED"]
"""
The action taken in the response from the guardrail.
"""
actionReason: "str | None" = None
"""
The reason for the action taken when harmful content is detected.
"""
outputs: "builtins.list[GuardrailOutputContent]"
"""
The output details in the response from the guardrail.
"""
assessments: "builtins.list[GuardrailAssessment]"
"""
The assessment details in the response from the guardrail.
"""
guardrailCoverage: "GuardrailCoverage | None" = None
"""
The guardrail coverage details in the apply guardrail response.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`action` attribute.
Returns:
The primary key of the model instance.
"""
return self.action
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`action` attribute.
"""
return hash(self.action)
[docs]class MessageStartEvent(Boto3Model):
"""
The start of a message.
"""
role: Literal["user", "assistant"]
"""
The role for the message.
"""
[docs]class ImageBlockStart(Boto3Model):
"""
The initial event in a streaming image block that indicates the start of image
content.
"""
format: Literal["png", "jpeg", "gif", "webp"]
"""
The format of the image data that will be streamed in subsequent delta events.
"""
[docs]class ContentBlockStart(Boto3Model):
"""
Content block start information.
"""
toolUse: "ToolUseBlockStart | None" = None
"""
Information about a tool that the model is requesting to use.
"""
toolResult: "ToolResultBlockStart | None" = None
"""
The.
"""
image: "ImageBlockStart | None" = None
"""
The initial event indicating the start of a streaming image block.
"""
[docs]class ContentBlockStartEvent(Boto3Model):
"""
Content block start event.
"""
start: ContentBlockStart
"""
Start information about a content block start event.
"""
contentBlockIndex: int
"""
The index for a content block start event.
"""
[docs]class ReasoningContentBlockDelta(Boto3Model):
"""
Contains content regarding the reasoning that is carried out by the model with
respect to the content in the content block.
Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the
accuracy of its final response.
"""
text: "str | None" = None
"""
The reasoning that the model used to return the output.
"""
redactedContent: "bytes | None" = None
"""
The content in the reasoning that was encrypted by the model provider for safety
reasons.
The encryption doesn't affect the quality of responses.
"""
signature: "str | None" = None
"""
A token that verifies that the reasoning text was generated by the model.
If you pass a reasoning block back to the API in a multi-turn conversation, include
the text and its signature unmodified.
"""
[docs]class CitationSourceContentDelta(Boto3Model):
"""
Contains incremental updates to the source content text during streaming responses,
allowing clients to build up the cited content progressively.
"""
text: "str | None" = None
"""
An incremental update to the text content from the source document that is being
cited.
"""
[docs]class CitationsDelta(Boto3Model):
"""
Contains incremental updates to citation information during streaming responses.
This allows clients to build up citation data progressively as the response is
generated.
"""
title: "str | None" = None
"""
The title or identifier of the source document being cited.
"""
source: "str | None" = None
"""
The source from the original search result that provided the cited content.
"""
sourceContent: "builtins.list[CitationSourceContentDelta] | None" = Field(
default_factory=list
)
"""
The specific content from the source document that was referenced or cited in the
generated response.
"""
location: "CitationLocation | None" = None
"""
Specifies the precise location within a source document where cited content can be
found.
This can include character- level positions, page numbers, or document chunks
depending on the document type and indexing method.
"""
[docs]class ImageBlockDelta(Boto3Model):
"""
A streaming delta event that contains incremental image data during streaming
responses.
"""
source: "ImageSource | None" = None
"""
The incremental image source data for this delta event.
"""
error: "ErrorBlock | None" = None
"""
Error information if this image delta could not be processed.
"""
[docs]class ContentBlockDelta(Boto3Model):
"""
A block of content in a streaming response.
"""
text: "str | None" = None
"""
The content text.
"""
toolUse: "ToolUseBlockDelta | None" = None
"""
Information about a tool that the model is requesting to use.
"""
toolResult: "builtins.list[ToolResultBlockDelta] | None" = Field(
default_factory=list
)
"""
An incremental update that contains the results from a tool call.
"""
reasoningContent: "ReasoningContentBlockDelta | None" = None
"""
Contains content regarding the reasoning that is carried out by the model.
Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the
accuracy of its final response.
"""
citation: "CitationsDelta | None" = None
"""
Incremental citation information that is streamed as part of the response generation
process.
"""
image: "ImageBlockDelta | None" = None
"""
A streaming delta event containing incremental image data.
"""
[docs]class ContentBlockDeltaEvent(Boto3Model):
"""
The content block delta event.
"""
delta: ContentBlockDelta
"""
The delta for a content block delta event.
"""
contentBlockIndex: int
"""
The block index for a content block delta event.
"""
[docs]class ContentBlockStopEvent(Boto3Model):
"""
A content block stop event.
"""
contentBlockIndex: int
"""
The index for a content block.
"""
[docs]class MessageStopEvent(Boto3Model):
"""
The stop event for a message.
"""
stopReason: Literal[
"end_turn",
"tool_use",
"max_tokens",
"stop_sequence",
"guardrail_intervened",
"content_filtered",
"malformed_model_output",
"malformed_tool_use",
"model_context_window_exceeded",
]
"""
The reason why the model stopped generating output.
"""
additionalModelResponseFields: "Document | None" = None
"""
The additional model response fields.
"""
[docs]class ConverseStreamMetrics(Boto3Model):
"""
Metrics for the stream.
"""
latencyMs: int
"""
The latency for the streaming request, in milliseconds.
"""
[docs]class ConverseStreamTrace(Boto3Model):
"""The trace object in a response from
`ConverseStream <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html>`_.
"""
guardrail: "GuardrailTraceAssessment | None" = None
"""
The guardrail trace object.
"""
promptRouter: "PromptRouterTrace | None" = None
"""
The request's prompt router.
"""
[docs]class InternalServerException(Boto3Model):
"""
An internal server error occurred.
For troubleshooting this error, see
`InternalFailure <https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-
failure>`_ in the Amazon Bedrock User Guide
"""
message: "str | None" = None
[docs]class ModelStreamErrorException(Boto3Model):
"""
An error occurred while streaming the response.
Retry your request.
"""
message: "str | None" = None
originalStatusCode: "int | None" = None
"""
The original status code.
"""
originalMessage: "str | None" = None
"""
The original message.
"""
[docs]class ValidationException(Boto3Model):
"""
The input fails to satisfy the constraints specified by *Amazon Bedrock*.
For troubleshooting this error, see
`ValidationError <https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-
validation-error>`_ in the Amazon Bedrock User Guide
"""
message: "str | None" = None
[docs]class ThrottlingException(Boto3Model):
"""
Your request was denied due to exceeding the account quotas for *Amazon Bedrock*.
For troubleshooting this error, see
`ThrottlingException <https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-
throttling-exception>`_ in the Amazon Bedrock User Guide
"""
message: "str | None" = None
[docs]class ServiceUnavailableException(Boto3Model):
"""
The service isn't currently available.
For troubleshooting this error, see
`ServiceUnavailable <https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-
service-unavailable>`_ in the Amazon Bedrock User Guide
"""
message: "str | None" = None
[docs]class ConverseStreamOutput(Boto3Model):
"""
The messages output stream.
"""
messageStart: "MessageStartEvent | None" = None
"""
Message start information.
"""
contentBlockStart: "ContentBlockStartEvent | None" = None
"""
Start information for a content block.
"""
contentBlockDelta: "ContentBlockDeltaEvent | None" = None
"""
The messages output content block delta.
"""
contentBlockStop: "ContentBlockStopEvent | None" = None
"""
Stop information for a content block.
"""
messageStop: "MessageStopEvent | None" = None
"""
Message stop information.
"""
metadata: "ConverseStreamMetadataEvent | None" = None
"""
Metadata for the converse output stream.
"""
internalServerException: "InternalServerException | None" = None
"""
An internal server error occurred.
Retry your request.
"""
modelStreamErrorException: "ModelStreamErrorException | None" = None
"""
A streaming error occurred.
Retry your request.
"""
validationException: "ValidationException | None" = None
"""
The input fails to satisfy the constraints specified by *Amazon Bedrock*.
For troubleshooting this error, see
`ValidationError <https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-
validation-error>`_ in the Amazon Bedrock User Guide.
"""
throttlingException: "ThrottlingException | None" = None
"""
Your request was denied due to exceeding the account quotas for *Amazon Bedrock*.
For troubleshooting this error, see
`ThrottlingException <https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-
throttling-exception>`_ in the Amazon Bedrock User Guide.
"""
serviceUnavailableException: "ServiceUnavailableException | None" = None
"""
The service isn't currently available.
For troubleshooting this error, see
`ServiceUnavailable <https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-
service-unavailable>`_ in the Amazon Bedrock User Guide
"""
[docs]class PayloadPart(Boto3Model):
"""
Payload content included in the response.
"""
data: bytes = Field(default=None, alias="bytes")
"""
Base64-encoded bytes of payload data.
"""
[docs]class ModelTimeoutException(Boto3Model):
"""
The request took too long to process.
Processing time exceeded the model timeout length.
"""
message: "str | None" = None
[docs]class ResponseStream(Boto3Model):
"""
Definition of content in the response stream.
"""
chunk: "PayloadPart | None" = None
"""
Content included in the response.
"""
internalServerException: "InternalServerException | None" = None
"""
An internal server error occurred.
Retry your request.
"""
modelStreamErrorException: "ModelStreamErrorException | None" = None
"""
An error occurred while streaming the response.
Retry your request.
"""
validationException: "ValidationException | None" = None
"""
Input validation failed.
Check your request parameters and retry the request.
"""
throttlingException: "ThrottlingException | None" = None
"""
Your request was throttled because of service-wide limitations.
Resubmit your request later or in a different region. You can also purchase
`Provisioned Throughput <https://docs.aws.amazon.com/bedrock/latest/userguide/prov-
throughput.html>`_ to increase the rate or number of tokens you can process.
"""
modelTimeoutException: "ModelTimeoutException | None" = None
"""
The request took too long to process.
Processing time exceeded the model timeout length.
"""
serviceUnavailableException: "ServiceUnavailableException | None" = None
"""
The service isn't available.
Try again later.
"""
# =======================
# Request/Response Models
# =======================
[docs]class SystemContentBlock(Boto3Model):
"""
Contains configurations for instructions to provide the model for how to handle
input.
To learn more, see
`Using the Converse API <https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-call.html>`_.
"""
text: "str | None" = None
"""
A system prompt for the model.
"""
guardContent: "GuardrailConverseContentBlock | None" = None
"""
A content block to assess with the guardrail.
Use with the
`Converse <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html>`_
or
`ConverseStream <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html>`_
API
operations.
"""
cachePoint: "CachePointBlock | None" = None
"""
CachePoint to include in the system prompt.
"""
[docs]class InferenceConfiguration(Boto3Model):
"""Base inference parameters to pass to a model in a call to
`Converse <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html>`_ or
`ConverseStream <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html>`_. For more
information, see `Inference parameters for foundation
models <https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html>`_.
If you need to pass additional parameters that the model supports, use the ``additionalModelRequestFields`` request
field in the call to ``Converse`` or ``ConverseStream``. For more information, see `Model
parameters <https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html>`_.
"""
maxTokens: "int | None" = None
"""
The maximum number of tokens to allow in the generated response.
The default value is the maximum allowed value for the model that you are using. For
more information, see
`Inference parameters for foundation models <https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html>`_.
"""
temperature: "float | None" = None
"""
The likelihood of the model selecting higher-probability options while generating a
response.
A lower value makes the model more likely to choose higher-probability options,
while a higher value makes the model more likely to choose lower-probability
options.
"""
topP: "float | None" = None
"""
The percentage of most-likely candidates that the model considers for the next
token.
For example, if you choose a value
of 0.8 for ``topP``, the model selects from the top 80% of the probability distribution of tokens that could be next in
the sequence.
"""
stopSequences: "builtins.list[str] | None" = Field(default_factory=list)
"""
A list of stop sequences.
A stop sequence is a sequence of characters that causes the model to stop generating
the response.
"""
[docs]class GuardrailConfiguration(Boto3Model):
"""Configuration information for a guardrail that you use with the
`Converse <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html>`_ operation.
"""
guardrailIdentifier: "str | None" = None
"""
The identifier for the guardrail.
"""
guardrailVersion: "str | None" = None
"""
The version of the guardrail.
"""
trace: "Literal['enabled', 'disabled', 'enabled_full'] | None" = None
"""
The trace behavior for the guardrail.
"""
[docs]class PromptVariableValues(Boto3Model):
"""
Contains a map of variables in a prompt from Prompt management to an object
containing the values to fill in for them when running model invocation.
For more information, see
`How Prompt management works <https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-how.html>`_.
"""
text: "str | None" = None
"""
The text value that the variable maps to.
"""
[docs]class JsonSchemaDefinition(Boto3Model):
"""
JSON schema structured output format options.
"""
schemaDefinition: str = Field(default=None, alias="schema")
"""
The JSON schema to constrain the model's output.
For more information, see `JSON Schema Reference <https://json-
schema.org/understanding-json-schema/reference>`_.
"""
name: "str | None" = None
"""
The name of the JSON schema.
"""
description: "str | None" = None
"""
A description of the JSON schema.
"""
[docs]class OutputConfig(Boto3Model):
"""Output configuration for a model response in a call to
`Converse <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html>`_ or
`ConverseStream <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html>`_.
"""
textFormat: "OutputFormat | None" = None
"""
Structured output parameters to control the model's text response.
"""
[docs]class GuardrailStreamConfiguration(Boto3Model):
"""Configuration information for a guardrail that you use with the
`ConverseStream <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html>`_ action.
"""
guardrailIdentifier: "str | None" = None
"""
The identifier for the guardrail.
"""
guardrailVersion: "str | None" = None
"""
The version of the guardrail.
"""
trace: "Literal['enabled', 'disabled', 'enabled_full'] | None" = None
"""
The trace behavior for the guardrail.
"""
streamProcessingMode: "Literal['sync', 'async'] | None" = None
"""
The processing mode.
"""
[docs]class ConverseStreamResponse(ConverseStreamResponseMixin, Boto3Model):
stream: "ConverseStream | None" = None
"""
The output stream that the model generated.
"""
[docs]class InvokeModelTokensRequest(Boto3Model):
"""
The body of an ``InvokeModel`` API request for token counting.
This structure mirrors the input format for the
``InvokeModel`` operation, allowing you to count tokens for raw text inference requests.
"""
body: bytes
"""
The request body to count tokens for, formatted according to the model's expected
input format.
To learn about the input format for different models, see
`Model inference parameters and responses <https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html>`_.
"""
[docs]class ConverseTokensRequest(Boto3Model):
"""
The inputs from a ``Converse`` API request for token counting.
This structure mirrors the input format for the ``Converse`` operation, allowing you to count tokens for conversation-
based inference requests.
"""
messages: "builtins.list[BedrockMessage] | None" = Field(default_factory=list)
"""
An array of messages to count tokens for.
"""
system: "builtins.list[SystemContentBlock] | None" = Field(default_factory=list)
"""
The system content blocks to count tokens for.
System content provides instructions or context to the model about how it should
behave or respond. The token count will include any system content provided.
"""
toolConfig: "ToolConfiguration | None" = None
"""
The toolConfig of Converse input request to count tokens for.
Configuration information for the tools that the model can use when generating a
response.
"""
additionalModelRequestFields: "Document | None" = None
"""
The additionalModelRequestFields of Converse input request to count tokens for.
Use this field when you want to pass additional parameters that the model supports.
"""
[docs]class TokenCount(Boto3Model):
inputTokens: int
"""
The number of tokens in the provided input according to the specified model's
tokenization rules.
This count represents the number of input tokens that would be processed if the same
input were sent to the model in an inference request. Use this value to estimate
costs and ensure your inputs stay within model token limits.
"""
[docs]class InvokeModelResponse(Boto3Model):
body: bytes
"""
Inference response from the model in the format specified in the ``contentType``
header.
To see the format and content of the request and response bodies for different
models, refer to
`Inference parameters <https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html>`_.
"""
contentType: str
"""
The MIME type of the inference result.
"""
performanceConfigLatency: "Literal['standard', 'optimized'] | None" = None
"""
Model performance settings for the request.
"""
serviceTier: "Literal['priority', 'default', 'flex', 'reserved'] | None" = None
"""
Specifies the processing tier type used for serving the request.
"""
[docs]class InvokeModelWithResponseStreamResponse(
InvokeModelWithResponseStreamResponseMixin, Boto3Model
):
body: "InvokeModelResponseStream | None" = None
"""
Inference response from the model in the format specified by the ``contentType``
header.
To see the format and content of this field for different models, refer to
`Inference parameters <https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html>`_.
"""
contentType: str
"""
The MIME type of the inference result.
"""
performanceConfigLatency: "Literal['standard', 'optimized'] | None" = None
"""
Model performance settings for the request.
"""
serviceTier: "Literal['priority', 'default', 'flex', 'reserved'] | None" = None
"""
Specifies the processing tier type used for serving the request.
"""
[docs]class AsyncInvokeS3OutputDataConfig(Boto3Model):
"""
Asynchronous invocation output data settings.
"""
s3Uri: str
"""
An object URI starting with ``s3://``.
"""
kmsKeyId: "str | None" = None
"""
A KMS encryption key ID.
"""
bucketOwner: "str | None" = None
"""
If the bucket belongs to another AWS account, specify that account's ID.
"""
[docs]class AsyncInvokeOutputDataConfig(Boto3Model):
"""
Asynchronous invocation output data settings.
"""
s3OutputDataConfig: "AsyncInvokeS3OutputDataConfig | None" = None
"""
A storage location for the output data in an S3 bucket.
"""
[docs]class StartAsyncInvokeResponse(Boto3Model):
invocationArn: str
"""
The ARN of the invocation.
"""
[docs]class GetAsyncInvokeResponse(Boto3Model):
invocationArn: str
"""
The invocation's ARN.
"""
modelArn: str
"""
The invocation's model ARN.
"""
clientRequestToken: "str | None" = None
"""
The invocation's idempotency token.
"""
status: Literal["InProgress", "Completed", "Failed"]
"""
The invocation's status.
"""
failureMessage: "str | None" = None
"""
An error message.
"""
submitTime: datetime
"""
When the invocation request was submitted.
"""
lastModifiedTime: "datetime | None" = None
"""
The invocation's last modified time.
"""
endTime: "datetime | None" = None
"""
When the invocation ended.
"""
outputDataConfig: AsyncInvokeOutputDataConfig
"""
Output data settings.
"""
[docs]class AsyncInvokeSummary(Boto3Model):
"""
A summary of an asynchronous invocation.
"""
invocationArn: str
"""
The invocation's ARN.
"""
modelArn: str
"""
The invoked model's ARN.
"""
clientRequestToken: "str | None" = None
"""
The invocation's idempotency token.
"""
status: "Literal['InProgress', 'Completed', 'Failed'] | None" = None
"""
The invocation's status.
"""
failureMessage: "str | None" = None
"""
An error message.
"""
submitTime: datetime
"""
When the invocation was submitted.
"""
lastModifiedTime: "datetime | None" = None
"""
When the invocation was last modified.
"""
endTime: "datetime | None" = None
"""
When the invocation ended.
"""
outputDataConfig: AsyncInvokeOutputDataConfig
"""
The invocation's output data settings.
"""
[docs]class ListAsyncInvokesResponse(Boto3Model):
nextToken: "str | None" = None
"""
Specify the pagination token from a previous request to retrieve the next page of
results.
"""
asyncInvokeSummaries: "builtins.list[AsyncInvokeSummary] | None" = Field(
default_factory=list
)
"""
A list of invocation summaries.
"""
[docs]class GuardrailTextBlock(Boto3Model):
"""
The text block to be evaluated by the guardrail.
"""
text: str
"""
The input text details to be evaluated by the guardrail.
"""
qualifiers: "builtins.list[Literal['grounding_source', 'query', 'guard_content']] | None" = Field(
default_factory=list
)
"""
The qualifiers describing the text block.
"""
[docs]class GuardrailImageSource(Boto3Model):
"""
The image source (image bytes) of the guardrail image source.
Object used in independent api.
"""
data: bytes = Field(default=None, alias="bytes")
"""
The bytes details of the guardrail image source.
Object used in independent api.
"""
[docs]class GuardrailImageBlock(Boto3Model):
"""
Contain an image which user wants guarded.
This block is accepted by the guardrails independent API.
"""
format: Literal["png", "jpeg"]
"""
The format details for the file type of the image blocked by the guardrail.
"""
source: GuardrailImageSource
"""
The image source (image bytes) details of the image blocked by the guardrail.
"""
[docs]class GuardrailContentBlock(Boto3Model):
"""
The content block to be evaluated by the guardrail.
"""
text: "GuardrailTextBlock | None" = None
"""
Text within content block to be evaluated by the guardrail.
"""
image: "GuardrailImageBlock | None" = None
"""
Image within guardrail content block to be evaluated by the guardrail.
"""