BedrockRuntime ************** Client ====== class BedrockRuntime.Client A low-level client representing Amazon Bedrock Runtime Describes the API operations for running inference using Amazon Bedrock models. import boto3 client = boto3.client('bedrock-runtime') These are the available methods: * apply_guardrail * can_paginate * close * converse * converse_stream * get_async_invoke * get_paginator * get_waiter * invoke_model * invoke_model_with_response_stream * list_async_invokes * start_async_invoke Paginators ========== Paginators are available on a client instance via the "get_paginator" method. For more detailed instructions and examples on the usage of paginators, see the paginators user guide. The available paginators are: * ListAsyncInvokes BedrockRuntime / Paginator / ListAsyncInvokes ListAsyncInvokes **************** class BedrockRuntime.Paginator.ListAsyncInvokes paginator = client.get_paginator('list_async_invokes') paginate(**kwargs) Creates an iterator that will paginate through responses from "BedrockRuntime.Client.list_async_invokes()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( submitTimeAfter=datetime(2015, 1, 1), submitTimeBefore=datetime(2015, 1, 1), statusEquals='InProgress'|'Completed'|'Failed', sortBy='SubmissionTime', sortOrder='Ascending'|'Descending', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) Parameters: * **submitTimeAfter** (*datetime*) -- Include invocations submitted after this time. * **submitTimeBefore** (*datetime*) -- Include invocations submitted before this time. * **statusEquals** (*string*) -- Filter invocations by status. * **sortBy** (*string*) -- How to sort the response. * **sortOrder** (*string*) -- The sorting order for the response. * **PaginationConfig** (*dict*) -- A dictionary that provides parameters to control pagination. * **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a "NextToken" will be provided in the output that you can use to resume pagination. * **PageSize** *(integer) --* The size of each page. * **StartingToken** *(string) --* A token to specify where to start paginating. This is the "NextToken" from a previous response. Return type: dict Returns: **Response Syntax** { 'asyncInvokeSummaries': [ { 'invocationArn': 'string', 'modelArn': 'string', 'clientRequestToken': 'string', 'status': 'InProgress'|'Completed'|'Failed', 'failureMessage': 'string', 'submitTime': datetime(2015, 1, 1), 'lastModifiedTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'outputDataConfig': { 's3OutputDataConfig': { 's3Uri': 'string', 'kmsKeyId': 'string', 'bucketOwner': 'string' } } }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **asyncInvokeSummaries** *(list) --* A list of invocation summaries. * *(dict) --* A summary of an asynchronous invocation. * **invocationArn** *(string) --* The invocation's ARN. * **modelArn** *(string) --* The invoked model's ARN. * **clientRequestToken** *(string) --* The invocation's idempotency token. * **status** *(string) --* The invocation's status. * **failureMessage** *(string) --* An error message. * **submitTime** *(datetime) --* When the invocation was submitted. * **lastModifiedTime** *(datetime) --* When the invocation was last modified. * **endTime** *(datetime) --* When the invocation ended. * **outputDataConfig** *(dict) --* The invocation's output data settings. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "s3OutputDataConfig". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **s3OutputDataConfig** *(dict) --* A storage location for the output data in an S3 bucket * **s3Uri** *(string) --* An object URI starting with "s3://". * **kmsKeyId** *(string) --* A KMS encryption key ID. * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **NextToken** *(string) --* A token to resume pagination. BedrockRuntime / Client / get_paginator get_paginator ************* BedrockRuntime.Client.get_paginator(operation_name) Create a paginator for an operation. Parameters: **operation_name** (*string*) -- The operation name. This is the same name as the method name on the client. For example, if the method name is "create_foo", and you'd normally invoke the operation as "client.create_foo(**kwargs)", if the "create_foo" operation can be paginated, you can use the call "client.get_paginator("create_foo")". Raises: **OperationNotPageableError** -- Raised if the operation is not pageable. You can use the "client.can_paginate" method to check if an operation is pageable. Return type: "botocore.paginate.Paginator" Returns: A paginator object. BedrockRuntime / Client / can_paginate can_paginate ************ BedrockRuntime.Client.can_paginate(operation_name) Check if an operation can be paginated. Parameters: **operation_name** (*string*) -- The operation name. This is the same name as the method name on the client. For example, if the method name is "create_foo", and you'd normally invoke the operation as "client.create_foo(**kwargs)", if the "create_foo" operation can be paginated, you can use the call "client.get_paginator("create_foo")". Returns: "True" if the operation can be paginated, "False" otherwise. BedrockRuntime / Client / converse converse ******** BedrockRuntime.Client.converse(**kwargs) 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. Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response. You can submit a prompt by including it in the "messages" field, specifying the "modelId" of a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case. You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the "promptVariables" field. You can append more messages to the prompt by using the "messages" field. If you use a prompt from Prompt management, you can't include the following fields in the request: "additionalModelRequestFields", "inferenceConfig", "system", or "toolConfig". Instead, these fields must be defined through Prompt management. For more information, see Use a prompt from Prompt management. For information about the Converse API, see *Use the Converse API* in the *Amazon Bedrock User Guide*. To use a guardrail, see *Use a guardrail with the Converse API* in the *Amazon Bedrock User Guide*. To use a tool with a model, see *Tool use (Function calling)* in the *Amazon Bedrock User Guide* For example code, see *Converse API examples* in the *Amazon Bedrock User Guide*. This operation requires permission for the "bedrock:InvokeModel" action. Warning: To deny all inference access to resources that you specify in the modelId field, you need to deny access to the "bedrock:InvokeModel" and "bedrock:InvokeModelWithResponseStream" actions. Doing this also denies access to the resource through the base inference actions ( InvokeModel and InvokeModelWithResponseStream). For more information see Deny access for inference on specific models. For troubleshooting some of the common errors you might encounter when using the "Converse" API, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide See also: AWS API Documentation **Request Syntax** response = client.converse( modelId='string', messages=[ { 'role': 'user'|'assistant', 'content': [ { 'text': 'string', 'image': { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } }, 'document': { 'format': 'pdf'|'csv'|'doc'|'docx'|'xls'|'xlsx'|'html'|'txt'|'md', 'name': 'string', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' }, 'text': 'string', 'content': [ { 'text': 'string' }, ] }, 'context': 'string', 'citations': { 'enabled': True|False } }, 'video': { 'format': 'mkv'|'mov'|'mp4'|'webm'|'flv'|'mpeg'|'mpg'|'wmv'|'three_gp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } }, 'toolUse': { 'toolUseId': 'string', 'name': 'string', 'input': {...}|[...]|123|123.4|'string'|True|None }, 'toolResult': { 'toolUseId': 'string', 'content': [ { 'json': {...}|[...]|123|123.4|'string'|True|None, 'text': 'string', 'image': { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } }, 'document': { 'format': 'pdf'|'csv'|'doc'|'docx'|'xls'|'xlsx'|'html'|'txt'|'md', 'name': 'string', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' }, 'text': 'string', 'content': [ { 'text': 'string' }, ] }, 'context': 'string', 'citations': { 'enabled': True|False } }, 'video': { 'format': 'mkv'|'mov'|'mp4'|'webm'|'flv'|'mpeg'|'mpg'|'wmv'|'three_gp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } } }, ], 'status': 'success'|'error' }, 'guardContent': { 'text': { 'text': 'string', 'qualifiers': [ 'grounding_source'|'query'|'guard_content', ] }, 'image': { 'format': 'png'|'jpeg', 'source': { 'bytes': b'bytes' } } }, 'cachePoint': { 'type': 'default' }, 'reasoningContent': { 'reasoningText': { 'text': 'string', 'signature': 'string' }, 'redactedContent': b'bytes' }, 'citationsContent': { 'content': [ { 'text': 'string' }, ], 'citations': [ { 'title': 'string', 'sourceContent': [ { 'text': 'string' }, ], 'location': { 'documentChar': { 'documentIndex': 123, 'start': 123, 'end': 123 }, 'documentPage': { 'documentIndex': 123, 'start': 123, 'end': 123 }, 'documentChunk': { 'documentIndex': 123, 'start': 123, 'end': 123 } } }, ] } }, ] }, ], system=[ { 'text': 'string', 'guardContent': { 'text': { 'text': 'string', 'qualifiers': [ 'grounding_source'|'query'|'guard_content', ] }, 'image': { 'format': 'png'|'jpeg', 'source': { 'bytes': b'bytes' } } }, 'cachePoint': { 'type': 'default' } }, ], inferenceConfig={ 'maxTokens': 123, 'temperature': ..., 'topP': ..., 'stopSequences': [ 'string', ] }, toolConfig={ 'tools': [ { 'toolSpec': { 'name': 'string', 'description': 'string', 'inputSchema': { 'json': {...}|[...]|123|123.4|'string'|True|None } }, 'cachePoint': { 'type': 'default' } }, ], 'toolChoice': { 'auto': {} , 'any': {} , 'tool': { 'name': 'string' } } }, guardrailConfig={ 'guardrailIdentifier': 'string', 'guardrailVersion': 'string', 'trace': 'enabled'|'disabled'|'enabled_full' }, additionalModelRequestFields={...}|[...]|123|123.4|'string'|True|None, promptVariables={ 'string': { 'text': 'string' } }, additionalModelResponseFieldPaths=[ 'string', ], requestMetadata={ 'string': 'string' }, performanceConfig={ 'latency': 'standard'|'optimized' } ) Parameters: * **modelId** (*string*) -- **[REQUIRED]** 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: * If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see Amazon Bedrock base model IDs (on-demand throughput) in the Amazon Bedrock User Guide. * If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see Supported Regions and models for cross-region inference in the Amazon Bedrock User Guide. * If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see Run inference using a Provisioned Throughput in the Amazon Bedrock User Guide. * If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see Use a custom model in Amazon Bedrock in the Amazon Bedrock User Guide. * To include a prompt that was defined in Prompt management, specify the ARN of the prompt version to use. The Converse API doesn't support imported models. * **messages** (*list*) -- The messages that you want to send to the model. * *(dict) --* A message input, or returned from, a call to Converse or ConverseStream. * **role** *(string) --* **[REQUIRED]** The role that the message plays in the message. * **content** *(list) --* **[REQUIRED]** The message content. Note the following restrictions: * You can include up to 20 images. Each image's size, height, and width must be no more than 3.75 MB, 8000 px, and 8000 px, respectively. * You can include up to five documents. Each document's size must be no more than 4.5 MB. * If you include a "ContentBlock" with a "document" field in the array, you must also include a "ContentBlock" with a "text" field. * You can only include images and documents if the "role" is "user". * *(dict) --* A block of content for a message that you pass to, or receive from, a model with the Converse or ConverseStream API operations. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text", "image", "document", "video", "toolUse", "toolResult", "guardContent", "cachePoint", "reasoningContent", "citationsContent". * **text** *(string) --* Text to include in the message. * **image** *(dict) --* Image to include in the message. Note: This field is only supported by Anthropic Claude 3 models. * **format** *(string) --* **[REQUIRED]** The format of the image. * **source** *(dict) --* **[REQUIRED]** The source for the image. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location". * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **document** *(dict) --* A document to include in the message. * **format** *(string) --* The format of a document, or its extension. * **name** *(string) --* **[REQUIRED]** A name for the document. The name can only contain the following characters: * Alphanumeric characters * Whitespace characters (no more than one in a row) * Hyphens * Parentheses * Square brackets Note: This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name. * **source** *(dict) --* **[REQUIRED]** Contains the content of the document. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location", "text", "content". * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **text** *(string) --* The text content of the document source. * **content** *(list) --* The structured content of the document source, which may include various content blocks such as text, images, or other document elements. * *(dict) --* Contains the actual content of a document that can be processed by the model and potentially cited in the response. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The text content of the document. * **context** *(string) --* Contextual information about how the document should be processed or interpreted by the model when generating citations. * **citations** *(dict) --* Configuration settings that control how citations should be generated for this specific document. * **enabled** *(boolean) --* **[REQUIRED]** Specifies whether document citations should be included in the model's response. When set to true, the model can generate citations that reference the source documents used to inform the response. * **video** *(dict) --* Video to include in the message. * **format** *(string) --* **[REQUIRED]** The block's format. * **source** *(dict) --* **[REQUIRED]** The block's source. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location". * **bytes** *(bytes) --* Video content encoded in base64. * **s3Location** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **toolUse** *(dict) --* Information about a tool use request from a model. * **toolUseId** *(string) --* **[REQUIRED]** The ID for the tool request. * **name** *(string) --* **[REQUIRED]** The name of the tool that the model wants to use. * **input** (*document*) -- **[REQUIRED]** The input to pass to the tool. * **toolResult** *(dict) --* The result for a tool request that a model makes. * **toolUseId** *(string) --* **[REQUIRED]** The ID of the tool request that this is the result for. * **content** *(list) --* **[REQUIRED]** The content for tool result content block. * *(dict) --* The tool result content block. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "json", "text", "image", "document", "video". * **json** (*document*) -- A tool result that is JSON format data. * **text** *(string) --* A tool result that is text. * **image** *(dict) --* A tool result that is an image. Note: This field is only supported by Anthropic Claude 3 models. * **format** *(string) --* **[REQUIRED]** The format of the image. * **source** *(dict) --* **[REQUIRED]** The source for the image. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location". * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **document** *(dict) --* A tool result that is a document. * **format** *(string) --* The format of a document, or its extension. * **name** *(string) --* **[REQUIRED]** A name for the document. The name can only contain the following characters: * Alphanumeric characters * Whitespace characters (no more than one in a row) * Hyphens * Parentheses * Square brackets Note: This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name. * **source** *(dict) --* **[REQUIRED]** Contains the content of the document. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location", "text", "content". * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **text** *(string) --* The text content of the document source. * **content** *(list) --* The structured content of the document source, which may include various content blocks such as text, images, or other document elements. * *(dict) --* Contains the actual content of a document that can be processed by the model and potentially cited in the response. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The text content of the document. * **context** *(string) --* Contextual information about how the document should be processed or interpreted by the model when generating citations. * **citations** *(dict) --* Configuration settings that control how citations should be generated for this specific document. * **enabled** *(boolean) --* **[REQUIRED]** Specifies whether document citations should be included in the model's response. When set to true, the model can generate citations that reference the source documents used to inform the response. * **video** *(dict) --* A tool result that is video. * **format** *(string) --* **[REQUIRED]** The block's format. * **source** *(dict) --* **[REQUIRED]** The block's source. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location". * **bytes** *(bytes) --* Video content encoded in base64. * **s3Location** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **status** *(string) --* The status for the tool result content block. Note: This field is only supported Anthropic Claude 3 models. * **guardContent** *(dict) --* 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. For more information, see *Use a guardrail with the Converse API* in the *Amazon Bedrock User Guide*. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text", "image". * **text** *(dict) --* The text to guard. * **text** *(string) --* **[REQUIRED]** The text that you want to guard. * **qualifiers** *(list) --* The qualifier details for the guardrails contextual grounding filter. * *(string) --* * **image** *(dict) --* Image within converse content block to be evaluated by the guardrail. * **format** *(string) --* **[REQUIRED]** The format details for the image type of the guardrail converse image block. * **source** *(dict) --* **[REQUIRED]** The image source (image bytes) of the guardrail converse image block. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes". * **bytes** *(bytes) --* The raw image bytes for the image. * **cachePoint** *(dict) --* CachePoint to include in the message. * **type** *(string) --* **[REQUIRED]** Specifies the type of cache point within the CachePointBlock. * **reasoningContent** *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "reasoningText", "redactedContent". * **reasoningText** *(dict) --* The reasoning that the model used to return the output. * **text** *(string) --* **[REQUIRED]** The reasoning that the model used to return the output. * **signature** *(string) --* 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. * **redactedContent** *(bytes) --* The content in the reasoning that was encrypted by the model provider for safety reasons. The encryption doesn't affect the quality of responses. * **citationsContent** *(dict) --* A content block that contains both generated text and associated citation information, providing traceability between the response and source documents. * **content** *(list) --* The generated content that is supported by the associated citations. * *(dict) --* Contains the generated text content that corresponds to or is supported by a citation from a source document. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The text content that was generated by the model and is supported by the associated citation. * **citations** *(list) --* An array of citations that reference the source documents used to generate the associated content. * *(dict) --* 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** *(string) --* The title or identifier of the source document being cited. * **sourceContent** *(list) --* The specific content from the source document that was referenced or cited in the generated response. * *(dict) --* Contains the actual text content from a source document that is being cited or referenced in the model's response. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The text content from the source document that is being cited. * **location** *(dict) --* The precise location within the source document where the cited content can be found, including character positions, page numbers, or chunk identifiers. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "documentChar", "documentPage", "documentChunk". * **documentChar** *(dict) --* The character-level location within the document where the cited content is found. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting character position of the cited content within the document. * **end** *(integer) --* The ending character position of the cited content within the document. * **documentPage** *(dict) --* The page-level location within the document where the cited content is found. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting page number of the cited content within the document. * **end** *(integer) --* The ending page number of the cited content within the document. * **documentChunk** *(dict) --* The chunk-level location within the document where the cited content is found, typically used for documents that have been segmented into logical chunks. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting chunk identifier or index of the cited content within the document. * **end** *(integer) --* The ending chunk identifier or index of the cited content within the document. * **system** (*list*) -- 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. * *(dict) --* A system content block. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text", "guardContent", "cachePoint". * **text** *(string) --* A system prompt for the model. * **guardContent** *(dict) --* A content block to assess with the guardrail. Use with the Converse or ConverseStream API operations. For more information, see *Use a guardrail with the Converse API* in the *Amazon Bedrock User Guide*. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text", "image". * **text** *(dict) --* The text to guard. * **text** *(string) --* **[REQUIRED]** The text that you want to guard. * **qualifiers** *(list) --* The qualifier details for the guardrails contextual grounding filter. * *(string) --* * **image** *(dict) --* Image within converse content block to be evaluated by the guardrail. * **format** *(string) --* **[REQUIRED]** The format details for the image type of the guardrail converse image block. * **source** *(dict) --* **[REQUIRED]** The image source (image bytes) of the guardrail converse image block. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes". * **bytes** *(bytes) --* The raw image bytes for the image. * **cachePoint** *(dict) --* CachePoint to include in the system prompt. * **type** *(string) --* **[REQUIRED]** Specifies the type of cache point within the CachePointBlock. * **inferenceConfig** (*dict*) -- 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. * **maxTokens** *(integer) --* 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. * **temperature** *(float) --* 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. The default value is the default value for the model that you are using. For more information, see Inference parameters for foundation models. * **topP** *(float) --* 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. The default value is the default value for the model that you are using. For more information, see Inference parameters for foundation models. * **stopSequences** *(list) --* A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response. * *(string) --* * **toolConfig** (*dict*) -- Configuration information for the tools that the model can use when generating a response. For information about models that support tool use, see Supported models and model features. * **tools** *(list) --* **[REQUIRED]** An array of tools that you want to pass to a model. * *(dict) --* Information about a tool that you can use with the Converse API. For more information, see Tool use (function calling) in the Amazon Bedrock User Guide. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "toolSpec", "cachePoint". * **toolSpec** *(dict) --* The specfication for the tool. * **name** *(string) --* **[REQUIRED]** The name for the tool. * **description** *(string) --* The description for the tool. * **inputSchema** *(dict) --* **[REQUIRED]** The input schema for the tool in JSON format. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "json". * **json** (*document*) -- The JSON schema for the tool. For more information, see JSON Schema Reference. * **cachePoint** *(dict) --* CachePoint to include in the tool configuration. * **type** *(string) --* **[REQUIRED]** Specifies the type of cache point within the CachePointBlock. * **toolChoice** *(dict) --* If supported by model, forces the model to request a tool. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "auto", "any", "tool". * **auto** *(dict) --* (Default). The Model automatically decides if a tool should be called or whether to generate text instead. * **any** *(dict) --* The model must request at least one tool (no text is generated). * **tool** *(dict) --* The Model must request the specified tool. Only supported by Anthropic Claude 3 models. * **name** *(string) --* **[REQUIRED]** The name of the tool that the model must request. * **guardrailConfig** (*dict*) -- 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. * **guardrailIdentifier** *(string) --* **[REQUIRED]** The identifier for the guardrail. * **guardrailVersion** *(string) --* **[REQUIRED]** The version of the guardrail. * **trace** *(string) --* The trace behavior for the guardrail. * **additionalModelRequestFields** (*document*) -- 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. * **promptVariables** (*dict*) -- 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. * *(string) --* * *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The text value that the variable maps to. * **additionalModelResponseFieldPaths** (*list*) -- 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". "[ "/stop_sequence" ]" For information about the JSON Pointer syntax, see the Internet Engineering Task Force (IETF) documentation. "Converse" and "ConverseStream" reject an empty JSON Pointer or incorrectly structured JSON Pointer with a "400" error code. if the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by "Converse". * *(string) --* * **requestMetadata** (*dict*) -- Key-value pairs that you can use to filter invocation logs. * *(string) --* * *(string) --* * **performanceConfig** (*dict*) -- Model performance settings for the request. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". Return type: dict Returns: **Response Syntax** { 'output': { 'message': { 'role': 'user'|'assistant', 'content': [ { 'text': 'string', 'image': { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } }, 'document': { 'format': 'pdf'|'csv'|'doc'|'docx'|'xls'|'xlsx'|'html'|'txt'|'md', 'name': 'string', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' }, 'text': 'string', 'content': [ { 'text': 'string' }, ] }, 'context': 'string', 'citations': { 'enabled': True|False } }, 'video': { 'format': 'mkv'|'mov'|'mp4'|'webm'|'flv'|'mpeg'|'mpg'|'wmv'|'three_gp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } }, 'toolUse': { 'toolUseId': 'string', 'name': 'string', 'input': {...}|[...]|123|123.4|'string'|True|None }, 'toolResult': { 'toolUseId': 'string', 'content': [ { 'json': {...}|[...]|123|123.4|'string'|True|None, 'text': 'string', 'image': { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } }, 'document': { 'format': 'pdf'|'csv'|'doc'|'docx'|'xls'|'xlsx'|'html'|'txt'|'md', 'name': 'string', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' }, 'text': 'string', 'content': [ { 'text': 'string' }, ] }, 'context': 'string', 'citations': { 'enabled': True|False } }, 'video': { 'format': 'mkv'|'mov'|'mp4'|'webm'|'flv'|'mpeg'|'mpg'|'wmv'|'three_gp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } } }, ], 'status': 'success'|'error' }, 'guardContent': { 'text': { 'text': 'string', 'qualifiers': [ 'grounding_source'|'query'|'guard_content', ] }, 'image': { 'format': 'png'|'jpeg', 'source': { 'bytes': b'bytes' } } }, 'cachePoint': { 'type': 'default' }, 'reasoningContent': { 'reasoningText': { 'text': 'string', 'signature': 'string' }, 'redactedContent': b'bytes' }, 'citationsContent': { 'content': [ { 'text': 'string' }, ], 'citations': [ { 'title': 'string', 'sourceContent': [ { 'text': 'string' }, ], 'location': { 'documentChar': { 'documentIndex': 123, 'start': 123, 'end': 123 }, 'documentPage': { 'documentIndex': 123, 'start': 123, 'end': 123 }, 'documentChunk': { 'documentIndex': 123, 'start': 123, 'end': 123 } } }, ] } }, ] } }, 'stopReason': 'end_turn'|'tool_use'|'max_tokens'|'stop_sequence'|'guardrail_intervened'|'content_filtered', 'usage': { 'inputTokens': 123, 'outputTokens': 123, 'totalTokens': 123, 'cacheReadInputTokens': 123, 'cacheWriteInputTokens': 123 }, 'metrics': { 'latencyMs': 123 }, 'additionalModelResponseFields': {...}|[...]|123|123.4|'string'|True|None, 'trace': { 'guardrail': { 'modelOutput': [ 'string', ], 'inputAssessment': { 'string': { 'topicPolicy': { 'topics': [ { 'name': 'string', 'type': 'DENY', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'contentPolicy': { 'filters': [ { 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'filterStrength': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'wordPolicy': { 'customWords': [ { 'match': 'string', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ], 'managedWordLists': [ { 'match': 'string', 'type': 'PROFANITY', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'match': 'string', 'type': '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', 'action': 'ANONYMIZED'|'BLOCKED'|'NONE', 'detected': True|False }, ], 'regexes': [ { 'name': 'string', 'match': 'string', 'regex': 'string', 'action': 'ANONYMIZED'|'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'contextualGroundingPolicy': { 'filters': [ { 'type': 'GROUNDING'|'RELEVANCE', 'threshold': 123.0, 'score': 123.0, 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'automatedReasoningPolicy': { 'findings': [ { 'valid': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'claimsTrueScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'supportingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'invalid': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'contradictingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'satisfiable': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'claimsTrueScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'claimsFalseScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'impossible': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'contradictingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'translationAmbiguous': { 'options': [ { 'translations': [ { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, ] }, ], 'differenceScenarios': [ { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, ] }, 'tooComplex': {}, 'noTranslations': {} }, ] }, 'invocationMetrics': { 'guardrailProcessingLatency': 123, 'usage': { 'topicPolicyUnits': 123, 'contentPolicyUnits': 123, 'wordPolicyUnits': 123, 'sensitiveInformationPolicyUnits': 123, 'sensitiveInformationPolicyFreeUnits': 123, 'contextualGroundingPolicyUnits': 123, 'contentPolicyImageUnits': 123, 'automatedReasoningPolicyUnits': 123, 'automatedReasoningPolicies': 123 }, 'guardrailCoverage': { 'textCharacters': { 'guarded': 123, 'total': 123 }, 'images': { 'guarded': 123, 'total': 123 } } } } }, 'outputAssessments': { 'string': [ { 'topicPolicy': { 'topics': [ { 'name': 'string', 'type': 'DENY', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'contentPolicy': { 'filters': [ { 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'filterStrength': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'wordPolicy': { 'customWords': [ { 'match': 'string', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ], 'managedWordLists': [ { 'match': 'string', 'type': 'PROFANITY', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'match': 'string', 'type': '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', 'action': 'ANONYMIZED'|'BLOCKED'|'NONE', 'detected': True|False }, ], 'regexes': [ { 'name': 'string', 'match': 'string', 'regex': 'string', 'action': 'ANONYMIZED'|'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'contextualGroundingPolicy': { 'filters': [ { 'type': 'GROUNDING'|'RELEVANCE', 'threshold': 123.0, 'score': 123.0, 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'automatedReasoningPolicy': { 'findings': [ { 'valid': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'claimsTrueScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'supportingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'invalid': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'contradictingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'satisfiable': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'claimsTrueScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'claimsFalseScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'impossible': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'contradictingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'translationAmbiguous': { 'options': [ { 'translations': [ { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, ] }, ], 'differenceScenarios': [ { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, ] }, 'tooComplex': {}, 'noTranslations': {} }, ] }, 'invocationMetrics': { 'guardrailProcessingLatency': 123, 'usage': { 'topicPolicyUnits': 123, 'contentPolicyUnits': 123, 'wordPolicyUnits': 123, 'sensitiveInformationPolicyUnits': 123, 'sensitiveInformationPolicyFreeUnits': 123, 'contextualGroundingPolicyUnits': 123, 'contentPolicyImageUnits': 123, 'automatedReasoningPolicyUnits': 123, 'automatedReasoningPolicies': 123 }, 'guardrailCoverage': { 'textCharacters': { 'guarded': 123, 'total': 123 }, 'images': { 'guarded': 123, 'total': 123 } } } }, ] }, 'actionReason': 'string' }, 'promptRouter': { 'invokedModelId': 'string' } }, 'performanceConfig': { 'latency': 'standard'|'optimized' } } **Response Structure** * *(dict) --* * **output** *(dict) --* The result from the call to "Converse". Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "message". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **message** *(dict) --* The message that the model generates. * **role** *(string) --* The role that the message plays in the message. * **content** *(list) --* The message content. Note the following restrictions: * You can include up to 20 images. Each image's size, height, and width must be no more than 3.75 MB, 8000 px, and 8000 px, respectively. * You can include up to five documents. Each document's size must be no more than 4.5 MB. * If you include a "ContentBlock" with a "document" field in the array, you must also include a "ContentBlock" with a "text" field. * You can only include images and documents if the "role" is "user". * *(dict) --* A block of content for a message that you pass to, or receive from, a model with the Converse or ConverseStream API operations. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "text", "image", "document", "video", "toolUse", "toolResult", "guardContent", "cachePoint", "reasoningContent", "citationsContent". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **text** *(string) --* Text to include in the message. * **image** *(dict) --* Image to include in the message. Note: This field is only supported by Anthropic Claude 3 models. * **format** *(string) --* The format of the image. * **source** *(dict) --* The source for the image. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "bytes", "s3Location". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **document** *(dict) --* A document to include in the message. * **format** *(string) --* The format of a document, or its extension. * **name** *(string) --* A name for the document. The name can only contain the following characters: * Alphanumeric characters * Whitespace characters (no more than one in a row) * Hyphens * Parentheses * Square brackets Note: This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name. * **source** *(dict) --* Contains the content of the document. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "bytes", "s3Location", "text", "content". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **text** *(string) --* The text content of the document source. * **content** *(list) --* The structured content of the document source, which may include various content blocks such as text, images, or other document elements. * *(dict) --* Contains the actual content of a document that can be processed by the model and potentially cited in the response. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "text". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **text** *(string) --* The text content of the document. * **context** *(string) --* Contextual information about how the document should be processed or interpreted by the model when generating citations. * **citations** *(dict) --* Configuration settings that control how citations should be generated for this specific document. * **enabled** *(boolean) --* Specifies whether document citations should be included in the model's response. When set to true, the model can generate citations that reference the source documents used to inform the response. * **video** *(dict) --* Video to include in the message. * **format** *(string) --* The block's format. * **source** *(dict) --* The block's source. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "bytes", "s3Location". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **bytes** *(bytes) --* Video content encoded in base64. * **s3Location** *(dict) --* 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. * **uri** *(string) --* An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **toolUse** *(dict) --* Information about a tool use request from a model. * **toolUseId** *(string) --* The ID for the tool request. * **name** *(string) --* The name of the tool that the model wants to use. * **input** (*document*) -- The input to pass to the tool. * **toolResult** *(dict) --* The result for a tool request that a model makes. * **toolUseId** *(string) --* The ID of the tool request that this is the result for. * **content** *(list) --* The content for tool result content block. * *(dict) --* The tool result content block. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "json", "text", "image", "document", "video". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **json** (*document*) -- A tool result that is JSON format data. * **text** *(string) --* A tool result that is text. * **image** *(dict) --* A tool result that is an image. Note: This field is only supported by Anthropic Claude 3 models. * **format** *(string) --* The format of the image. * **source** *(dict) --* The source for the image. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "bytes", "s3Location". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **document** *(dict) --* A tool result that is a document. * **format** *(string) --* The format of a document, or its extension. * **name** *(string) --* A name for the document. The name can only contain the following characters: * Alphanumeric characters * Whitespace characters (no more than one in a row) * Hyphens * Parentheses * Square brackets Note: This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name. * **source** *(dict) --* Contains the content of the document. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "bytes", "s3Location", "text", "content". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **text** *(string) --* The text content of the document source. * **content** *(list) --* The structured content of the document source, which may include various content blocks such as text, images, or other document elements. * *(dict) --* Contains the actual content of a document that can be processed by the model and potentially cited in the response. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "text". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **text** *(string) --* The text content of the document. * **context** *(string) --* Contextual information about how the document should be processed or interpreted by the model when generating citations. * **citations** *(dict) --* Configuration settings that control how citations should be generated for this specific document. * **enabled** *(boolean) --* Specifies whether document citations should be included in the model's response. When set to true, the model can generate citations that reference the source documents used to inform the response. * **video** *(dict) --* A tool result that is video. * **format** *(string) --* The block's format. * **source** *(dict) --* The block's source. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "bytes", "s3Location". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **bytes** *(bytes) --* Video content encoded in base64. * **s3Location** *(dict) --* 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. * **uri** *(string) --* An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **status** *(string) --* The status for the tool result content block. Note: This field is only supported Anthropic Claude 3 models. * **guardContent** *(dict) --* 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. For more information, see *Use a guardrail with the Converse API* in the *Amazon Bedrock User Guide*. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "text", "image". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **text** *(dict) --* The text to guard. * **text** *(string) --* The text that you want to guard. * **qualifiers** *(list) --* The qualifier details for the guardrails contextual grounding filter. * *(string) --* * **image** *(dict) --* Image within converse content block to be evaluated by the guardrail. * **format** *(string) --* The format details for the image type of the guardrail converse image block. * **source** *(dict) --* The image source (image bytes) of the guardrail converse image block. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "bytes". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **bytes** *(bytes) --* The raw image bytes for the image. * **cachePoint** *(dict) --* CachePoint to include in the message. * **type** *(string) --* Specifies the type of cache point within the CachePointBlock. * **reasoningContent** *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "reasoningText", "redactedContent". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **reasoningText** *(dict) --* The reasoning that the model used to return the output. * **text** *(string) --* The reasoning that the model used to return the output. * **signature** *(string) --* 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. * **redactedContent** *(bytes) --* The content in the reasoning that was encrypted by the model provider for safety reasons. The encryption doesn't affect the quality of responses. * **citationsContent** *(dict) --* A content block that contains both generated text and associated citation information, providing traceability between the response and source documents. * **content** *(list) --* The generated content that is supported by the associated citations. * *(dict) --* Contains the generated text content that corresponds to or is supported by a citation from a source document. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "text". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **text** *(string) --* The text content that was generated by the model and is supported by the associated citation. * **citations** *(list) --* An array of citations that reference the source documents used to generate the associated content. * *(dict) --* 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** *(string) --* The title or identifier of the source document being cited. * **sourceContent** *(list) --* The specific content from the source document that was referenced or cited in the generated response. * *(dict) --* Contains the actual text content from a source document that is being cited or referenced in the model's response. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "text". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **text** *(string) --* The text content from the source document that is being cited. * **location** *(dict) --* The precise location within the source document where the cited content can be found, including character positions, page numbers, or chunk identifiers. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "documentChar", "documentPage", "documentChunk". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **documentChar** *(dict) --* The character-level location within the document where the cited content is found. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting character position of the cited content within the document. * **end** *(integer) --* The ending character position of the cited content within the document. * **documentPage** *(dict) --* The page-level location within the document where the cited content is found. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting page number of the cited content within the document. * **end** *(integer) --* The ending page number of the cited content within the document. * **documentChunk** *(dict) --* The chunk-level location within the document where the cited content is found, typically used for documents that have been segmented into logical chunks. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting chunk identifier or index of the cited content within the document. * **end** *(integer) --* The ending chunk identifier or index of the cited content within the document. * **stopReason** *(string) --* The reason why the model stopped generating output. * **usage** *(dict) --* 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. * **inputTokens** *(integer) --* The number of tokens sent in the request to the model. * **outputTokens** *(integer) --* The number of tokens that the model generated for the request. * **totalTokens** *(integer) --* The total of input tokens and tokens generated by the model. * **cacheReadInputTokens** *(integer) --* The number of input tokens read from the cache for the request. * **cacheWriteInputTokens** *(integer) --* The number of input tokens written to the cache for the request. * **metrics** *(dict) --* Metrics for the call to "Converse". * **latencyMs** *(integer) --* The latency of the call to "Converse", in milliseconds. * **additionalModelResponseFields** (*document*) -- Additional fields in the response that are unique to the model. * **trace** *(dict) --* A trace object that contains information about the Guardrail behavior. * **guardrail** *(dict) --* The guardrail trace object. * **modelOutput** *(list) --* The output from the model. * *(string) --* * **inputAssessment** *(dict) --* The input assessment. * *(string) --* * *(dict) --* A behavior assessment of the guardrail policies used in a call to the Converse API. * **topicPolicy** *(dict) --* The topic policy. * **topics** *(list) --* The topics in the assessment. * *(dict) --* Information about a topic guardrail. * **name** *(string) --* The name for the guardrail. * **type** *(string) --* The type behavior that the guardrail should perform when the model detects the topic. * **action** *(string) --* The action the guardrail should take when it intervenes on a topic. * **detected** *(boolean) --* Indicates whether topic content that breaches the guardrail configuration is detected. * **contentPolicy** *(dict) --* The content policy. * **filters** *(list) --* The content policy filters. * *(dict) --* The content filter for a guardrail. * **type** *(string) --* The guardrail type. * **confidence** *(string) --* The guardrail confidence. * **filterStrength** *(string) --* The filter strength setting for the guardrail content filter. * **action** *(string) --* The guardrail action. * **detected** *(boolean) --* Indicates whether content that breaches the guardrail configuration is detected. * **wordPolicy** *(dict) --* The word policy. * **customWords** *(list) --* Custom words in the assessment. * *(dict) --* A custom word configured in a guardrail. * **match** *(string) --* The match for the custom word. * **action** *(string) --* The action for the custom word. * **detected** *(boolean) --* Indicates whether custom word content that breaches the guardrail configuration is detected. * **managedWordLists** *(list) --* Managed word lists in the assessment. * *(dict) --* A managed word configured in a guardrail. * **match** *(string) --* The match for the managed word. * **type** *(string) --* The type for the managed word. * **action** *(string) --* The action for the managed word. * **detected** *(boolean) --* Indicates whether managed word content that breaches the guardrail configuration is detected. * **sensitiveInformationPolicy** *(dict) --* The sensitive information policy. * **piiEntities** *(list) --* The PII entities in the assessment. * *(dict) --* A Personally Identifiable Information (PII) entity configured in a guardrail. * **match** *(string) --* The PII entity filter match. * **type** *(string) --* The PII entity filter type. * **action** *(string) --* The PII entity filter action. * **detected** *(boolean) --* Indicates whether personally identifiable information (PII) that breaches the guardrail configuration is detected. * **regexes** *(list) --* The regex queries in the assessment. * *(dict) --* A Regex filter configured in a guardrail. * **name** *(string) --* The regex filter name. * **match** *(string) --* The regesx filter match. * **regex** *(string) --* The regex query. * **action** *(string) --* The region filter action. * **detected** *(boolean) --* Indicates whether custom regex entities that breach the guardrail configuration are detected. * **contextualGroundingPolicy** *(dict) --* The contextual grounding policy used for the guardrail assessment. * **filters** *(list) --* The filter details for the guardrails contextual grounding filter. * *(dict) --* The details for the guardrails contextual grounding filter. * **type** *(string) --* 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** *(string) --* The action performed by the guardrails contextual grounding filter. * **detected** *(boolean) --* Indicates whether content that fails the contextual grounding evaluation (grounding or relevance score less than the corresponding threshold) was detected. * **automatedReasoningPolicy** *(dict) --* The automated reasoning policy assessment results, including logical validation findings for the input content. * **findings** *(list) --* List of logical validation results produced by evaluating the input content against automated reasoning policies. * *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "valid", "invalid", "satisfiable", "impossible", "translationAmbiguous", "tooComplex", "noTranslations". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **valid** *(dict) --* Indicates that the claims are definitively true and logically implied by the premises, with no possible alternative interpretations. * **translation** *(dict) --* The logical translation of the input that this finding validates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **claimsTrueScenario** *(dict) --* An example scenario demonstrating how the claims are logically true. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **supportingRules** *(list) --* The automated reasoning policy rules that support why this result is considered valid. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **invalid** *(dict) --* Indicates that the claims are logically false and contradictory to the established rules or premises. * **translation** *(dict) --* The logical translation of the input that this finding invalidates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **contradictingRules** *(list) --* The automated reasoning policy rules that contradict the claims in the input. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **satisfiable** *(dict) --* Indicates that the claims could be either true or false depending on additional assumptions not provided in the input. * **translation** *(dict) --* The logical translation of the input that this finding evaluates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **claimsTrueScenario** *(dict) --* An example scenario demonstrating how the claims could be logically true. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claimsFalseScenario** *(dict) --* An example scenario demonstrating how the claims could be logically false. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **impossible** *(dict) --* Indicates that no valid claims can be made due to logical contradictions in the premises or rules. * **translation** *(dict) --* The logical translation of the input that this finding evaluates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **contradictingRules** *(list) --* The automated reasoning policy rules that contradict the claims and/or premises in the input. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **translationAmbiguous** *(dict) --* Indicates that the input has multiple valid logical interpretations, requiring additional context or clarification. * **options** *(list) --* Different logical interpretations that were detected during translation of the input. * *(dict) --* Represents one possible logical interpretation of ambiguous input content. * **translations** *(list) --* Example translations that provide this possible interpretation of the input. * *(dict) --* Contains the logical translation of natural language input into formal logical statements, including premises, claims, and confidence scores. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **differenceScenarios** *(list) --* Scenarios showing how the different translation options differ in meaning. * *(dict) --* Represents a logical scenario where claims can be evaluated as true or false, containing specific logical assignments. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **tooComplex** *(dict) --* Indicates that the input exceeds the processing capacity due to the volume or complexity of the logical information. * **noTranslations** *(dict) --* Indicates that no relevant logical information could be extracted from the input for validation. * **invocationMetrics** *(dict) --* The invocation metrics for the guardrail assessment. * **guardrailProcessingLatency** *(integer) --* The processing latency details for the guardrail invocation metrics. * **usage** *(dict) --* The usage details for the guardrail invocation metrics. * **topicPolicyUnits** *(integer) --* The topic policy units processed by the guardrail. * **contentPolicyUnits** *(integer) --* The content policy units processed by the guardrail. * **wordPolicyUnits** *(integer) --* The word policy units processed by the guardrail. * **sensitiveInformationPolicyUnits** *(integer) --* The sensitive information policy units processed by the guardrail. * **sensitiveInformationPolicyFreeUnits** *(integer) --* The sensitive information policy free units processed by the guardrail. * **contextualGroundingPolicyUnits** *(integer) --* The contextual grounding policy units processed by the guardrail. * **contentPolicyImageUnits** *(integer) --* The content policy image units processed by the guardrail. * **automatedReasoningPolicyUnits** *(integer) --* The number of text units processed by the automated reasoning policy. * **automatedReasoningPolicies** *(integer) --* The number of automated reasoning policies that were processed during the guardrail evaluation. * **guardrailCoverage** *(dict) --* The coverage details for the guardrail invocation metrics. * **textCharacters** *(dict) --* The text characters of the guardrail coverage details. * **guarded** *(integer) --* The text characters that were guarded by the guardrail coverage. * **total** *(integer) --* The total text characters by the guardrail coverage. * **images** *(dict) --* The guardrail coverage for images (the number of images that guardrails guarded). * **guarded** *(integer) --* The count (integer) of images guardrails guarded. * **total** *(integer) --* Represents the total number of images (integer) that were in the request (guarded and unguarded). * **outputAssessments** *(dict) --* the output assessments. * *(string) --* * *(list) --* * *(dict) --* A behavior assessment of the guardrail policies used in a call to the Converse API. * **topicPolicy** *(dict) --* The topic policy. * **topics** *(list) --* The topics in the assessment. * *(dict) --* Information about a topic guardrail. * **name** *(string) --* The name for the guardrail. * **type** *(string) --* The type behavior that the guardrail should perform when the model detects the topic. * **action** *(string) --* The action the guardrail should take when it intervenes on a topic. * **detected** *(boolean) --* Indicates whether topic content that breaches the guardrail configuration is detected. * **contentPolicy** *(dict) --* The content policy. * **filters** *(list) --* The content policy filters. * *(dict) --* The content filter for a guardrail. * **type** *(string) --* The guardrail type. * **confidence** *(string) --* The guardrail confidence. * **filterStrength** *(string) --* The filter strength setting for the guardrail content filter. * **action** *(string) --* The guardrail action. * **detected** *(boolean) --* Indicates whether content that breaches the guardrail configuration is detected. * **wordPolicy** *(dict) --* The word policy. * **customWords** *(list) --* Custom words in the assessment. * *(dict) --* A custom word configured in a guardrail. * **match** *(string) --* The match for the custom word. * **action** *(string) --* The action for the custom word. * **detected** *(boolean) --* Indicates whether custom word content that breaches the guardrail configuration is detected. * **managedWordLists** *(list) --* Managed word lists in the assessment. * *(dict) --* A managed word configured in a guardrail. * **match** *(string) --* The match for the managed word. * **type** *(string) --* The type for the managed word. * **action** *(string) --* The action for the managed word. * **detected** *(boolean) --* Indicates whether managed word content that breaches the guardrail configuration is detected. * **sensitiveInformationPolicy** *(dict) --* The sensitive information policy. * **piiEntities** *(list) --* The PII entities in the assessment. * *(dict) --* A Personally Identifiable Information (PII) entity configured in a guardrail. * **match** *(string) --* The PII entity filter match. * **type** *(string) --* The PII entity filter type. * **action** *(string) --* The PII entity filter action. * **detected** *(boolean) --* Indicates whether personally identifiable information (PII) that breaches the guardrail configuration is detected. * **regexes** *(list) --* The regex queries in the assessment. * *(dict) --* A Regex filter configured in a guardrail. * **name** *(string) --* The regex filter name. * **match** *(string) --* The regesx filter match. * **regex** *(string) --* The regex query. * **action** *(string) --* The region filter action. * **detected** *(boolean) --* Indicates whether custom regex entities that breach the guardrail configuration are detected. * **contextualGroundingPolicy** *(dict) --* The contextual grounding policy used for the guardrail assessment. * **filters** *(list) --* The filter details for the guardrails contextual grounding filter. * *(dict) --* The details for the guardrails contextual grounding filter. * **type** *(string) --* 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** *(string) --* The action performed by the guardrails contextual grounding filter. * **detected** *(boolean) --* Indicates whether content that fails the contextual grounding evaluation (grounding or relevance score less than the corresponding threshold) was detected. * **automatedReasoningPolicy** *(dict) --* The automated reasoning policy assessment results, including logical validation findings for the input content. * **findings** *(list) --* List of logical validation results produced by evaluating the input content against automated reasoning policies. * *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "valid", "invalid", "satisfiable", "impossible", "translationAmbiguous", "tooComplex", "noTranslations". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **valid** *(dict) --* Indicates that the claims are definitively true and logically implied by the premises, with no possible alternative interpretations. * **translation** *(dict) --* The logical translation of the input that this finding validates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **claimsTrueScenario** *(dict) --* An example scenario demonstrating how the claims are logically true. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **supportingRules** *(list) --* The automated reasoning policy rules that support why this result is considered valid. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **invalid** *(dict) --* Indicates that the claims are logically false and contradictory to the established rules or premises. * **translation** *(dict) --* The logical translation of the input that this finding invalidates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **contradictingRules** *(list) --* The automated reasoning policy rules that contradict the claims in the input. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **satisfiable** *(dict) --* Indicates that the claims could be either true or false depending on additional assumptions not provided in the input. * **translation** *(dict) --* The logical translation of the input that this finding evaluates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **claimsTrueScenario** *(dict) --* An example scenario demonstrating how the claims could be logically true. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claimsFalseScenario** *(dict) --* An example scenario demonstrating how the claims could be logically false. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **impossible** *(dict) --* Indicates that no valid claims can be made due to logical contradictions in the premises or rules. * **translation** *(dict) --* The logical translation of the input that this finding evaluates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **contradictingRules** *(list) --* The automated reasoning policy rules that contradict the claims and/or premises in the input. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **translationAmbiguous** *(dict) --* Indicates that the input has multiple valid logical interpretations, requiring additional context or clarification. * **options** *(list) --* Different logical interpretations that were detected during translation of the input. * *(dict) --* Represents one possible logical interpretation of ambiguous input content. * **translations** *(list) --* Example translations that provide this possible interpretation of the input. * *(dict) --* Contains the logical translation of natural language input into formal logical statements, including premises, claims, and confidence scores. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **differenceScenarios** *(list) --* Scenarios showing how the different translation options differ in meaning. * *(dict) --* Represents a logical scenario where claims can be evaluated as true or false, containing specific logical assignments. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **tooComplex** *(dict) --* Indicates that the input exceeds the processing capacity due to the volume or complexity of the logical information. * **noTranslations** *(dict) --* Indicates that no relevant logical information could be extracted from the input for validation. * **invocationMetrics** *(dict) --* The invocation metrics for the guardrail assessment. * **guardrailProcessingLatency** *(integer) --* The processing latency details for the guardrail invocation metrics. * **usage** *(dict) --* The usage details for the guardrail invocation metrics. * **topicPolicyUnits** *(integer) --* The topic policy units processed by the guardrail. * **contentPolicyUnits** *(integer) --* The content policy units processed by the guardrail. * **wordPolicyUnits** *(integer) --* The word policy units processed by the guardrail. * **sensitiveInformationPolicyUnits** *(integer) --* The sensitive information policy units processed by the guardrail. * **sensitiveInformationPolicyFreeUnits** *(integer) --* The sensitive information policy free units processed by the guardrail. * **contextualGroundingPolicyUnits** *(integer) --* The contextual grounding policy units processed by the guardrail. * **contentPolicyImageUnits** *(integer) --* The content policy image units processed by the guardrail. * **automatedReasoningPolicyUnits** *(integer) --* The number of text units processed by the automated reasoning policy. * **automatedReasoningPolicies** *(integer) --* The number of automated reasoning policies that were processed during the guardrail evaluation. * **guardrailCoverage** *(dict) --* The coverage details for the guardrail invocation metrics. * **textCharacters** *(dict) --* The text characters of the guardrail coverage details. * **guarded** *(integer) --* The text characters that were guarded by the guardrail coverage. * **total** *(integer) --* The total text characters by the guardrail coverage. * **images** *(dict) --* The guardrail coverage for images (the number of images that guardrails guarded). * **guarded** *(integer) --* The count (integer) of images guardrails guarded. * **total** *(integer) --* Represents the total number of images (integer) that were in the request (guarded and unguarded). * **actionReason** *(string) --* Provides the reason for the action taken when harmful content is detected. * **promptRouter** *(dict) --* The request's prompt router. * **invokedModelId** *(string) --* The ID of the invoked model. * **performanceConfig** *(dict) --* Model performance settings for the request. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". **Exceptions** * "BedrockRuntime.Client.exceptions.AccessDeniedException" * "BedrockRuntime.Client.exceptions.ThrottlingException" * "BedrockRuntime.Client.exceptions.ResourceNotFoundException" * "BedrockRuntime.Client.exceptions.ModelTimeoutException" * "BedrockRuntime.Client.exceptions.InternalServerException" * "BedrockRuntime.Client.exceptions.ServiceUnavailableException" * "BedrockRuntime.Client.exceptions.ValidationException" * "BedrockRuntime.Client.exceptions.ModelNotReadyException" * "BedrockRuntime.Client.exceptions.ModelErrorException" BedrockRuntime / Client / invoke_model_with_response_stream invoke_model_with_response_stream ********************************* BedrockRuntime.Client.invoke_model_with_response_stream(**kwargs) 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. To see if a model supports streaming, call GetFoundationModel and check the "responseStreamingSupported" field in the response. Note: The CLI doesn't support streaming operations in Amazon Bedrock, including "InvokeModelWithResponseStream". For example code, see *Invoke model with streaming code example* in the *Amazon Bedrock User Guide*. This operation requires permissions to perform the "bedrock:InvokeModelWithResponseStream" action. Warning: To deny all inference access to resources that you specify in the modelId field, you need to deny access to the "bedrock:InvokeModel" and "bedrock:InvokeModelWithResponseStream" actions. Doing this also denies access to the resource through the Converse API actions ( Converse and ConverseStream). For more information see Deny access for inference on specific models. For troubleshooting some of the common errors you might encounter when using the "InvokeModelWithResponseStream" API, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide See also: AWS API Documentation **Request Syntax** response = client.invoke_model_with_response_stream( body=b'bytes'|file, contentType='string', accept='string', modelId='string', trace='ENABLED'|'DISABLED'|'ENABLED_FULL', guardrailIdentifier='string', guardrailVersion='string', performanceConfigLatency='standard'|'optimized' ) Parameters: * **body** (*bytes** or **seekable file-like object*) -- 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. For more information, see Run inference in the Bedrock User Guide. * **contentType** (*string*) -- The MIME type of the input data in the request. You must specify "application/json". * **accept** (*string*) -- The desired MIME type of the inference body in the response. The default value is "application/json". * **modelId** (*string*) -- **[REQUIRED]** The unique identifier of the model to invoke to run inference. The "modelId" to provide depends on the type of model or throughput that you use: * If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see Amazon Bedrock base model IDs (on-demand throughput) in the Amazon Bedrock User Guide. * If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see Supported Regions and models for cross-region inference in the Amazon Bedrock User Guide. * If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see Run inference using a Provisioned Throughput in the Amazon Bedrock User Guide. * If you use a custom model, specify the ARN of the custom model deployment (for on-demand inference) or the ARN of your provisioned model (for Provisioned Throughput). For more information, see Use a custom model in Amazon Bedrock in the Amazon Bedrock User Guide. * If you use an imported model, specify the ARN of the imported model. You can get the model ARN from a successful call to CreateModelImportJob or from the Imported models page in the Amazon Bedrock console. * **trace** (*string*) -- Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace. * **guardrailIdentifier** (*string*) -- 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. An error is thrown in the following situations. * You don't provide a guardrail identifier but you specify the "amazon-bedrock-guardrailConfig" field in the request body. * You enable the guardrail but the "contentType" isn't "application/json". * You provide a guardrail identifier, but "guardrailVersion" isn't specified. * **guardrailVersion** (*string*) -- The version number for the guardrail. The value can also be "DRAFT". * **performanceConfigLatency** (*string*) -- Model performance settings for the request. Return type: dict Returns: The response of this operation contains an "EventStream" member. When iterated the "EventStream" will yield events based on the structure below, where only one of the top level keys will be present for any given event. **Response Syntax** { 'body': EventStream({ 'chunk': { 'bytes': b'bytes' }, 'internalServerException': { 'message': 'string' }, 'modelStreamErrorException': { 'message': 'string', 'originalStatusCode': 123, 'originalMessage': 'string' }, 'validationException': { 'message': 'string' }, 'throttlingException': { 'message': 'string' }, 'modelTimeoutException': { 'message': 'string' }, 'serviceUnavailableException': { 'message': 'string' } }), 'contentType': 'string', 'performanceConfigLatency': 'standard'|'optimized' } **Response Structure** * *(dict) --* * **body** ("EventStream") -- 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. * **chunk** *(dict) --* Content included in the response. * **bytes** *(bytes) --* Base64-encoded bytes of payload data. * **internalServerException** *(dict) --* An internal server error occurred. Retry your request. * **message** *(string) --* * **modelStreamErrorException** *(dict) --* An error occurred while streaming the response. Retry your request. * **message** *(string) --* * **originalStatusCode** *(integer) --* The original status code. * **originalMessage** *(string) --* The original message. * **validationException** *(dict) --* Input validation failed. Check your request parameters and retry the request. * **message** *(string) --* * **throttlingException** *(dict) --* Your request was throttled because of service-wide limitations. Resubmit your request later or in a different region. You can also purchase Provisioned Throughput to increase the rate or number of tokens you can process. * **message** *(string) --* * **modelTimeoutException** *(dict) --* The request took too long to process. Processing time exceeded the model timeout length. * **message** *(string) --* * **serviceUnavailableException** *(dict) --* The service isn't available. Try again later. * **message** *(string) --* * **contentType** *(string) --* The MIME type of the inference result. * **performanceConfigLatency** *(string) --* Model performance settings for the request. **Exceptions** * "BedrockRuntime.Client.exceptions.AccessDeniedException" * "BedrockRuntime.Client.exceptions.ResourceNotFoundException" * "BedrockRuntime.Client.exceptions.ThrottlingException" * "BedrockRuntime.Client.exceptions.ModelTimeoutException" * "BedrockRuntime.Client.exceptions.InternalServerException" * "BedrockRuntime.Client.exceptions.ServiceUnavailableException" * "BedrockRuntime.Client.exceptions.ModelStreamErrorException" * "BedrockRuntime.Client.exceptions.ValidationException" * "BedrockRuntime.Client.exceptions.ServiceQuotaExceededException" * "BedrockRuntime.Client.exceptions.ModelNotReadyException" * "BedrockRuntime.Client.exceptions.ModelErrorException" BedrockRuntime / Client / get_async_invoke get_async_invoke **************** BedrockRuntime.Client.get_async_invoke(**kwargs) Retrieve information about an asynchronous invocation. See also: AWS API Documentation **Request Syntax** response = client.get_async_invoke( invocationArn='string' ) Parameters: **invocationArn** (*string*) -- **[REQUIRED]** The invocation's ARN. Return type: dict Returns: **Response Syntax** { 'invocationArn': 'string', 'modelArn': 'string', 'clientRequestToken': 'string', 'status': 'InProgress'|'Completed'|'Failed', 'failureMessage': 'string', 'submitTime': datetime(2015, 1, 1), 'lastModifiedTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'outputDataConfig': { 's3OutputDataConfig': { 's3Uri': 'string', 'kmsKeyId': 'string', 'bucketOwner': 'string' } } } **Response Structure** * *(dict) --* * **invocationArn** *(string) --* The invocation's ARN. * **modelArn** *(string) --* The invocation's model ARN. * **clientRequestToken** *(string) --* The invocation's idempotency token. * **status** *(string) --* The invocation's status. * **failureMessage** *(string) --* An error message. * **submitTime** *(datetime) --* When the invocation request was submitted. * **lastModifiedTime** *(datetime) --* The invocation's last modified time. * **endTime** *(datetime) --* When the invocation ended. * **outputDataConfig** *(dict) --* Output data settings. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "s3OutputDataConfig". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **s3OutputDataConfig** *(dict) --* A storage location for the output data in an S3 bucket * **s3Uri** *(string) --* An object URI starting with "s3://". * **kmsKeyId** *(string) --* A KMS encryption key ID. * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. **Exceptions** * "BedrockRuntime.Client.exceptions.AccessDeniedException" * "BedrockRuntime.Client.exceptions.ThrottlingException" * "BedrockRuntime.Client.exceptions.InternalServerException" * "BedrockRuntime.Client.exceptions.ValidationException" BedrockRuntime / Client / get_waiter get_waiter ********** BedrockRuntime.Client.get_waiter(waiter_name) Returns an object that can wait for some condition. Parameters: **waiter_name** (*str*) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters. Returns: The specified waiter object. Return type: "botocore.waiter.Waiter" BedrockRuntime / Client / converse_stream converse_stream *************** BedrockRuntime.Client.converse_stream(**kwargs) 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. To find out if a model supports streaming, call GetFoundationModel and check the "responseStreamingSupported" field in the response. Note: The CLI doesn't support streaming operations in Amazon Bedrock, including "ConverseStream". Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response. You can submit a prompt by including it in the "messages" field, specifying the "modelId" of a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case. You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the "promptVariables" field. You can append more messages to the prompt by using the "messages" field. If you use a prompt from Prompt management, you can't include the following fields in the request: "additionalModelRequestFields", "inferenceConfig", "system", or "toolConfig". Instead, these fields must be defined through Prompt management. For more information, see Use a prompt from Prompt management. For information about the Converse API, see *Use the Converse API* in the *Amazon Bedrock User Guide*. To use a guardrail, see *Use a guardrail with the Converse API* in the *Amazon Bedrock User Guide*. To use a tool with a model, see *Tool use (Function calling)* in the *Amazon Bedrock User Guide* For example code, see *Conversation streaming example* in the *Amazon Bedrock User Guide*. This operation requires permission for the "bedrock:InvokeModelWithResponseStream" action. Warning: To deny all inference access to resources that you specify in the modelId field, you need to deny access to the "bedrock:InvokeModel" and "bedrock:InvokeModelWithResponseStream" actions. Doing this also denies access to the resource through the base inference actions ( InvokeModel and InvokeModelWithResponseStream). For more information see Deny access for inference on specific models. For troubleshooting some of the common errors you might encounter when using the "ConverseStream" API, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide See also: AWS API Documentation **Request Syntax** response = client.converse_stream( modelId='string', messages=[ { 'role': 'user'|'assistant', 'content': [ { 'text': 'string', 'image': { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } }, 'document': { 'format': 'pdf'|'csv'|'doc'|'docx'|'xls'|'xlsx'|'html'|'txt'|'md', 'name': 'string', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' }, 'text': 'string', 'content': [ { 'text': 'string' }, ] }, 'context': 'string', 'citations': { 'enabled': True|False } }, 'video': { 'format': 'mkv'|'mov'|'mp4'|'webm'|'flv'|'mpeg'|'mpg'|'wmv'|'three_gp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } }, 'toolUse': { 'toolUseId': 'string', 'name': 'string', 'input': {...}|[...]|123|123.4|'string'|True|None }, 'toolResult': { 'toolUseId': 'string', 'content': [ { 'json': {...}|[...]|123|123.4|'string'|True|None, 'text': 'string', 'image': { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } }, 'document': { 'format': 'pdf'|'csv'|'doc'|'docx'|'xls'|'xlsx'|'html'|'txt'|'md', 'name': 'string', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' }, 'text': 'string', 'content': [ { 'text': 'string' }, ] }, 'context': 'string', 'citations': { 'enabled': True|False } }, 'video': { 'format': 'mkv'|'mov'|'mp4'|'webm'|'flv'|'mpeg'|'mpg'|'wmv'|'three_gp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string', 'bucketOwner': 'string' } } } }, ], 'status': 'success'|'error' }, 'guardContent': { 'text': { 'text': 'string', 'qualifiers': [ 'grounding_source'|'query'|'guard_content', ] }, 'image': { 'format': 'png'|'jpeg', 'source': { 'bytes': b'bytes' } } }, 'cachePoint': { 'type': 'default' }, 'reasoningContent': { 'reasoningText': { 'text': 'string', 'signature': 'string' }, 'redactedContent': b'bytes' }, 'citationsContent': { 'content': [ { 'text': 'string' }, ], 'citations': [ { 'title': 'string', 'sourceContent': [ { 'text': 'string' }, ], 'location': { 'documentChar': { 'documentIndex': 123, 'start': 123, 'end': 123 }, 'documentPage': { 'documentIndex': 123, 'start': 123, 'end': 123 }, 'documentChunk': { 'documentIndex': 123, 'start': 123, 'end': 123 } } }, ] } }, ] }, ], system=[ { 'text': 'string', 'guardContent': { 'text': { 'text': 'string', 'qualifiers': [ 'grounding_source'|'query'|'guard_content', ] }, 'image': { 'format': 'png'|'jpeg', 'source': { 'bytes': b'bytes' } } }, 'cachePoint': { 'type': 'default' } }, ], inferenceConfig={ 'maxTokens': 123, 'temperature': ..., 'topP': ..., 'stopSequences': [ 'string', ] }, toolConfig={ 'tools': [ { 'toolSpec': { 'name': 'string', 'description': 'string', 'inputSchema': { 'json': {...}|[...]|123|123.4|'string'|True|None } }, 'cachePoint': { 'type': 'default' } }, ], 'toolChoice': { 'auto': {} , 'any': {} , 'tool': { 'name': 'string' } } }, guardrailConfig={ 'guardrailIdentifier': 'string', 'guardrailVersion': 'string', 'trace': 'enabled'|'disabled'|'enabled_full', 'streamProcessingMode': 'sync'|'async' }, additionalModelRequestFields={...}|[...]|123|123.4|'string'|True|None, promptVariables={ 'string': { 'text': 'string' } }, additionalModelResponseFieldPaths=[ 'string', ], requestMetadata={ 'string': 'string' }, performanceConfig={ 'latency': 'standard'|'optimized' } ) Parameters: * **modelId** (*string*) -- **[REQUIRED]** 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: * If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see Amazon Bedrock base model IDs (on-demand throughput) in the Amazon Bedrock User Guide. * If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see Supported Regions and models for cross-region inference in the Amazon Bedrock User Guide. * If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see Run inference using a Provisioned Throughput in the Amazon Bedrock User Guide. * If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see Use a custom model in Amazon Bedrock in the Amazon Bedrock User Guide. * To include a prompt that was defined in Prompt management, specify the ARN of the prompt version to use. The Converse API doesn't support imported models. * **messages** (*list*) -- The messages that you want to send to the model. * *(dict) --* A message input, or returned from, a call to Converse or ConverseStream. * **role** *(string) --* **[REQUIRED]** The role that the message plays in the message. * **content** *(list) --* **[REQUIRED]** The message content. Note the following restrictions: * You can include up to 20 images. Each image's size, height, and width must be no more than 3.75 MB, 8000 px, and 8000 px, respectively. * You can include up to five documents. Each document's size must be no more than 4.5 MB. * If you include a "ContentBlock" with a "document" field in the array, you must also include a "ContentBlock" with a "text" field. * You can only include images and documents if the "role" is "user". * *(dict) --* A block of content for a message that you pass to, or receive from, a model with the Converse or ConverseStream API operations. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text", "image", "document", "video", "toolUse", "toolResult", "guardContent", "cachePoint", "reasoningContent", "citationsContent". * **text** *(string) --* Text to include in the message. * **image** *(dict) --* Image to include in the message. Note: This field is only supported by Anthropic Claude 3 models. * **format** *(string) --* **[REQUIRED]** The format of the image. * **source** *(dict) --* **[REQUIRED]** The source for the image. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location". * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **document** *(dict) --* A document to include in the message. * **format** *(string) --* The format of a document, or its extension. * **name** *(string) --* **[REQUIRED]** A name for the document. The name can only contain the following characters: * Alphanumeric characters * Whitespace characters (no more than one in a row) * Hyphens * Parentheses * Square brackets Note: This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name. * **source** *(dict) --* **[REQUIRED]** Contains the content of the document. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location", "text", "content". * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **text** *(string) --* The text content of the document source. * **content** *(list) --* The structured content of the document source, which may include various content blocks such as text, images, or other document elements. * *(dict) --* Contains the actual content of a document that can be processed by the model and potentially cited in the response. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The text content of the document. * **context** *(string) --* Contextual information about how the document should be processed or interpreted by the model when generating citations. * **citations** *(dict) --* Configuration settings that control how citations should be generated for this specific document. * **enabled** *(boolean) --* **[REQUIRED]** Specifies whether document citations should be included in the model's response. When set to true, the model can generate citations that reference the source documents used to inform the response. * **video** *(dict) --* Video to include in the message. * **format** *(string) --* **[REQUIRED]** The block's format. * **source** *(dict) --* **[REQUIRED]** The block's source. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location". * **bytes** *(bytes) --* Video content encoded in base64. * **s3Location** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **toolUse** *(dict) --* Information about a tool use request from a model. * **toolUseId** *(string) --* **[REQUIRED]** The ID for the tool request. * **name** *(string) --* **[REQUIRED]** The name of the tool that the model wants to use. * **input** (*document*) -- **[REQUIRED]** The input to pass to the tool. * **toolResult** *(dict) --* The result for a tool request that a model makes. * **toolUseId** *(string) --* **[REQUIRED]** The ID of the tool request that this is the result for. * **content** *(list) --* **[REQUIRED]** The content for tool result content block. * *(dict) --* The tool result content block. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "json", "text", "image", "document", "video". * **json** (*document*) -- A tool result that is JSON format data. * **text** *(string) --* A tool result that is text. * **image** *(dict) --* A tool result that is an image. Note: This field is only supported by Anthropic Claude 3 models. * **format** *(string) --* **[REQUIRED]** The format of the image. * **source** *(dict) --* **[REQUIRED]** The source for the image. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location". * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **document** *(dict) --* A tool result that is a document. * **format** *(string) --* The format of a document, or its extension. * **name** *(string) --* **[REQUIRED]** A name for the document. The name can only contain the following characters: * Alphanumeric characters * Whitespace characters (no more than one in a row) * Hyphens * Parentheses * Square brackets Note: This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name. * **source** *(dict) --* **[REQUIRED]** Contains the content of the document. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location", "text", "content". * **bytes** *(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** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **text** *(string) --* The text content of the document source. * **content** *(list) --* The structured content of the document source, which may include various content blocks such as text, images, or other document elements. * *(dict) --* Contains the actual content of a document that can be processed by the model and potentially cited in the response. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The text content of the document. * **context** *(string) --* Contextual information about how the document should be processed or interpreted by the model when generating citations. * **citations** *(dict) --* Configuration settings that control how citations should be generated for this specific document. * **enabled** *(boolean) --* **[REQUIRED]** Specifies whether document citations should be included in the model's response. When set to true, the model can generate citations that reference the source documents used to inform the response. * **video** *(dict) --* A tool result that is video. * **format** *(string) --* **[REQUIRED]** The block's format. * **source** *(dict) --* **[REQUIRED]** The block's source. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes", "s3Location". * **bytes** *(bytes) --* Video content encoded in base64. * **s3Location** *(dict) --* 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. * **uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **status** *(string) --* The status for the tool result content block. Note: This field is only supported Anthropic Claude 3 models. * **guardContent** *(dict) --* 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. For more information, see *Use a guardrail with the Converse API* in the *Amazon Bedrock User Guide*. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text", "image". * **text** *(dict) --* The text to guard. * **text** *(string) --* **[REQUIRED]** The text that you want to guard. * **qualifiers** *(list) --* The qualifier details for the guardrails contextual grounding filter. * *(string) --* * **image** *(dict) --* Image within converse content block to be evaluated by the guardrail. * **format** *(string) --* **[REQUIRED]** The format details for the image type of the guardrail converse image block. * **source** *(dict) --* **[REQUIRED]** The image source (image bytes) of the guardrail converse image block. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes". * **bytes** *(bytes) --* The raw image bytes for the image. * **cachePoint** *(dict) --* CachePoint to include in the message. * **type** *(string) --* **[REQUIRED]** Specifies the type of cache point within the CachePointBlock. * **reasoningContent** *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "reasoningText", "redactedContent". * **reasoningText** *(dict) --* The reasoning that the model used to return the output. * **text** *(string) --* **[REQUIRED]** The reasoning that the model used to return the output. * **signature** *(string) --* 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. * **redactedContent** *(bytes) --* The content in the reasoning that was encrypted by the model provider for safety reasons. The encryption doesn't affect the quality of responses. * **citationsContent** *(dict) --* A content block that contains both generated text and associated citation information, providing traceability between the response and source documents. * **content** *(list) --* The generated content that is supported by the associated citations. * *(dict) --* Contains the generated text content that corresponds to or is supported by a citation from a source document. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The text content that was generated by the model and is supported by the associated citation. * **citations** *(list) --* An array of citations that reference the source documents used to generate the associated content. * *(dict) --* 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** *(string) --* The title or identifier of the source document being cited. * **sourceContent** *(list) --* The specific content from the source document that was referenced or cited in the generated response. * *(dict) --* Contains the actual text content from a source document that is being cited or referenced in the model's response. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The text content from the source document that is being cited. * **location** *(dict) --* The precise location within the source document where the cited content can be found, including character positions, page numbers, or chunk identifiers. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "documentChar", "documentPage", "documentChunk". * **documentChar** *(dict) --* The character-level location within the document where the cited content is found. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting character position of the cited content within the document. * **end** *(integer) --* The ending character position of the cited content within the document. * **documentPage** *(dict) --* The page-level location within the document where the cited content is found. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting page number of the cited content within the document. * **end** *(integer) --* The ending page number of the cited content within the document. * **documentChunk** *(dict) --* The chunk-level location within the document where the cited content is found, typically used for documents that have been segmented into logical chunks. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting chunk identifier or index of the cited content within the document. * **end** *(integer) --* The ending chunk identifier or index of the cited content within the document. * **system** (*list*) -- 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. * *(dict) --* A system content block. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text", "guardContent", "cachePoint". * **text** *(string) --* A system prompt for the model. * **guardContent** *(dict) --* A content block to assess with the guardrail. Use with the Converse or ConverseStream API operations. For more information, see *Use a guardrail with the Converse API* in the *Amazon Bedrock User Guide*. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text", "image". * **text** *(dict) --* The text to guard. * **text** *(string) --* **[REQUIRED]** The text that you want to guard. * **qualifiers** *(list) --* The qualifier details for the guardrails contextual grounding filter. * *(string) --* * **image** *(dict) --* Image within converse content block to be evaluated by the guardrail. * **format** *(string) --* **[REQUIRED]** The format details for the image type of the guardrail converse image block. * **source** *(dict) --* **[REQUIRED]** The image source (image bytes) of the guardrail converse image block. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes". * **bytes** *(bytes) --* The raw image bytes for the image. * **cachePoint** *(dict) --* CachePoint to include in the system prompt. * **type** *(string) --* **[REQUIRED]** Specifies the type of cache point within the CachePointBlock. * **inferenceConfig** (*dict*) -- 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. * **maxTokens** *(integer) --* 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. * **temperature** *(float) --* 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. The default value is the default value for the model that you are using. For more information, see Inference parameters for foundation models. * **topP** *(float) --* 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. The default value is the default value for the model that you are using. For more information, see Inference parameters for foundation models. * **stopSequences** *(list) --* A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response. * *(string) --* * **toolConfig** (*dict*) -- Configuration information for the tools that the model can use when generating a response. For information about models that support streaming tool use, see Supported models and model features. * **tools** *(list) --* **[REQUIRED]** An array of tools that you want to pass to a model. * *(dict) --* Information about a tool that you can use with the Converse API. For more information, see Tool use (function calling) in the Amazon Bedrock User Guide. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "toolSpec", "cachePoint". * **toolSpec** *(dict) --* The specfication for the tool. * **name** *(string) --* **[REQUIRED]** The name for the tool. * **description** *(string) --* The description for the tool. * **inputSchema** *(dict) --* **[REQUIRED]** The input schema for the tool in JSON format. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "json". * **json** (*document*) -- The JSON schema for the tool. For more information, see JSON Schema Reference. * **cachePoint** *(dict) --* CachePoint to include in the tool configuration. * **type** *(string) --* **[REQUIRED]** Specifies the type of cache point within the CachePointBlock. * **toolChoice** *(dict) --* If supported by model, forces the model to request a tool. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "auto", "any", "tool". * **auto** *(dict) --* (Default). The Model automatically decides if a tool should be called or whether to generate text instead. * **any** *(dict) --* The model must request at least one tool (no text is generated). * **tool** *(dict) --* The Model must request the specified tool. Only supported by Anthropic Claude 3 models. * **name** *(string) --* **[REQUIRED]** The name of the tool that the model must request. * **guardrailConfig** (*dict*) -- 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. * **guardrailIdentifier** *(string) --* **[REQUIRED]** The identifier for the guardrail. * **guardrailVersion** *(string) --* **[REQUIRED]** The version of the guardrail. * **trace** *(string) --* The trace behavior for the guardrail. * **streamProcessingMode** *(string) --* The processing mode. The processing mode. For more information, see *Configure streaming response behavior* in the *Amazon Bedrock User Guide*. * **additionalModelRequestFields** (*document*) -- 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. * **promptVariables** (*dict*) -- 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. * *(string) --* * *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The text value that the variable maps to. * **additionalModelResponseFieldPaths** (*list*) -- 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". "[ "/stop_sequence" ]" For information about the JSON Pointer syntax, see the Internet Engineering Task Force (IETF) documentation. "Converse" and "ConverseStream" reject an empty JSON Pointer or incorrectly structured JSON Pointer with a "400" error code. if the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by "Converse". * *(string) --* * **requestMetadata** (*dict*) -- Key-value pairs that you can use to filter invocation logs. * *(string) --* * *(string) --* * **performanceConfig** (*dict*) -- Model performance settings for the request. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". Return type: dict Returns: The response of this operation contains an "EventStream" member. When iterated the "EventStream" will yield events based on the structure below, where only one of the top level keys will be present for any given event. **Response Syntax** { 'stream': EventStream({ 'messageStart': { 'role': 'user'|'assistant' }, 'contentBlockStart': { 'start': { 'toolUse': { 'toolUseId': 'string', 'name': 'string' } }, 'contentBlockIndex': 123 }, 'contentBlockDelta': { 'delta': { 'text': 'string', 'toolUse': { 'input': 'string' }, 'reasoningContent': { 'text': 'string', 'redactedContent': b'bytes', 'signature': 'string' }, 'citation': { 'title': 'string', 'sourceContent': [ { 'text': 'string' }, ], 'location': { 'documentChar': { 'documentIndex': 123, 'start': 123, 'end': 123 }, 'documentPage': { 'documentIndex': 123, 'start': 123, 'end': 123 }, 'documentChunk': { 'documentIndex': 123, 'start': 123, 'end': 123 } } } }, 'contentBlockIndex': 123 }, 'contentBlockStop': { 'contentBlockIndex': 123 }, 'messageStop': { 'stopReason': 'end_turn'|'tool_use'|'max_tokens'|'stop_sequence'|'guardrail_intervened'|'content_filtered', 'additionalModelResponseFields': {...}|[...]|123|123.4|'string'|True|None }, 'metadata': { 'usage': { 'inputTokens': 123, 'outputTokens': 123, 'totalTokens': 123, 'cacheReadInputTokens': 123, 'cacheWriteInputTokens': 123 }, 'metrics': { 'latencyMs': 123 }, 'trace': { 'guardrail': { 'modelOutput': [ 'string', ], 'inputAssessment': { 'string': { 'topicPolicy': { 'topics': [ { 'name': 'string', 'type': 'DENY', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'contentPolicy': { 'filters': [ { 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'filterStrength': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'wordPolicy': { 'customWords': [ { 'match': 'string', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ], 'managedWordLists': [ { 'match': 'string', 'type': 'PROFANITY', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'match': 'string', 'type': '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', 'action': 'ANONYMIZED'|'BLOCKED'|'NONE', 'detected': True|False }, ], 'regexes': [ { 'name': 'string', 'match': 'string', 'regex': 'string', 'action': 'ANONYMIZED'|'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'contextualGroundingPolicy': { 'filters': [ { 'type': 'GROUNDING'|'RELEVANCE', 'threshold': 123.0, 'score': 123.0, 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'automatedReasoningPolicy': { 'findings': [ { 'valid': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'claimsTrueScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'supportingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'invalid': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'contradictingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'satisfiable': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'claimsTrueScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'claimsFalseScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'impossible': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'contradictingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'translationAmbiguous': { 'options': [ { 'translations': [ { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, ] }, ], 'differenceScenarios': [ { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, ] }, 'tooComplex': {}, 'noTranslations': {} }, ] }, 'invocationMetrics': { 'guardrailProcessingLatency': 123, 'usage': { 'topicPolicyUnits': 123, 'contentPolicyUnits': 123, 'wordPolicyUnits': 123, 'sensitiveInformationPolicyUnits': 123, 'sensitiveInformationPolicyFreeUnits': 123, 'contextualGroundingPolicyUnits': 123, 'contentPolicyImageUnits': 123, 'automatedReasoningPolicyUnits': 123, 'automatedReasoningPolicies': 123 }, 'guardrailCoverage': { 'textCharacters': { 'guarded': 123, 'total': 123 }, 'images': { 'guarded': 123, 'total': 123 } } } } }, 'outputAssessments': { 'string': [ { 'topicPolicy': { 'topics': [ { 'name': 'string', 'type': 'DENY', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'contentPolicy': { 'filters': [ { 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'filterStrength': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'wordPolicy': { 'customWords': [ { 'match': 'string', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ], 'managedWordLists': [ { 'match': 'string', 'type': 'PROFANITY', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'match': 'string', 'type': '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', 'action': 'ANONYMIZED'|'BLOCKED'|'NONE', 'detected': True|False }, ], 'regexes': [ { 'name': 'string', 'match': 'string', 'regex': 'string', 'action': 'ANONYMIZED'|'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'contextualGroundingPolicy': { 'filters': [ { 'type': 'GROUNDING'|'RELEVANCE', 'threshold': 123.0, 'score': 123.0, 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'automatedReasoningPolicy': { 'findings': [ { 'valid': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'claimsTrueScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'supportingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'invalid': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'contradictingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'satisfiable': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'claimsTrueScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'claimsFalseScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'impossible': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'contradictingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'translationAmbiguous': { 'options': [ { 'translations': [ { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, ] }, ], 'differenceScenarios': [ { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, ] }, 'tooComplex': {}, 'noTranslations': {} }, ] }, 'invocationMetrics': { 'guardrailProcessingLatency': 123, 'usage': { 'topicPolicyUnits': 123, 'contentPolicyUnits': 123, 'wordPolicyUnits': 123, 'sensitiveInformationPolicyUnits': 123, 'sensitiveInformationPolicyFreeUnits': 123, 'contextualGroundingPolicyUnits': 123, 'contentPolicyImageUnits': 123, 'automatedReasoningPolicyUnits': 123, 'automatedReasoningPolicies': 123 }, 'guardrailCoverage': { 'textCharacters': { 'guarded': 123, 'total': 123 }, 'images': { 'guarded': 123, 'total': 123 } } } }, ] }, 'actionReason': 'string' }, 'promptRouter': { 'invokedModelId': 'string' } }, 'performanceConfig': { 'latency': 'standard'|'optimized' } }, 'internalServerException': { 'message': 'string' }, 'modelStreamErrorException': { 'message': 'string', 'originalStatusCode': 123, 'originalMessage': 'string' }, 'validationException': { 'message': 'string' }, 'throttlingException': { 'message': 'string' }, 'serviceUnavailableException': { 'message': 'string' } }) } **Response Structure** * *(dict) --* * **stream** ("EventStream") -- The output stream that the model generated. * **messageStart** *(dict) --* Message start information. * **role** *(string) --* The role for the message. * **contentBlockStart** *(dict) --* Start information for a content block. * **start** *(dict) --* Start information about a content block start event. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "toolUse". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **toolUse** *(dict) --* Information about a tool that the model is requesting to use. * **toolUseId** *(string) --* The ID for the tool request. * **name** *(string) --* The name of the tool that the model is requesting to use. * **contentBlockIndex** *(integer) --* The index for a content block start event. * **contentBlockDelta** *(dict) --* The messages output content block delta. * **delta** *(dict) --* The delta for a content block delta event. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "text", "toolUse", "reasoningContent", "citation". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **text** *(string) --* The content text. * **toolUse** *(dict) --* Information about a tool that the model is requesting to use. * **input** *(string) --* The input for a requested tool. * **reasoningContent** *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "text", "redactedContent", "signature". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **text** *(string) --* The reasoning that the model used to return the output. * **redactedContent** *(bytes) --* 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** *(string) --* 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. * **citation** *(dict) --* Incremental citation information that is streamed as part of the response generation process. * **title** *(string) --* The title or identifier of the source document being cited. * **sourceContent** *(list) --* The specific content from the source document that was referenced or cited in the generated response. * *(dict) --* Contains incremental updates to the source content text during streaming responses, allowing clients to build up the cited content progressively. * **text** *(string) --* An incremental update to the text content from the source document that is being cited. * **location** *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "documentChar", "documentPage", "documentChunk". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **documentChar** *(dict) --* The character-level location within the document where the cited content is found. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting character position of the cited content within the document. * **end** *(integer) --* The ending character position of the cited content within the document. * **documentPage** *(dict) --* The page-level location within the document where the cited content is found. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting page number of the cited content within the document. * **end** *(integer) --* The ending page number of the cited content within the document. * **documentChunk** *(dict) --* The chunk-level location within the document where the cited content is found, typically used for documents that have been segmented into logical chunks. * **documentIndex** *(integer) --* The index of the document within the array of documents provided in the request. * **start** *(integer) --* The starting chunk identifier or index of the cited content within the document. * **end** *(integer) --* The ending chunk identifier or index of the cited content within the document. * **contentBlockIndex** *(integer) --* The block index for a content block delta event. * **contentBlockStop** *(dict) --* Stop information for a content block. * **contentBlockIndex** *(integer) --* The index for a content block. * **messageStop** *(dict) --* Message stop information. * **stopReason** *(string) --* The reason why the model stopped generating output. * **additionalModelResponseFields** (*document*) -- The additional model response fields. * **metadata** *(dict) --* Metadata for the converse output stream. * **usage** *(dict) --* Usage information for the conversation stream event. * **inputTokens** *(integer) --* The number of tokens sent in the request to the model. * **outputTokens** *(integer) --* The number of tokens that the model generated for the request. * **totalTokens** *(integer) --* The total of input tokens and tokens generated by the model. * **cacheReadInputTokens** *(integer) --* The number of input tokens read from the cache for the request. * **cacheWriteInputTokens** *(integer) --* The number of input tokens written to the cache for the request. * **metrics** *(dict) --* The metrics for the conversation stream metadata event. * **latencyMs** *(integer) --* The latency for the streaming request, in milliseconds. * **trace** *(dict) --* The trace object in the response from ConverseStream that contains information about the guardrail behavior. * **guardrail** *(dict) --* The guardrail trace object. * **modelOutput** *(list) --* The output from the model. * *(string) --* * **inputAssessment** *(dict) --* The input assessment. * *(string) --* * *(dict) --* A behavior assessment of the guardrail policies used in a call to the Converse API. * **topicPolicy** *(dict) --* The topic policy. * **topics** *(list) --* The topics in the assessment. * *(dict) --* Information about a topic guardrail. * **name** *(string) --* The name for the guardrail. * **type** *(string) --* The type behavior that the guardrail should perform when the model detects the topic. * **action** *(string) --* The action the guardrail should take when it intervenes on a topic. * **detected** *(boolean) --* Indicates whether topic content that breaches the guardrail configuration is detected. * **contentPolicy** *(dict) --* The content policy. * **filters** *(list) --* The content policy filters. * *(dict) --* The content filter for a guardrail. * **type** *(string) --* The guardrail type. * **confidence** *(string) --* The guardrail confidence. * **filterStrength** *(string) --* The filter strength setting for the guardrail content filter. * **action** *(string) --* The guardrail action. * **detected** *(boolean) --* Indicates whether content that breaches the guardrail configuration is detected. * **wordPolicy** *(dict) --* The word policy. * **customWords** *(list) --* Custom words in the assessment. * *(dict) --* A custom word configured in a guardrail. * **match** *(string) --* The match for the custom word. * **action** *(string) --* The action for the custom word. * **detected** *(boolean) --* Indicates whether custom word content that breaches the guardrail configuration is detected. * **managedWordLists** *(list) --* Managed word lists in the assessment. * *(dict) --* A managed word configured in a guardrail. * **match** *(string) --* The match for the managed word. * **type** *(string) --* The type for the managed word. * **action** *(string) --* The action for the managed word. * **detected** *(boolean) --* Indicates whether managed word content that breaches the guardrail configuration is detected. * **sensitiveInformationPolicy** *(dict) --* The sensitive information policy. * **piiEntities** *(list) --* The PII entities in the assessment. * *(dict) --* A Personally Identifiable Information (PII) entity configured in a guardrail. * **match** *(string) --* The PII entity filter match. * **type** *(string) --* The PII entity filter type. * **action** *(string) --* The PII entity filter action. * **detected** *(boolean) --* Indicates whether personally identifiable information (PII) that breaches the guardrail configuration is detected. * **regexes** *(list) --* The regex queries in the assessment. * *(dict) --* A Regex filter configured in a guardrail. * **name** *(string) --* The regex filter name. * **match** *(string) --* The regesx filter match. * **regex** *(string) --* The regex query. * **action** *(string) --* The region filter action. * **detected** *(boolean) --* Indicates whether custom regex entities that breach the guardrail configuration are detected. * **contextualGroundingPolicy** *(dict) --* The contextual grounding policy used for the guardrail assessment. * **filters** *(list) --* The filter details for the guardrails contextual grounding filter. * *(dict) --* The details for the guardrails contextual grounding filter. * **type** *(string) --* 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** *(string) --* The action performed by the guardrails contextual grounding filter. * **detected** *(boolean) --* Indicates whether content that fails the contextual grounding evaluation (grounding or relevance score less than the corresponding threshold) was detected. * **automatedReasoningPolicy** *(dict) --* The automated reasoning policy assessment results, including logical validation findings for the input content. * **findings** *(list) --* List of logical validation results produced by evaluating the input content against automated reasoning policies. * *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "valid", "invalid", "satisfiable", "impossible", "translationAmbiguous", "tooComplex", "noTranslations". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **valid** *(dict) --* Indicates that the claims are definitively true and logically implied by the premises, with no possible alternative interpretations. * **translation** *(dict) --* The logical translation of the input that this finding validates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **claimsTrueScenario** *(dict) --* An example scenario demonstrating how the claims are logically true. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **supportingRules** *(list) --* The automated reasoning policy rules that support why this result is considered valid. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **invalid** *(dict) --* Indicates that the claims are logically false and contradictory to the established rules or premises. * **translation** *(dict) --* The logical translation of the input that this finding invalidates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **contradictingRules** *(list) --* The automated reasoning policy rules that contradict the claims in the input. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **satisfiable** *(dict) --* Indicates that the claims could be either true or false depending on additional assumptions not provided in the input. * **translation** *(dict) --* The logical translation of the input that this finding evaluates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **claimsTrueScenario** *(dict) --* An example scenario demonstrating how the claims could be logically true. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claimsFalseScenario** *(dict) --* An example scenario demonstrating how the claims could be logically false. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **impossible** *(dict) --* Indicates that no valid claims can be made due to logical contradictions in the premises or rules. * **translation** *(dict) --* The logical translation of the input that this finding evaluates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **contradictingRules** *(list) --* The automated reasoning policy rules that contradict the claims and/or premises in the input. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **translationAmbiguous** *(dict) --* Indicates that the input has multiple valid logical interpretations, requiring additional context or clarification. * **options** *(list) --* Different logical interpretations that were detected during translation of the input. * *(dict) --* Represents one possible logical interpretation of ambiguous input content. * **translations** *(list) --* Example translations that provide this possible interpretation of the input. * *(dict) --* Contains the logical translation of natural language input into formal logical statements, including premises, claims, and confidence scores. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **differenceScenarios** *(list) --* Scenarios showing how the different translation options differ in meaning. * *(dict) --* Represents a logical scenario where claims can be evaluated as true or false, containing specific logical assignments. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **tooComplex** *(dict) --* Indicates that the input exceeds the processing capacity due to the volume or complexity of the logical information. * **noTranslations** *(dict) --* Indicates that no relevant logical information could be extracted from the input for validation. * **invocationMetrics** *(dict) --* The invocation metrics for the guardrail assessment. * **guardrailProcessingLatency** *(integer) --* The processing latency details for the guardrail invocation metrics. * **usage** *(dict) --* The usage details for the guardrail invocation metrics. * **topicPolicyUnits** *(integer) --* The topic policy units processed by the guardrail. * **contentPolicyUnits** *(integer) --* The content policy units processed by the guardrail. * **wordPolicyUnits** *(integer) --* The word policy units processed by the guardrail. * **sensitiveInformationPolicyUnits** *(integer) --* The sensitive information policy units processed by the guardrail. * **sensitiveInformationPolicyFreeUnits** *(integer) --* The sensitive information policy free units processed by the guardrail. * **contextualGroundingPolicyUnits** *(integer) --* The contextual grounding policy units processed by the guardrail. * **contentPolicyImageUnits** *(integer) --* The content policy image units processed by the guardrail. * **automatedReasoningPolicyUnits** *(integer) --* The number of text units processed by the automated reasoning policy. * **automatedReasoningPolicies** *(integer) --* The number of automated reasoning policies that were processed during the guardrail evaluation. * **guardrailCoverage** *(dict) --* The coverage details for the guardrail invocation metrics. * **textCharacters** *(dict) --* The text characters of the guardrail coverage details. * **guarded** *(integer) --* The text characters that were guarded by the guardrail coverage. * **total** *(integer) --* The total text characters by the guardrail coverage. * **images** *(dict) --* The guardrail coverage for images (the number of images that guardrails guarded). * **guarded** *(integer) --* The count (integer) of images guardrails guarded. * **total** *(integer) --* Represents the total number of images (integer) that were in the request (guarded and unguarded). * **outputAssessments** *(dict) --* the output assessments. * *(string) --* * *(list) --* * *(dict) --* A behavior assessment of the guardrail policies used in a call to the Converse API. * **topicPolicy** *(dict) --* The topic policy. * **topics** *(list) --* The topics in the assessment. * *(dict) --* Information about a topic guardrail. * **name** *(string) --* The name for the guardrail. * **type** *(string) --* The type behavior that the guardrail should perform when the model detects the topic. * **action** *(string) --* The action the guardrail should take when it intervenes on a topic. * **detected** *(boolean) --* Indicates whether topic content that breaches the guardrail configuration is detected. * **contentPolicy** *(dict) --* The content policy. * **filters** *(list) --* The content policy filters. * *(dict) --* The content filter for a guardrail. * **type** *(string) --* The guardrail type. * **confidence** *(string) --* The guardrail confidence. * **filterStrength** *(string) --* The filter strength setting for the guardrail content filter. * **action** *(string) --* The guardrail action. * **detected** *(boolean) --* Indicates whether content that breaches the guardrail configuration is detected. * **wordPolicy** *(dict) --* The word policy. * **customWords** *(list) --* Custom words in the assessment. * *(dict) --* A custom word configured in a guardrail. * **match** *(string) --* The match for the custom word. * **action** *(string) --* The action for the custom word. * **detected** *(boolean) --* Indicates whether custom word content that breaches the guardrail configuration is detected. * **managedWordLists** *(list) --* Managed word lists in the assessment. * *(dict) --* A managed word configured in a guardrail. * **match** *(string) --* The match for the managed word. * **type** *(string) --* The type for the managed word. * **action** *(string) --* The action for the managed word. * **detected** *(boolean) --* Indicates whether managed word content that breaches the guardrail configuration is detected. * **sensitiveInformationPolicy** *(dict) --* The sensitive information policy. * **piiEntities** *(list) --* The PII entities in the assessment. * *(dict) --* A Personally Identifiable Information (PII) entity configured in a guardrail. * **match** *(string) --* The PII entity filter match. * **type** *(string) --* The PII entity filter type. * **action** *(string) --* The PII entity filter action. * **detected** *(boolean) --* Indicates whether personally identifiable information (PII) that breaches the guardrail configuration is detected. * **regexes** *(list) --* The regex queries in the assessment. * *(dict) --* A Regex filter configured in a guardrail. * **name** *(string) --* The regex filter name. * **match** *(string) --* The regesx filter match. * **regex** *(string) --* The regex query. * **action** *(string) --* The region filter action. * **detected** *(boolean) --* Indicates whether custom regex entities that breach the guardrail configuration are detected. * **contextualGroundingPolicy** *(dict) --* The contextual grounding policy used for the guardrail assessment. * **filters** *(list) --* The filter details for the guardrails contextual grounding filter. * *(dict) --* The details for the guardrails contextual grounding filter. * **type** *(string) --* 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** *(string) --* The action performed by the guardrails contextual grounding filter. * **detected** *(boolean) --* Indicates whether content that fails the contextual grounding evaluation (grounding or relevance score less than the corresponding threshold) was detected. * **automatedReasoningPolicy** *(dict) --* The automated reasoning policy assessment results, including logical validation findings for the input content. * **findings** *(list) --* List of logical validation results produced by evaluating the input content against automated reasoning policies. * *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "valid", "invalid", "satisfiable", "impossible", "translationAmbiguous", "tooComplex", "noTranslations". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **valid** *(dict) --* Indicates that the claims are definitively true and logically implied by the premises, with no possible alternative interpretations. * **translation** *(dict) --* The logical translation of the input that this finding validates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **claimsTrueScenario** *(dict) --* An example scenario demonstrating how the claims are logically true. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **supportingRules** *(list) --* The automated reasoning policy rules that support why this result is considered valid. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **invalid** *(dict) --* Indicates that the claims are logically false and contradictory to the established rules or premises. * **translation** *(dict) --* The logical translation of the input that this finding invalidates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **contradictingRules** *(list) --* The automated reasoning policy rules that contradict the claims in the input. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **satisfiable** *(dict) --* Indicates that the claims could be either true or false depending on additional assumptions not provided in the input. * **translation** *(dict) --* The logical translation of the input that this finding evaluates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **claimsTrueScenario** *(dict) --* An example scenario demonstrating how the claims could be logically true. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claimsFalseScenario** *(dict) --* An example scenario demonstrating how the claims could be logically false. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **impossible** *(dict) --* Indicates that no valid claims can be made due to logical contradictions in the premises or rules. * **translation** *(dict) --* The logical translation of the input that this finding evaluates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **contradictingRules** *(list) --* The automated reasoning policy rules that contradict the claims and/or premises in the input. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **translationAmbiguous** *(dict) --* Indicates that the input has multiple valid logical interpretations, requiring additional context or clarification. * **options** *(list) --* Different logical interpretations that were detected during translation of the input. * *(dict) --* Represents one possible logical interpretation of ambiguous input content. * **translations** *(list) --* Example translations that provide this possible interpretation of the input. * *(dict) --* Contains the logical translation of natural language input into formal logical statements, including premises, claims, and confidence scores. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **differenceScenarios** *(list) --* Scenarios showing how the different translation options differ in meaning. * *(dict) --* Represents a logical scenario where claims can be evaluated as true or false, containing specific logical assignments. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **tooComplex** *(dict) --* Indicates that the input exceeds the processing capacity due to the volume or complexity of the logical information. * **noTranslations** *(dict) --* Indicates that no relevant logical information could be extracted from the input for validation. * **invocationMetrics** *(dict) --* The invocation metrics for the guardrail assessment. * **guardrailProcessingLatency** *(integer) --* The processing latency details for the guardrail invocation metrics. * **usage** *(dict) --* The usage details for the guardrail invocation metrics. * **topicPolicyUnits** *(integer) --* The topic policy units processed by the guardrail. * **contentPolicyUnits** *(integer) --* The content policy units processed by the guardrail. * **wordPolicyUnits** *(integer) --* The word policy units processed by the guardrail. * **sensitiveInformationPolicyUnits** *(integer) --* The sensitive information policy units processed by the guardrail. * **sensitiveInformationPolicyFreeUnits** *(integer) --* The sensitive information policy free units processed by the guardrail. * **contextualGroundingPolicyUnits** *(integer) --* The contextual grounding policy units processed by the guardrail. * **contentPolicyImageUnits** *(integer) --* The content policy image units processed by the guardrail. * **automatedReasoningPolicyUnits** *(integer) --* The number of text units processed by the automated reasoning policy. * **automatedReasoningPolicies** *(integer) --* The number of automated reasoning policies that were processed during the guardrail evaluation. * **guardrailCoverage** *(dict) --* The coverage details for the guardrail invocation metrics. * **textCharacters** *(dict) --* The text characters of the guardrail coverage details. * **guarded** *(integer) --* The text characters that were guarded by the guardrail coverage. * **total** *(integer) --* The total text characters by the guardrail coverage. * **images** *(dict) --* The guardrail coverage for images (the number of images that guardrails guarded). * **guarded** *(integer) --* The count (integer) of images guardrails guarded. * **total** *(integer) --* Represents the total number of images (integer) that were in the request (guarded and unguarded). * **actionReason** *(string) --* Provides the reason for the action taken when harmful content is detected. * **promptRouter** *(dict) --* The request's prompt router. * **invokedModelId** *(string) --* The ID of the invoked model. * **performanceConfig** *(dict) --* Model performance configuration metadata for the conversation stream event. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". * **internalServerException** *(dict) --* An internal server error occurred. Retry your request. * **message** *(string) --* * **modelStreamErrorException** *(dict) --* A streaming error occurred. Retry your request. * **message** *(string) --* * **originalStatusCode** *(integer) --* The original status code. * **originalMessage** *(string) --* The original message. * **validationException** *(dict) --* The input fails to satisfy the constraints specified by *Amazon Bedrock*. For troubleshooting this error, see ValidationError in the Amazon Bedrock User Guide * **message** *(string) --* * **throttlingException** *(dict) --* Your request was denied due to exceeding the account quotas for *Amazon Bedrock*. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User Guide * **message** *(string) --* * **serviceUnavailableException** *(dict) --* The service isn't currently available. For troubleshooting this error, see ServiceUnavailable in the Amazon Bedrock User Guide * **message** *(string) --* **Exceptions** * "BedrockRuntime.Client.exceptions.AccessDeniedException" * "BedrockRuntime.Client.exceptions.ThrottlingException" * "BedrockRuntime.Client.exceptions.ResourceNotFoundException" * "BedrockRuntime.Client.exceptions.ModelTimeoutException" * "BedrockRuntime.Client.exceptions.InternalServerException" * "BedrockRuntime.Client.exceptions.ServiceUnavailableException" * "BedrockRuntime.Client.exceptions.ValidationException" * "BedrockRuntime.Client.exceptions.ModelNotReadyException" * "BedrockRuntime.Client.exceptions.ModelErrorException" BedrockRuntime / Client / apply_guardrail apply_guardrail *************** BedrockRuntime.Client.apply_guardrail(**kwargs) The action to apply a guardrail. For troubleshooting some of the common errors you might encounter when using the "ApplyGuardrail" API, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide See also: AWS API Documentation **Request Syntax** response = client.apply_guardrail( guardrailIdentifier='string', guardrailVersion='string', source='INPUT'|'OUTPUT', content=[ { 'text': { 'text': 'string', 'qualifiers': [ 'grounding_source'|'query'|'guard_content', ] }, 'image': { 'format': 'png'|'jpeg', 'source': { 'bytes': b'bytes' } } }, ], outputScope='INTERVENTIONS'|'FULL' ) Parameters: * **guardrailIdentifier** (*string*) -- **[REQUIRED]** The guardrail identifier used in the request to apply the guardrail. * **guardrailVersion** (*string*) -- **[REQUIRED]** The guardrail version used in the request to apply the guardrail. * **source** (*string*) -- **[REQUIRED]** The source of data used in the request to apply the guardrail. * **content** (*list*) -- **[REQUIRED]** The content details used in the request to apply the guardrail. * *(dict) --* The content block to be evaluated by the guardrail. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text", "image". * **text** *(dict) --* Text within content block to be evaluated by the guardrail. * **text** *(string) --* **[REQUIRED]** The input text details to be evaluated by the guardrail. * **qualifiers** *(list) --* The qualifiers describing the text block. * *(string) --* * **image** *(dict) --* Image within guardrail content block to be evaluated by the guardrail. * **format** *(string) --* **[REQUIRED]** The format details for the file type of the image blocked by the guardrail. * **source** *(dict) --* **[REQUIRED]** The image source (image bytes) details of the image blocked by the guardrail. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "bytes". * **bytes** *(bytes) --* The bytes details of the guardrail image source. Object used in independent api. * **outputScope** (*string*) -- 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. Note that the full output scope doesn't apply to word filters or regex in sensitive information filters. It does apply to all other filtering policies, including sensitive information with filters that can detect personally identifiable information (PII). Return type: dict Returns: **Response Syntax** { 'usage': { 'topicPolicyUnits': 123, 'contentPolicyUnits': 123, 'wordPolicyUnits': 123, 'sensitiveInformationPolicyUnits': 123, 'sensitiveInformationPolicyFreeUnits': 123, 'contextualGroundingPolicyUnits': 123, 'contentPolicyImageUnits': 123, 'automatedReasoningPolicyUnits': 123, 'automatedReasoningPolicies': 123 }, 'action': 'NONE'|'GUARDRAIL_INTERVENED', 'actionReason': 'string', 'outputs': [ { 'text': 'string' }, ], 'assessments': [ { 'topicPolicy': { 'topics': [ { 'name': 'string', 'type': 'DENY', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'contentPolicy': { 'filters': [ { 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'filterStrength': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'wordPolicy': { 'customWords': [ { 'match': 'string', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ], 'managedWordLists': [ { 'match': 'string', 'type': 'PROFANITY', 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'match': 'string', 'type': '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', 'action': 'ANONYMIZED'|'BLOCKED'|'NONE', 'detected': True|False }, ], 'regexes': [ { 'name': 'string', 'match': 'string', 'regex': 'string', 'action': 'ANONYMIZED'|'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'contextualGroundingPolicy': { 'filters': [ { 'type': 'GROUNDING'|'RELEVANCE', 'threshold': 123.0, 'score': 123.0, 'action': 'BLOCKED'|'NONE', 'detected': True|False }, ] }, 'automatedReasoningPolicy': { 'findings': [ { 'valid': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'claimsTrueScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'supportingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'invalid': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'contradictingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'satisfiable': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'claimsTrueScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'claimsFalseScenario': { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'impossible': { 'translation': { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, 'contradictingRules': [ { 'identifier': 'string', 'policyVersionArn': 'string' }, ], 'logicWarning': { 'type': 'ALWAYS_FALSE'|'ALWAYS_TRUE', 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] } }, 'translationAmbiguous': { 'options': [ { 'translations': [ { 'premises': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'claims': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ], 'untranslatedPremises': [ { 'text': 'string' }, ], 'untranslatedClaims': [ { 'text': 'string' }, ], 'confidence': 123.0 }, ] }, ], 'differenceScenarios': [ { 'statements': [ { 'logic': 'string', 'naturalLanguage': 'string' }, ] }, ] }, 'tooComplex': {}, 'noTranslations': {} }, ] }, 'invocationMetrics': { 'guardrailProcessingLatency': 123, 'usage': { 'topicPolicyUnits': 123, 'contentPolicyUnits': 123, 'wordPolicyUnits': 123, 'sensitiveInformationPolicyUnits': 123, 'sensitiveInformationPolicyFreeUnits': 123, 'contextualGroundingPolicyUnits': 123, 'contentPolicyImageUnits': 123, 'automatedReasoningPolicyUnits': 123, 'automatedReasoningPolicies': 123 }, 'guardrailCoverage': { 'textCharacters': { 'guarded': 123, 'total': 123 }, 'images': { 'guarded': 123, 'total': 123 } } } }, ], 'guardrailCoverage': { 'textCharacters': { 'guarded': 123, 'total': 123 }, 'images': { 'guarded': 123, 'total': 123 } } } **Response Structure** * *(dict) --* * **usage** *(dict) --* The usage details in the response from the guardrail. * **topicPolicyUnits** *(integer) --* The topic policy units processed by the guardrail. * **contentPolicyUnits** *(integer) --* The content policy units processed by the guardrail. * **wordPolicyUnits** *(integer) --* The word policy units processed by the guardrail. * **sensitiveInformationPolicyUnits** *(integer) --* The sensitive information policy units processed by the guardrail. * **sensitiveInformationPolicyFreeUnits** *(integer) --* The sensitive information policy free units processed by the guardrail. * **contextualGroundingPolicyUnits** *(integer) --* The contextual grounding policy units processed by the guardrail. * **contentPolicyImageUnits** *(integer) --* The content policy image units processed by the guardrail. * **automatedReasoningPolicyUnits** *(integer) --* The number of text units processed by the automated reasoning policy. * **automatedReasoningPolicies** *(integer) --* The number of automated reasoning policies that were processed during the guardrail evaluation. * **action** *(string) --* The action taken in the response from the guardrail. * **actionReason** *(string) --* The reason for the action taken when harmful content is detected. * **outputs** *(list) --* The output details in the response from the guardrail. * *(dict) --* The output content produced by the guardrail. * **text** *(string) --* The specific text for the output content produced by the guardrail. * **assessments** *(list) --* The assessment details in the response from the guardrail. * *(dict) --* A behavior assessment of the guardrail policies used in a call to the Converse API. * **topicPolicy** *(dict) --* The topic policy. * **topics** *(list) --* The topics in the assessment. * *(dict) --* Information about a topic guardrail. * **name** *(string) --* The name for the guardrail. * **type** *(string) --* The type behavior that the guardrail should perform when the model detects the topic. * **action** *(string) --* The action the guardrail should take when it intervenes on a topic. * **detected** *(boolean) --* Indicates whether topic content that breaches the guardrail configuration is detected. * **contentPolicy** *(dict) --* The content policy. * **filters** *(list) --* The content policy filters. * *(dict) --* The content filter for a guardrail. * **type** *(string) --* The guardrail type. * **confidence** *(string) --* The guardrail confidence. * **filterStrength** *(string) --* The filter strength setting for the guardrail content filter. * **action** *(string) --* The guardrail action. * **detected** *(boolean) --* Indicates whether content that breaches the guardrail configuration is detected. * **wordPolicy** *(dict) --* The word policy. * **customWords** *(list) --* Custom words in the assessment. * *(dict) --* A custom word configured in a guardrail. * **match** *(string) --* The match for the custom word. * **action** *(string) --* The action for the custom word. * **detected** *(boolean) --* Indicates whether custom word content that breaches the guardrail configuration is detected. * **managedWordLists** *(list) --* Managed word lists in the assessment. * *(dict) --* A managed word configured in a guardrail. * **match** *(string) --* The match for the managed word. * **type** *(string) --* The type for the managed word. * **action** *(string) --* The action for the managed word. * **detected** *(boolean) --* Indicates whether managed word content that breaches the guardrail configuration is detected. * **sensitiveInformationPolicy** *(dict) --* The sensitive information policy. * **piiEntities** *(list) --* The PII entities in the assessment. * *(dict) --* A Personally Identifiable Information (PII) entity configured in a guardrail. * **match** *(string) --* The PII entity filter match. * **type** *(string) --* The PII entity filter type. * **action** *(string) --* The PII entity filter action. * **detected** *(boolean) --* Indicates whether personally identifiable information (PII) that breaches the guardrail configuration is detected. * **regexes** *(list) --* The regex queries in the assessment. * *(dict) --* A Regex filter configured in a guardrail. * **name** *(string) --* The regex filter name. * **match** *(string) --* The regesx filter match. * **regex** *(string) --* The regex query. * **action** *(string) --* The region filter action. * **detected** *(boolean) --* Indicates whether custom regex entities that breach the guardrail configuration are detected. * **contextualGroundingPolicy** *(dict) --* The contextual grounding policy used for the guardrail assessment. * **filters** *(list) --* The filter details for the guardrails contextual grounding filter. * *(dict) --* The details for the guardrails contextual grounding filter. * **type** *(string) --* 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** *(string) --* The action performed by the guardrails contextual grounding filter. * **detected** *(boolean) --* Indicates whether content that fails the contextual grounding evaluation (grounding or relevance score less than the corresponding threshold) was detected. * **automatedReasoningPolicy** *(dict) --* The automated reasoning policy assessment results, including logical validation findings for the input content. * **findings** *(list) --* List of logical validation results produced by evaluating the input content against automated reasoning policies. * *(dict) --* 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. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "valid", "invalid", "satisfiable", "impossible", "translationAmbiguous", "tooComplex", "noTranslations". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **valid** *(dict) --* Indicates that the claims are definitively true and logically implied by the premises, with no possible alternative interpretations. * **translation** *(dict) --* The logical translation of the input that this finding validates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **claimsTrueScenario** *(dict) --* An example scenario demonstrating how the claims are logically true. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **supportingRules** *(list) --* The automated reasoning policy rules that support why this result is considered valid. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **invalid** *(dict) --* Indicates that the claims are logically false and contradictory to the established rules or premises. * **translation** *(dict) --* The logical translation of the input that this finding invalidates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **contradictingRules** *(list) --* The automated reasoning policy rules that contradict the claims in the input. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **satisfiable** *(dict) --* Indicates that the claims could be either true or false depending on additional assumptions not provided in the input. * **translation** *(dict) --* The logical translation of the input that this finding evaluates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **claimsTrueScenario** *(dict) --* An example scenario demonstrating how the claims could be logically true. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claimsFalseScenario** *(dict) --* An example scenario demonstrating how the claims could be logically false. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **impossible** *(dict) --* Indicates that no valid claims can be made due to logical contradictions in the premises or rules. * **translation** *(dict) --* The logical translation of the input that this finding evaluates. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **contradictingRules** *(list) --* The automated reasoning policy rules that contradict the claims and/or premises in the input. * *(dict) --* References a specific automated reasoning policy rule that was applied during evaluation. * **identifier** *(string) --* The unique identifier of the automated reasoning rule. * **policyVersionArn** *(string) --* The ARN of the automated reasoning policy version that contains this rule. * **logicWarning** *(dict) --* Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules. * **type** *(string) --* The category of the detected logical issue, such as statements that are always true or always false. * **premises** *(list) --* The logical statements that serve as premises under which the claims are validated. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are validated while assuming the policy and premises. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **translationAmbiguous** *(dict) --* Indicates that the input has multiple valid logical interpretations, requiring additional context or clarification. * **options** *(list) --* Different logical interpretations that were detected during translation of the input. * *(dict) --* Represents one possible logical interpretation of ambiguous input content. * **translations** *(list) --* Example translations that provide this possible interpretation of the input. * *(dict) --* Contains the logical translation of natural language input into formal logical statements, including premises, claims, and confidence scores. * **premises** *(list) --* The logical statements that serve as the foundation or assumptions for the claims. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **claims** *(list) --* The logical statements that are being validated against the premises and policy rules. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **untranslatedPremises** *(list) --* References to portions of the original input text that correspond to the premises but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **untranslatedClaims** *(list) --* References to portions of the original input text that correspond to the claims but could not be fully translated. * *(dict) --* References a portion of the original input text that corresponds to logical elements. * **text** *(string) --* The specific text from the original input that this reference points to. * **confidence** *(float) --* A confidence score between 0 and 1 indicating how certain the system is about the logical translation. * **differenceScenarios** *(list) --* Scenarios showing how the different translation options differ in meaning. * *(dict) --* Represents a logical scenario where claims can be evaluated as true or false, containing specific logical assignments. * **statements** *(list) --* List of logical assignments and statements that define this scenario. * *(dict) --* A logical statement that includes both formal logic representation and natural language explanation. * **logic** *(string) --* The formal logical representation of the statement. * **naturalLanguage** *(string) --* The natural language explanation of the logical statement. * **tooComplex** *(dict) --* Indicates that the input exceeds the processing capacity due to the volume or complexity of the logical information. * **noTranslations** *(dict) --* Indicates that no relevant logical information could be extracted from the input for validation. * **invocationMetrics** *(dict) --* The invocation metrics for the guardrail assessment. * **guardrailProcessingLatency** *(integer) --* The processing latency details for the guardrail invocation metrics. * **usage** *(dict) --* The usage details for the guardrail invocation metrics. * **topicPolicyUnits** *(integer) --* The topic policy units processed by the guardrail. * **contentPolicyUnits** *(integer) --* The content policy units processed by the guardrail. * **wordPolicyUnits** *(integer) --* The word policy units processed by the guardrail. * **sensitiveInformationPolicyUnits** *(integer) --* The sensitive information policy units processed by the guardrail. * **sensitiveInformationPolicyFreeUnits** *(integer) --* The sensitive information policy free units processed by the guardrail. * **contextualGroundingPolicyUnits** *(integer) --* The contextual grounding policy units processed by the guardrail. * **contentPolicyImageUnits** *(integer) --* The content policy image units processed by the guardrail. * **automatedReasoningPolicyUnits** *(integer) --* The number of text units processed by the automated reasoning policy. * **automatedReasoningPolicies** *(integer) --* The number of automated reasoning policies that were processed during the guardrail evaluation. * **guardrailCoverage** *(dict) --* The coverage details for the guardrail invocation metrics. * **textCharacters** *(dict) --* The text characters of the guardrail coverage details. * **guarded** *(integer) --* The text characters that were guarded by the guardrail coverage. * **total** *(integer) --* The total text characters by the guardrail coverage. * **images** *(dict) --* The guardrail coverage for images (the number of images that guardrails guarded). * **guarded** *(integer) --* The count (integer) of images guardrails guarded. * **total** *(integer) --* Represents the total number of images (integer) that were in the request (guarded and unguarded). * **guardrailCoverage** *(dict) --* The guardrail coverage details in the apply guardrail response. * **textCharacters** *(dict) --* The text characters of the guardrail coverage details. * **guarded** *(integer) --* The text characters that were guarded by the guardrail coverage. * **total** *(integer) --* The total text characters by the guardrail coverage. * **images** *(dict) --* The guardrail coverage for images (the number of images that guardrails guarded). * **guarded** *(integer) --* The count (integer) of images guardrails guarded. * **total** *(integer) --* Represents the total number of images (integer) that were in the request (guarded and unguarded). **Exceptions** * "BedrockRuntime.Client.exceptions.AccessDeniedException" * "BedrockRuntime.Client.exceptions.ResourceNotFoundException" * "BedrockRuntime.Client.exceptions.ThrottlingException" * "BedrockRuntime.Client.exceptions.InternalServerException" * "BedrockRuntime.Client.exceptions.ValidationException" * "BedrockRuntime.Client.exceptions.ServiceQuotaExceededException" BedrockRuntime / Client / list_async_invokes list_async_invokes ****************** BedrockRuntime.Client.list_async_invokes(**kwargs) Lists asynchronous invocations. See also: AWS API Documentation **Request Syntax** response = client.list_async_invokes( submitTimeAfter=datetime(2015, 1, 1), submitTimeBefore=datetime(2015, 1, 1), statusEquals='InProgress'|'Completed'|'Failed', maxResults=123, nextToken='string', sortBy='SubmissionTime', sortOrder='Ascending'|'Descending' ) Parameters: * **submitTimeAfter** (*datetime*) -- Include invocations submitted after this time. * **submitTimeBefore** (*datetime*) -- Include invocations submitted before this time. * **statusEquals** (*string*) -- Filter invocations by status. * **maxResults** (*integer*) -- The maximum number of invocations to return in one page of results. * **nextToken** (*string*) -- Specify the pagination token from a previous request to retrieve the next page of results. * **sortBy** (*string*) -- How to sort the response. * **sortOrder** (*string*) -- The sorting order for the response. Return type: dict Returns: **Response Syntax** { 'nextToken': 'string', 'asyncInvokeSummaries': [ { 'invocationArn': 'string', 'modelArn': 'string', 'clientRequestToken': 'string', 'status': 'InProgress'|'Completed'|'Failed', 'failureMessage': 'string', 'submitTime': datetime(2015, 1, 1), 'lastModifiedTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'outputDataConfig': { 's3OutputDataConfig': { 's3Uri': 'string', 'kmsKeyId': 'string', 'bucketOwner': 'string' } } }, ] } **Response Structure** * *(dict) --* * **nextToken** *(string) --* Specify the pagination token from a previous request to retrieve the next page of results. * **asyncInvokeSummaries** *(list) --* A list of invocation summaries. * *(dict) --* A summary of an asynchronous invocation. * **invocationArn** *(string) --* The invocation's ARN. * **modelArn** *(string) --* The invoked model's ARN. * **clientRequestToken** *(string) --* The invocation's idempotency token. * **status** *(string) --* The invocation's status. * **failureMessage** *(string) --* An error message. * **submitTime** *(datetime) --* When the invocation was submitted. * **lastModifiedTime** *(datetime) --* When the invocation was last modified. * **endTime** *(datetime) --* When the invocation ended. * **outputDataConfig** *(dict) --* The invocation's output data settings. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "s3OutputDataConfig". If a client receives an unknown member it will set "SDK_UNKNOWN_MEMBER" as the top level key, which maps to the name or tag of the unknown member. The structure of "SDK_UNKNOWN_MEMBER" is as follows: 'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'} * **s3OutputDataConfig** *(dict) --* A storage location for the output data in an S3 bucket * **s3Uri** *(string) --* An object URI starting with "s3://". * **kmsKeyId** *(string) --* A KMS encryption key ID. * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. **Exceptions** * "BedrockRuntime.Client.exceptions.AccessDeniedException" * "BedrockRuntime.Client.exceptions.ThrottlingException" * "BedrockRuntime.Client.exceptions.InternalServerException" * "BedrockRuntime.Client.exceptions.ValidationException" BedrockRuntime / Client / close close ***** BedrockRuntime.Client.close() Closes underlying endpoint connections. BedrockRuntime / Client / invoke_model invoke_model ************ BedrockRuntime.Client.invoke_model(**kwargs) 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. For example code, see *Invoke model code examples* in the *Amazon Bedrock User Guide*. This operation requires permission for the "bedrock:InvokeModel" action. Warning: To deny all inference access to resources that you specify in the modelId field, you need to deny access to the "bedrock:InvokeModel" and "bedrock:InvokeModelWithResponseStream" actions. Doing this also denies access to the resource through the Converse API actions ( Converse and ConverseStream). For more information see Deny access for inference on specific models. For troubleshooting some of the common errors you might encounter when using the "InvokeModel" API, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide See also: AWS API Documentation **Request Syntax** response = client.invoke_model( body=b'bytes'|file, contentType='string', accept='string', modelId='string', trace='ENABLED'|'DISABLED'|'ENABLED_FULL', guardrailIdentifier='string', guardrailVersion='string', performanceConfigLatency='standard'|'optimized' ) Parameters: * **body** (*bytes** or **seekable file-like object*) -- 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. For more information, see Run inference in the Bedrock User Guide. * **contentType** (*string*) -- The MIME type of the input data in the request. You must specify "application/json". * **accept** (*string*) -- The desired MIME type of the inference body in the response. The default value is "application/json". * **modelId** (*string*) -- **[REQUIRED]** The unique identifier of the model to invoke to run inference. The "modelId" to provide depends on the type of model or throughput that you use: * If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see Amazon Bedrock base model IDs (on-demand throughput) in the Amazon Bedrock User Guide. * If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see Supported Regions and models for cross-region inference in the Amazon Bedrock User Guide. * If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see Run inference using a Provisioned Throughput in the Amazon Bedrock User Guide. * If you use a custom model, specify the ARN of the custom model deployment (for on-demand inference) or the ARN of your provisioned model (for Provisioned Throughput). For more information, see Use a custom model in Amazon Bedrock in the Amazon Bedrock User Guide. * If you use an imported model, specify the ARN of the imported model. You can get the model ARN from a successful call to CreateModelImportJob or from the Imported models page in the Amazon Bedrock console. * **trace** (*string*) -- Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace. * **guardrailIdentifier** (*string*) -- 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. An error will be thrown in the following situations. * You don't provide a guardrail identifier but you specify the "amazon-bedrock-guardrailConfig" field in the request body. * You enable the guardrail but the "contentType" isn't "application/json". * You provide a guardrail identifier, but "guardrailVersion" isn't specified. * **guardrailVersion** (*string*) -- The version number for the guardrail. The value can also be "DRAFT". * **performanceConfigLatency** (*string*) -- Model performance settings for the request. Return type: dict Returns: **Response Syntax** { 'body': StreamingBody(), 'contentType': 'string', 'performanceConfigLatency': 'standard'|'optimized' } **Response Structure** * *(dict) --* * **body** ("StreamingBody") -- 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. * **contentType** *(string) --* The MIME type of the inference result. * **performanceConfigLatency** *(string) --* Model performance settings for the request. **Exceptions** * "BedrockRuntime.Client.exceptions.AccessDeniedException" * "BedrockRuntime.Client.exceptions.ResourceNotFoundException" * "BedrockRuntime.Client.exceptions.ThrottlingException" * "BedrockRuntime.Client.exceptions.ModelTimeoutException" * "BedrockRuntime.Client.exceptions.InternalServerException" * "BedrockRuntime.Client.exceptions.ServiceUnavailableException" * "BedrockRuntime.Client.exceptions.ValidationException" * "BedrockRuntime.Client.exceptions.ServiceQuotaExceededException" * "BedrockRuntime.Client.exceptions.ModelNotReadyException" * "BedrockRuntime.Client.exceptions.ModelErrorException" BedrockRuntime / Client / start_async_invoke start_async_invoke ****************** BedrockRuntime.Client.start_async_invoke(**kwargs) Starts an asynchronous invocation. This operation requires permission for the "bedrock:InvokeModel" action. Warning: To deny all inference access to resources that you specify in the modelId field, you need to deny access to the "bedrock:InvokeModel" and "bedrock:InvokeModelWithResponseStream" actions. Doing this also denies access to the resource through the Converse API actions ( Converse and ConverseStream). For more information see Deny access for inference on specific models. See also: AWS API Documentation **Request Syntax** response = client.start_async_invoke( clientRequestToken='string', modelId='string', modelInput={...}|[...]|123|123.4|'string'|True|None, outputDataConfig={ 's3OutputDataConfig': { 's3Uri': 'string', 'kmsKeyId': 'string', 'bucketOwner': 'string' } }, tags=[ { 'key': 'string', 'value': 'string' }, ] ) Parameters: * **clientRequestToken** (*string*) -- Specify idempotency token to ensure that requests are not duplicated. This field is autopopulated if not provided. * **modelId** (*string*) -- **[REQUIRED]** The model to invoke. * **modelInput** (*document*) -- **[REQUIRED]** Input to send to the model. * **outputDataConfig** (*dict*) -- **[REQUIRED]** Where to store the output. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "s3OutputDataConfig". * **s3OutputDataConfig** *(dict) --* A storage location for the output data in an S3 bucket * **s3Uri** *(string) --* **[REQUIRED]** An object URI starting with "s3://". * **kmsKeyId** *(string) --* A KMS encryption key ID. * **bucketOwner** *(string) --* If the bucket belongs to another AWS account, specify that account's ID. * **tags** (*list*) -- Tags to apply to the invocation. * *(dict) --* A tag. * **key** *(string) --* **[REQUIRED]** The tag's key. * **value** *(string) --* **[REQUIRED]** The tag's value. Return type: dict Returns: **Response Syntax** { 'invocationArn': 'string' } **Response Structure** * *(dict) --* * **invocationArn** *(string) --* The ARN of the invocation. **Exceptions** * "BedrockRuntime.Client.exceptions.AccessDeniedException" * "BedrockRuntime.Client.exceptions.ThrottlingException" * "BedrockRuntime.Client.exceptions.ResourceNotFoundException" * "BedrockRuntime.Client.exceptions.InternalServerException" * "BedrockRuntime.Client.exceptions.ServiceUnavailableException" * "BedrockRuntime.Client.exceptions.ValidationException" * "BedrockRuntime.Client.exceptions.ServiceQuotaExceededException" * "BedrockRuntime.Client.exceptions.ConflictException"