AgentsforBedrockRuntime *********************** Client ====== class AgentsforBedrockRuntime.Client A low-level client representing Agents for Amazon Bedrock Runtime Contains APIs related to model invocation and querying of knowledge bases. import boto3 client = boto3.client('bedrock-agent-runtime') These are the available methods: * can_paginate * close * create_invocation * create_session * delete_agent_memory * delete_session * end_session * generate_query * get_agent_memory * get_execution_flow_snapshot * get_flow_execution * get_invocation_step * get_paginator * get_session * get_waiter * invoke_agent * invoke_flow * invoke_inline_agent * list_flow_execution_events * list_flow_executions * list_invocation_steps * list_invocations * list_sessions * list_tags_for_resource * optimize_prompt * put_invocation_step * rerank * retrieve * retrieve_and_generate * retrieve_and_generate_stream * start_flow_execution * stop_flow_execution * tag_resource * untag_resource * update_session 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: * GetAgentMemory * ListFlowExecutionEvents * ListFlowExecutions * ListInvocationSteps * ListInvocations * ListSessions * Rerank * Retrieve AgentsforBedrockRuntime / Paginator / ListSessions ListSessions ************ class AgentsforBedrockRuntime.Paginator.ListSessions paginator = client.get_paginator('list_sessions') paginate(**kwargs) Creates an iterator that will paginate through responses from "AgentsforBedrockRuntime.Client.list_sessions()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) Parameters: **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** { 'sessionSummaries': [ { 'createdAt': datetime(2015, 1, 1), 'lastUpdatedAt': datetime(2015, 1, 1), 'sessionArn': 'string', 'sessionId': 'string', 'sessionStatus': 'ACTIVE'|'EXPIRED'|'ENDED' }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **sessionSummaries** *(list) --* A list of summaries for each session in your Amazon Web Services account. * *(dict) --* Contains details about a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. * **createdAt** *(datetime) --* The timestamp for when the session was created. * **lastUpdatedAt** *(datetime) --* The timestamp for when the session was last modified. * **sessionArn** *(string) --* The Amazon Resource Name (ARN) of the session. * **sessionId** *(string) --* The unique identifier for the session. * **sessionStatus** *(string) --* The current status of the session. * **NextToken** *(string) --* A token to resume pagination. AgentsforBedrockRuntime / Paginator / Rerank Rerank ****** class AgentsforBedrockRuntime.Paginator.Rerank paginator = client.get_paginator('rerank') paginate(**kwargs) Creates an iterator that will paginate through responses from "AgentsforBedrockRuntime.Client.rerank()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( queries=[ { 'textQuery': { 'text': 'string' }, 'type': 'TEXT' }, ], rerankingConfiguration={ 'bedrockRerankingConfiguration': { 'modelConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'modelArn': 'string' }, 'numberOfResults': 123 }, 'type': 'BEDROCK_RERANKING_MODEL' }, sources=[ { 'inlineDocumentSource': { 'jsonDocument': {...}|[...]|123|123.4|'string'|True|None, 'textDocument': { 'text': 'string' }, 'type': 'TEXT'|'JSON' }, 'type': 'INLINE' }, ], PaginationConfig={ 'MaxItems': 123, 'StartingToken': 'string' } ) Parameters: * **queries** (*list*) -- **[REQUIRED]** An array of objects, each of which contains information about a query to submit to the reranker model. * *(dict) --* Contains information about a query to submit to the reranker model. * **textQuery** *(dict) --* **[REQUIRED]** Contains information about a text query. * **text** *(string) --* The text of the document. * **type** *(string) --* **[REQUIRED]** The type of the query. * **rerankingConfiguration** (*dict*) -- **[REQUIRED]** Contains configurations for reranking. * **bedrockRerankingConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for an Amazon Bedrock reranker. * **modelConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for a reranker model. * **additionalModelRequestFields** *(dict) --* A JSON object whose keys are request fields for the model and whose values are values for those fields. * *(string) --* * (*document*) -- * **modelArn** *(string) --* **[REQUIRED]** The ARN of the reranker model. * **numberOfResults** *(integer) --* The number of results to return after reranking. * **type** *(string) --* **[REQUIRED]** The type of reranker that the configurations apply to. * **sources** (*list*) -- **[REQUIRED]** An array of objects, each of which contains information about the sources to rerank. * *(dict) --* Contains information about a source for reranking. * **inlineDocumentSource** *(dict) --* **[REQUIRED]** Contains an inline definition of a source for reranking. * **jsonDocument** (*document*) -- Contains a JSON document to rerank. * **textDocument** *(dict) --* Contains information about a text document to rerank. * **text** *(string) --* The text of the document. * **type** *(string) --* **[REQUIRED]** The type of document to rerank. * **type** *(string) --* **[REQUIRED]** The type of the source. * **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. * **StartingToken** *(string) --* A token to specify where to start paginating. This is the "NextToken" from a previous response. Return type: dict Returns: **Response Syntax** { 'results': [ { 'document': { 'jsonDocument': {...}|[...]|123|123.4|'string'|True|None, 'textDocument': { 'text': 'string' }, 'type': 'TEXT'|'JSON' }, 'index': 123, 'relevanceScore': ... }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **results** *(list) --* An array of objects, each of which contains information about the results of reranking. * *(dict) --* Contains information about a document that was reranked. * **document** *(dict) --* Contains information about the document. * **jsonDocument** (*document*) -- Contains a JSON document to rerank. * **textDocument** *(dict) --* Contains information about a text document to rerank. * **text** *(string) --* The text of the document. * **type** *(string) --* The type of document to rerank. * **index** *(integer) --* The ranking of the document. The lower a number, the higher the document is ranked. * **relevanceScore** *(float) --* The relevance score of the document. * **NextToken** *(string) --* A token to resume pagination. AgentsforBedrockRuntime / Paginator / GetAgentMemory GetAgentMemory ************** class AgentsforBedrockRuntime.Paginator.GetAgentMemory paginator = client.get_paginator('get_agent_memory') paginate(**kwargs) Creates an iterator that will paginate through responses from "AgentsforBedrockRuntime.Client.get_agent_memory()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( agentAliasId='string', agentId='string', memoryId='string', memoryType='SESSION_SUMMARY', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) Parameters: * **agentAliasId** (*string*) -- **[REQUIRED]** The unique identifier of an alias of an agent. * **agentId** (*string*) -- **[REQUIRED]** The unique identifier of the agent to which the alias belongs. * **memoryId** (*string*) -- **[REQUIRED]** The unique identifier of the memory. * **memoryType** (*string*) -- **[REQUIRED]** The type of memory. * **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** { 'memoryContents': [ { 'sessionSummary': { 'memoryId': 'string', 'sessionExpiryTime': datetime(2015, 1, 1), 'sessionId': 'string', 'sessionStartTime': datetime(2015, 1, 1), 'summaryText': 'string' } }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **memoryContents** *(list) --* Contains details of the sessions stored in the memory * *(dict) --* Contains sessions summaries. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "sessionSummary". 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'} * **sessionSummary** *(dict) --* Contains summary of a session. * **memoryId** *(string) --* The unique identifier of the memory where the session summary is stored. * **sessionExpiryTime** *(datetime) --* The time when the memory duration for the session is set to end. * **sessionId** *(string) --* The identifier for this session. * **sessionStartTime** *(datetime) --* The start time for this session. * **summaryText** *(string) --* The summarized text for this session. * **NextToken** *(string) --* A token to resume pagination. AgentsforBedrockRuntime / Paginator / ListFlowExecutionEvents ListFlowExecutionEvents *********************** class AgentsforBedrockRuntime.Paginator.ListFlowExecutionEvents paginator = client.get_paginator('list_flow_execution_events') paginate(**kwargs) Creates an iterator that will paginate through responses from "AgentsforBedrockRuntime.Client.list_flow_execution_events()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( eventType='Node'|'Flow', executionIdentifier='string', flowAliasIdentifier='string', flowIdentifier='string', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) Parameters: * **eventType** (*string*) -- **[REQUIRED]** The type of events to retrieve. Specify "Node" for node- level events or "Flow" for flow-level events. * **executionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow execution. * **flowAliasIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow alias used for the execution. * **flowIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow. * **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** { 'flowExecutionEvents': [ { 'conditionResultEvent': { 'nodeName': 'string', 'satisfiedConditions': [ { 'conditionName': 'string' }, ], 'timestamp': datetime(2015, 1, 1) }, 'flowFailureEvent': { 'errorCode': 'VALIDATION'|'INTERNAL_SERVER'|'NODE_EXECUTION_FAILED', 'errorMessage': 'string', 'timestamp': datetime(2015, 1, 1) }, 'flowInputEvent': { 'fields': [ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'name': 'string' }, ], 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) }, 'flowOutputEvent': { 'fields': [ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'name': 'string' }, ], 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) }, 'nodeFailureEvent': { 'errorCode': 'VALIDATION'|'DEPENDENCY_FAILED'|'BAD_GATEWAY'|'INTERNAL_SERVER', 'errorMessage': 'string', 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) }, 'nodeInputEvent': { 'fields': [ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'name': 'string' }, ], 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) }, 'nodeOutputEvent': { 'fields': [ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'name': 'string' }, ], 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) } }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **flowExecutionEvents** *(list) --* A list of events that occurred during the flow execution. Events can include node inputs and outputs, flow inputs and outputs, condition results, and failure events. * *(dict) --* Represents an event that occurred during an flow execution. This is a union type that can contain one of several event types, such as node input and output events; flow input and output events; condition node result events, or failure events. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "conditionResultEvent", "flowFailureEvent", "flowInputEvent", "flowOutputEvent", "nodeFailureEvent", "nodeInputEvent", "nodeOutputEvent". 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'} * **conditionResultEvent** *(dict) --* Contains information about a condition evaluation result during the flow execution. This event is generated when a condition node in the flow evaluates its conditions. * **nodeName** *(string) --* The name of the condition node that evaluated the conditions. * **satisfiedConditions** *(list) --* A list of conditions that were satisfied during the evaluation. * *(dict) --* Represents a condition that was satisfied during a condition node evaluation in a flow execution. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **conditionName** *(string) --* The name of the condition that was satisfied. * **timestamp** *(datetime) --* The timestamp when the condition evaluation occurred. * **flowFailureEvent** *(dict) --* Contains information about a failure that occurred at the flow level during execution. * **errorCode** *(string) --* The error code that identifies the type of failure that occurred. * **errorMessage** *(string) --* A descriptive message that provides details about the failure. * **timestamp** *(datetime) --* The timestamp when the failure occurred. * **flowInputEvent** *(dict) --* Contains information about the inputs provided to the flow at the start of execution. * **fields** *(list) --* A list of input fields provided to the flow. * *(dict) --* Represents an input field provided to a flow during a flow execution. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **content** *(dict) --* The content of the input field, which can contain text or structured data. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The document content of the field, which can contain text or structured data. * **name** *(string) --* The name of the input field as defined in the flow's input schema. * **nodeName** *(string) --* The name of the node that receives the inputs. * **timestamp** *(datetime) --* The timestamp when the inputs are provided. * **flowOutputEvent** *(dict) --* Contains information about the outputs produced by the flow at the end of execution. * **fields** *(list) --* A list of output fields produced by the flow. * *(dict) --* Represents an output field produced by a flow during a flow execution. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **content** *(dict) --* The content of the output field, which can contain text or structured data. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The document content of the field, which can contain text or structured data. * **name** *(string) --* The name of the output field as defined in the flow's output schema. * **nodeName** *(string) --* The name of the node that produces the outputs. * **timestamp** *(datetime) --* The timestamp when the outputs are produced. * **nodeFailureEvent** *(dict) --* Contains information about a failure that occurred at a specific node during execution. * **errorCode** *(string) --* The error code that identifies the type of failure that occurred at the node. * **errorMessage** *(string) --* A descriptive message that provides details about the node failure. * **nodeName** *(string) --* The name of the node where the failure occurred. * **timestamp** *(datetime) --* The timestamp when the node failure occurred. * **nodeInputEvent** *(dict) --* Contains information about the inputs provided to a specific node during execution. * **fields** *(list) --* A list of input fields provided to the node. * *(dict) --* Represents an input field provided to a node during a flow execution. * **content** *(dict) --* The content of the input field, which can contain text or structured data. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The document content of the field, which can contain text or structured data. * **name** *(string) --* The name of the input field as defined in the node's input schema. * **nodeName** *(string) --* The name of the node that received the inputs. * **timestamp** *(datetime) --* The timestamp when the inputs were provided to the node. * **nodeOutputEvent** *(dict) --* Contains information about the outputs produced by a specific node during execution. * **fields** *(list) --* A list of output fields produced by the node. * *(dict) --* Represents an output field produced by a node during a flow execution. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **content** *(dict) --* The content of the output field, which can contain text or structured data. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The document content of the field, which can contain text or structured data. * **name** *(string) --* The name of the output field as defined in the node's output schema. * **nodeName** *(string) --* The name of the node that produced the outputs. * **timestamp** *(datetime) --* The timestamp when the outputs were produced by the node. * **NextToken** *(string) --* A token to resume pagination. AgentsforBedrockRuntime / Paginator / ListInvocations ListInvocations *************** class AgentsforBedrockRuntime.Paginator.ListInvocations paginator = client.get_paginator('list_invocations') paginate(**kwargs) Creates an iterator that will paginate through responses from "AgentsforBedrockRuntime.Client.list_invocations()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( sessionIdentifier='string', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) Parameters: * **sessionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier for the session to list invocations for. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). * **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** { 'invocationSummaries': [ { 'createdAt': datetime(2015, 1, 1), 'invocationId': 'string', 'sessionId': 'string' }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **invocationSummaries** *(list) --* A list of invocation summaries associated with the session. * *(dict) --* Contains details about an invocation in a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. * **createdAt** *(datetime) --* The timestamp for when the invocation was created. * **invocationId** *(string) --* A unique identifier for the invocation in UUID format. * **sessionId** *(string) --* The unique identifier for the session associated with the invocation. * **NextToken** *(string) --* A token to resume pagination. AgentsforBedrockRuntime / Paginator / ListFlowExecutions ListFlowExecutions ****************** class AgentsforBedrockRuntime.Paginator.ListFlowExecutions paginator = client.get_paginator('list_flow_executions') paginate(**kwargs) Creates an iterator that will paginate through responses from "AgentsforBedrockRuntime.Client.list_flow_executions()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( flowAliasIdentifier='string', flowIdentifier='string', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) Parameters: * **flowAliasIdentifier** (*string*) -- The unique identifier of the flow alias to list executions for. * **flowIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow to list executions for. * **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** { 'flowExecutionSummaries': [ { 'createdAt': datetime(2015, 1, 1), 'endedAt': datetime(2015, 1, 1), 'executionArn': 'string', 'flowAliasIdentifier': 'string', 'flowIdentifier': 'string', 'flowVersion': 'string', 'status': 'Running'|'Succeeded'|'Failed'|'TimedOut'|'Aborted' }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **flowExecutionSummaries** *(list) --* A list of flow execution summaries. Each summary includes the execution ARN, flow identifier, flow alias identifier, flow version, status, and timestamps. * *(dict) --* Contains summary information about a flow execution, including its status, timestamps, and identifiers. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **createdAt** *(datetime) --* The timestamp when the flow execution was created. * **endedAt** *(datetime) --* The timestamp when the flow execution ended. This field is only populated when the execution has completed, failed, timed out, or been aborted. * **executionArn** *(string) --* The Amazon Resource Name (ARN) that uniquely identifies the flow execution. * **flowAliasIdentifier** *(string) --* The unique identifier of the flow alias used for the execution. * **flowIdentifier** *(string) --* The unique identifier of the flow. * **flowVersion** *(string) --* The version of the flow used for the execution. * **status** *(string) --* The current status of the flow execution. Flow executions time out after 24 hours. * **NextToken** *(string) --* A token to resume pagination. AgentsforBedrockRuntime / Paginator / Retrieve Retrieve ******** class AgentsforBedrockRuntime.Paginator.Retrieve paginator = client.get_paginator('retrieve') paginate(**kwargs) Creates an iterator that will paginate through responses from "AgentsforBedrockRuntime.Client.retrieve()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( guardrailConfiguration={ 'guardrailId': 'string', 'guardrailVersion': 'string' }, knowledgeBaseId='string', retrievalConfiguration={ 'vectorSearchConfiguration': { 'filter': { 'andAll': [ {'... recursive ...'}, ], 'equals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'in': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'listContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notIn': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'orAll': [ {'... recursive ...'}, ], 'startsWith': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'stringContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None } }, 'implicitFilterConfiguration': { 'metadataAttributes': [ { 'description': 'string', 'key': 'string', 'type': 'STRING'|'NUMBER'|'BOOLEAN'|'STRING_LIST' }, ], 'modelArn': 'string' }, 'numberOfResults': 123, 'overrideSearchType': 'HYBRID'|'SEMANTIC', 'rerankingConfiguration': { 'bedrockRerankingConfiguration': { 'metadataConfiguration': { 'selectionMode': 'SELECTIVE'|'ALL', 'selectiveModeConfiguration': { 'fieldsToExclude': [ { 'fieldName': 'string' }, ], 'fieldsToInclude': [ { 'fieldName': 'string' }, ] } }, 'modelConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'modelArn': 'string' }, 'numberOfRerankedResults': 123 }, 'type': 'BEDROCK_RERANKING_MODEL' } } }, retrievalQuery={ 'text': 'string' }, PaginationConfig={ 'MaxItems': 123, 'StartingToken': 'string' } ) Parameters: * **guardrailConfiguration** (*dict*) -- Guardrail settings. * **guardrailId** *(string) --* **[REQUIRED]** The unique identifier for the guardrail. * **guardrailVersion** *(string) --* **[REQUIRED]** The version of the guardrail. * **knowledgeBaseId** (*string*) -- **[REQUIRED]** The unique identifier of the knowledge base to query. * **retrievalConfiguration** (*dict*) -- Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations. * **vectorSearchConfiguration** *(dict) --* **[REQUIRED]** Contains details about how the results from the vector search should be returned. For more information, see Query configurations. * **filter** *(dict) --* Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see Query configurations. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **andAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **equals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value matches the "value" in this object. The following example would return data sources with an "animal" attribute whose value is "cat": ""equals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than "1989": ""greaterThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than or equal to "1989": ""greaterThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **in** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is in the list specified in the "value" in this object. The following example would return data sources with an "animal" attribute that is either "cat" or "dog": ""in": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than to "1989". ""lessThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than or equal to "1989". ""lessThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **listContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is a list that contains the "value" as one of its members. The following example would return data sources with an "animals" attribute that is a list containing a "cat" member (for example "["dog", "cat"]"). ""listContains": { "key": "animals", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notEquals** *(dict) --* Knowledge base data sources are returned when: * It contains a metadata attribute whose name matches the "key" and whose value doesn't match the "value" in this object. * The key is not present in the document. The following example would return data sources that don't contain an "animal" attribute whose value is "cat". ""notEquals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notIn** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value isn't in the list specified in the "value" in this object. The following example would return data sources whose "animal" attribute is neither "cat" nor "dog". ""notIn": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **orAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **startsWith** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value starts with the "value" in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores. The following example would return data sources with an "animal" attribute starts with "ca" (for example, "cat" or "camel"). ""startsWith": { "key": "animal", "value": "ca" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **stringContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is one of the following: * A string that contains the "value" as a substring. The following example would return data sources with an "animal" attribute that contains the substring "at" (for example "cat"). ""stringContains": { "key": "animal", "value": "at" }" * A list with a member that contains the "value" as a substring. The following example would return data sources with an "animals" attribute that is a list containing a member that contains the substring "at" (for example "["dog", "cat"]"). ""stringContains": { "key": "animals", "value": "at" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **implicitFilterConfiguration** *(dict) --* Settings for implicit filtering. * **metadataAttributes** *(list) --* **[REQUIRED]** Metadata that can be used in a filter. * *(dict) --* Details about a metadata attribute. * **description** *(string) --* **[REQUIRED]** The attribute's description. * **key** *(string) --* **[REQUIRED]** The attribute's key. * **type** *(string) --* **[REQUIRED]** The attribute's type. * **modelArn** *(string) --* **[REQUIRED]** The model that generates the filter. * **numberOfResults** *(integer) --* The number of source chunks to retrieve. * **overrideSearchType** *(string) --* By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a "HYBRID" search using both vector embeddings and raw text, or "SEMANTIC" search using only vector embeddings. For other vector store configurations, only "SEMANTIC" search is available. For more information, see Test a knowledge base. * **rerankingConfiguration** *(dict) --* Contains configurations for reranking the retrieved results. For more information, see Improve the relevance of query responses with a reranker model. * **bedrockRerankingConfiguration** *(dict) --* Contains configurations for an Amazon Bedrock reranker model. * **metadataConfiguration** *(dict) --* Contains configurations for the metadata to use in reranking. * **selectionMode** *(string) --* **[REQUIRED]** Specifies whether to consider all metadata when reranking, or only the metadata that you select. If you specify "SELECTIVE", include the "selectiveModeConfiguration" field. * **selectiveModeConfiguration** *(dict) --* Contains configurations for the metadata fields to include or exclude when considering reranking. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "fieldsToExclude", "fieldsToInclude". * **fieldsToExclude** *(list) --* An array of objects, each of which specifies a metadata field to exclude from consideration when reranking. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **fieldsToInclude** *(list) --* An array of objects, each of which specifies a metadata field to include in consideration when reranking. The remaining metadata fields are ignored. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **modelConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for the reranker model. * **additionalModelRequestFields** *(dict) --* A JSON object whose keys are request fields for the model and whose values are values for those fields. * *(string) --* * (*document*) -- * **modelArn** *(string) --* **[REQUIRED]** The ARN of the reranker model to use. * **numberOfRerankedResults** *(integer) --* The number of results to return after reranking. * **type** *(string) --* **[REQUIRED]** The type of reranker model. * **retrievalQuery** (*dict*) -- **[REQUIRED]** Contains the query to send the knowledge base. * **text** *(string) --* **[REQUIRED]** The text of the query made to the knowledge base. * **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. * **StartingToken** *(string) --* A token to specify where to start paginating. This is the "NextToken" from a previous response. Return type: dict Returns: **Response Syntax** { 'guardrailAction': 'INTERVENED'|'NONE', 'retrievalResults': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'score': 123.0 }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **guardrailAction** *(string) --* Specifies if there is a guardrail intervention in the response. * **retrievalResults** *(list) --* A list of results from querying the knowledge base. * *(dict) --* Details about a result from querying the knowledge base. This data type is used in the following API operations: * Retrieve response – in the "retrievalResults" field * **content** *(dict) --* Contains information about the content of the chunk. * **byteContent** *(string) --* A data URI with base64-encoded content from the data source. The URI is in the following format: returned in the following format: "data:image/jpeg;base64,${base64-encoded string}". * **row** *(list) --* Specifies information about the rows with the cells to return in retrieval. * *(dict) --* Contains information about a column with a cell to return in retrieval. * **columnName** *(string) --* The name of the column. * **columnValue** *(string) --* The value in the column. * **type** *(string) --* The data type of the value. * **text** *(string) --* The cited text from the data source. * **type** *(string) --* The type of content in the retrieval result. * **location** *(dict) --* Contains information about the location of the data source. * **confluenceLocation** *(dict) --* The Confluence data source location. * **url** *(string) --* The Confluence host URL for the data source location. * **customDocumentLocation** *(dict) --* Specifies the location of a document in a custom data source. * **id** *(string) --* The ID of the document. * **kendraDocumentLocation** *(dict) --* The location of a document in Amazon Kendra. * **uri** *(string) --* The document's uri. * **s3Location** *(dict) --* The S3 data source location. * **uri** *(string) --* The S3 URI for the data source location. * **salesforceLocation** *(dict) --* The Salesforce data source location. * **url** *(string) --* The Salesforce host URL for the data source location. * **sharePointLocation** *(dict) --* The SharePoint data source location. * **url** *(string) --* The SharePoint site URL for the data source location. * **sqlLocation** *(dict) --* Specifies information about the SQL query used to retrieve the result. * **query** *(string) --* The SQL query used to retrieve the result. * **type** *(string) --* The type of data source location. * **webLocation** *(dict) --* The web URL/URLs data source location. * **url** *(string) --* The web URL/URLs for the data source location. * **metadata** *(dict) --* Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering. * *(string) --* * (*document*) -- * **score** *(float) --* The level of relevance of the result to the query. * **NextToken** *(string) --* A token to resume pagination. AgentsforBedrockRuntime / Paginator / ListInvocationSteps ListInvocationSteps ******************* class AgentsforBedrockRuntime.Paginator.ListInvocationSteps paginator = client.get_paginator('list_invocation_steps') paginate(**kwargs) Creates an iterator that will paginate through responses from "AgentsforBedrockRuntime.Client.list_invocation_steps()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( invocationIdentifier='string', sessionIdentifier='string', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) Parameters: * **invocationIdentifier** (*string*) -- The unique identifier (in UUID format) for the invocation to list invocation steps for. * **sessionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier for the session associated with the invocation steps. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). * **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** { 'invocationStepSummaries': [ { 'invocationId': 'string', 'invocationStepId': 'string', 'invocationStepTime': datetime(2015, 1, 1), 'sessionId': 'string' }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **invocationStepSummaries** *(list) --* A list of summaries for each invocation step associated with a session and if you specified it, an invocation within the session. * *(dict) --* Contains details about an invocation step within an invocation in a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. * **invocationId** *(string) --* A unique identifier for the invocation in UUID format. * **invocationStepId** *(string) --* The unique identifier (in UUID format) for the invocation step. * **invocationStepTime** *(datetime) --* The timestamp for when the invocation step was created. * **sessionId** *(string) --* The unique identifier for the session associated with the invocation step. * **NextToken** *(string) --* A token to resume pagination. AgentsforBedrockRuntime / Client / rerank rerank ****** AgentsforBedrockRuntime.Client.rerank(**kwargs) Reranks the relevance of sources based on queries. For more information, see Improve the relevance of query responses with a reranker model. See also: AWS API Documentation **Request Syntax** response = client.rerank( nextToken='string', queries=[ { 'textQuery': { 'text': 'string' }, 'type': 'TEXT' }, ], rerankingConfiguration={ 'bedrockRerankingConfiguration': { 'modelConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'modelArn': 'string' }, 'numberOfResults': 123 }, 'type': 'BEDROCK_RERANKING_MODEL' }, sources=[ { 'inlineDocumentSource': { 'jsonDocument': {...}|[...]|123|123.4|'string'|True|None, 'textDocument': { 'text': 'string' }, 'type': 'TEXT'|'JSON' }, 'type': 'INLINE' }, ] ) Parameters: * **nextToken** (*string*) -- If the total number of results was greater than could fit in a response, a token is returned in the "nextToken" field. You can enter that token in this field to return the next batch of results. * **queries** (*list*) -- **[REQUIRED]** An array of objects, each of which contains information about a query to submit to the reranker model. * *(dict) --* Contains information about a query to submit to the reranker model. * **textQuery** *(dict) --* **[REQUIRED]** Contains information about a text query. * **text** *(string) --* The text of the document. * **type** *(string) --* **[REQUIRED]** The type of the query. * **rerankingConfiguration** (*dict*) -- **[REQUIRED]** Contains configurations for reranking. * **bedrockRerankingConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for an Amazon Bedrock reranker. * **modelConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for a reranker model. * **additionalModelRequestFields** *(dict) --* A JSON object whose keys are request fields for the model and whose values are values for those fields. * *(string) --* * (*document*) -- * **modelArn** *(string) --* **[REQUIRED]** The ARN of the reranker model. * **numberOfResults** *(integer) --* The number of results to return after reranking. * **type** *(string) --* **[REQUIRED]** The type of reranker that the configurations apply to. * **sources** (*list*) -- **[REQUIRED]** An array of objects, each of which contains information about the sources to rerank. * *(dict) --* Contains information about a source for reranking. * **inlineDocumentSource** *(dict) --* **[REQUIRED]** Contains an inline definition of a source for reranking. * **jsonDocument** (*document*) -- Contains a JSON document to rerank. * **textDocument** *(dict) --* Contains information about a text document to rerank. * **text** *(string) --* The text of the document. * **type** *(string) --* **[REQUIRED]** The type of document to rerank. * **type** *(string) --* **[REQUIRED]** The type of the source. Return type: dict Returns: **Response Syntax** { 'nextToken': 'string', 'results': [ { 'document': { 'jsonDocument': {...}|[...]|123|123.4|'string'|True|None, 'textDocument': { 'text': 'string' }, 'type': 'TEXT'|'JSON' }, 'index': 123, 'relevanceScore': ... }, ] } **Response Structure** * *(dict) --* * **nextToken** *(string) --* If the total number of results is greater than can fit in the response, use this token in the "nextToken" field when making another request to return the next batch of results. * **results** *(list) --* An array of objects, each of which contains information about the results of reranking. * *(dict) --* Contains information about a document that was reranked. * **document** *(dict) --* Contains information about the document. * **jsonDocument** (*document*) -- Contains a JSON document to rerank. * **textDocument** *(dict) --* Contains information about a text document to rerank. * **text** *(string) --* The text of the document. * **type** *(string) --* The type of document to rerank. * **index** *(integer) --* The ranking of the document. The lower a number, the higher the document is ranked. * **relevanceScore** *(float) --* The relevance score of the document. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / get_paginator get_paginator ************* AgentsforBedrockRuntime.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. AgentsforBedrockRuntime / Client / optimize_prompt optimize_prompt *************** AgentsforBedrockRuntime.Client.optimize_prompt(**kwargs) Optimizes a prompt for the task that you specify. For more information, see Optimize a prompt in the Amazon Bedrock User Guide. See also: AWS API Documentation **Request Syntax** response = client.optimize_prompt( input={ 'textPrompt': { 'text': 'string' } }, targetModelId='string' ) Parameters: * **input** (*dict*) -- **[REQUIRED]** Contains the prompt to optimize. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "textPrompt". * **textPrompt** *(dict) --* Contains information about the text prompt to optimize. * **text** *(string) --* **[REQUIRED]** The text in the text prompt to optimize. * **targetModelId** (*string*) -- **[REQUIRED]** The unique identifier of the model that you want to optimize the prompt for. 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** { 'optimizedPrompt': EventStream({ 'accessDeniedException': { 'message': 'string' }, 'analyzePromptEvent': { 'message': 'string' }, 'badGatewayException': { 'message': 'string', 'resourceName': 'string' }, 'dependencyFailedException': { 'message': 'string', 'resourceName': 'string' }, 'internalServerException': { 'message': 'string', 'reason': 'string' }, 'optimizedPromptEvent': { 'optimizedPrompt': { 'textPrompt': { 'text': 'string' } } }, 'throttlingException': { 'message': 'string' }, 'validationException': { 'message': 'string' } }) } **Response Structure** * *(dict) --* * **optimizedPrompt** ("EventStream") -- The prompt after being optimized for the task. * **accessDeniedException** *(dict) --* The request is denied because of missing access permissions. Check your permissions and retry your request. * **message** *(string) --* * **analyzePromptEvent** *(dict) --* An event in which the prompt was analyzed in preparation for optimization. * **message** *(string) --* A message describing the analysis of the prompt. * **badGatewayException** *(dict) --* There was an issue with a dependency due to a server issue. Retry your request. * **message** *(string) --* * **resourceName** *(string) --* The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS. * **dependencyFailedException** *(dict) --* There was an issue with a dependency. Check the resource configurations and retry the request. * **message** *(string) --* * **resourceName** *(string) --* The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS. * **internalServerException** *(dict) --* An internal server error occurred. Retry your request. * **message** *(string) --* * **reason** *(string) --* The reason for the exception. If the reason is "BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE", the model invocation service is unavailable. Retry your request. * **optimizedPromptEvent** *(dict) --* An event in which the prompt was optimized. * **optimizedPrompt** *(dict) --* Contains information about the optimized prompt. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "textPrompt". 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'} * **textPrompt** *(dict) --* Contains information about the text in the prompt that was optimized. * **text** *(string) --* The text in the text prompt to optimize. * **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) --* * **validationException** *(dict) --* Input validation failed. Check your request parameters and retry the request. * **message** *(string) --* **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / can_paginate can_paginate ************ AgentsforBedrockRuntime.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. AgentsforBedrockRuntime / Client / start_flow_execution start_flow_execution ******************** AgentsforBedrockRuntime.Client.start_flow_execution(**kwargs) Starts an execution of an Amazon Bedrock flow. Unlike flows that run until completion or time out after five minutes, flow executions let you run flows asynchronously for longer durations. Flow executions also yield control so that your application can perform other tasks. This operation returns an Amazon Resource Name (ARN) that you can use to track and manage your flow execution. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. See also: AWS API Documentation **Request Syntax** response = client.start_flow_execution( flowAliasIdentifier='string', flowExecutionName='string', flowIdentifier='string', inputs=[ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'nodeInputName': 'string', 'nodeName': 'string', 'nodeOutputName': 'string' }, ], modelPerformanceConfiguration={ 'performanceConfig': { 'latency': 'standard'|'optimized' } } ) Parameters: * **flowAliasIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow alias to use for the flow execution. * **flowExecutionName** (*string*) -- The unique name for the flow execution. If you don't provide one, a system-generated name is used. * **flowIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow to execute. * **inputs** (*list*) -- **[REQUIRED]** The input data required for the flow execution. This must match the input schema defined in the flow. * *(dict) --* Contains information about an input into the prompt flow and where to send it. * **content** *(dict) --* **[REQUIRED]** Contains information about an input into the prompt flow. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "document". * **document** (*document*) -- The input to send to the prompt flow input node. * **nodeInputName** *(string) --* The name of the input from the flow input node. * **nodeName** *(string) --* **[REQUIRED]** The name of the flow input node that begins the prompt flow. * **nodeOutputName** *(string) --* The name of the output from the flow input node that begins the prompt flow. * **modelPerformanceConfiguration** (*dict*) -- The performance settings for the foundation model used in the flow execution. * **performanceConfig** *(dict) --* The latency configuration for the model. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". Return type: dict Returns: **Response Syntax** { 'executionArn': 'string' } **Response Structure** * *(dict) --* * **executionArn** *(string) --* The Amazon Resource Name (ARN) that uniquely identifies the flow execution. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / get_agent_memory get_agent_memory **************** AgentsforBedrockRuntime.Client.get_agent_memory(**kwargs) Gets the sessions stored in the memory of the agent. See also: AWS API Documentation **Request Syntax** response = client.get_agent_memory( agentAliasId='string', agentId='string', maxItems=123, memoryId='string', memoryType='SESSION_SUMMARY', nextToken='string' ) Parameters: * **agentAliasId** (*string*) -- **[REQUIRED]** The unique identifier of an alias of an agent. * **agentId** (*string*) -- **[REQUIRED]** The unique identifier of the agent to which the alias belongs. * **maxItems** (*integer*) -- The maximum number of items to return in the response. If the total number of results is greater than this value, use the token returned in the response in the "nextToken" field when making another request to return the next batch of results. * **memoryId** (*string*) -- **[REQUIRED]** The unique identifier of the memory. * **memoryType** (*string*) -- **[REQUIRED]** The type of memory. * **nextToken** (*string*) -- If the total number of results is greater than the maxItems value provided in the request, enter the token returned in the "nextToken" field in the response in this field to return the next batch of results. Return type: dict Returns: **Response Syntax** { 'memoryContents': [ { 'sessionSummary': { 'memoryId': 'string', 'sessionExpiryTime': datetime(2015, 1, 1), 'sessionId': 'string', 'sessionStartTime': datetime(2015, 1, 1), 'summaryText': 'string' } }, ], 'nextToken': 'string' } **Response Structure** * *(dict) --* * **memoryContents** *(list) --* Contains details of the sessions stored in the memory * *(dict) --* Contains sessions summaries. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "sessionSummary". 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'} * **sessionSummary** *(dict) --* Contains summary of a session. * **memoryId** *(string) --* The unique identifier of the memory where the session summary is stored. * **sessionExpiryTime** *(datetime) --* The time when the memory duration for the session is set to end. * **sessionId** *(string) --* The identifier for this session. * **sessionStartTime** *(datetime) --* The start time for this session. * **summaryText** *(string) --* The summarized text for this session. * **nextToken** *(string) --* If the total number of results is greater than the maxItems value provided in the request, use this token when making another request in the "nextToken" field to return the next batch of results. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / update_session update_session ************** AgentsforBedrockRuntime.Client.update_session(**kwargs) Updates the metadata or encryption settings of a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. See also: AWS API Documentation **Request Syntax** response = client.update_session( sessionIdentifier='string', sessionMetadata={ 'string': 'string' } ) Parameters: * **sessionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the session to modify. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). * **sessionMetadata** (*dict*) -- A map of key-value pairs containing attributes to be persisted across the session. For example the user's ID, their language preference, and the type of device they are using. * *(string) --* * *(string) --* Return type: dict Returns: **Response Syntax** { 'createdAt': datetime(2015, 1, 1), 'lastUpdatedAt': datetime(2015, 1, 1), 'sessionArn': 'string', 'sessionId': 'string', 'sessionStatus': 'ACTIVE'|'EXPIRED'|'ENDED' } **Response Structure** * *(dict) --* * **createdAt** *(datetime) --* The timestamp for when the session was created. * **lastUpdatedAt** *(datetime) --* The timestamp for when the session was last modified. * **sessionArn** *(string) --* The Amazon Resource Name (ARN) of the session that was updated. * **sessionId** *(string) --* The unique identifier of the session you updated. * **sessionStatus** *(string) --* The status of the session you updated. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / list_invocation_steps list_invocation_steps ********************* AgentsforBedrockRuntime.Client.list_invocation_steps(**kwargs) Lists all invocation steps associated with a session and optionally, an invocation within the session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. See also: AWS API Documentation **Request Syntax** response = client.list_invocation_steps( invocationIdentifier='string', maxResults=123, nextToken='string', sessionIdentifier='string' ) Parameters: * **invocationIdentifier** (*string*) -- The unique identifier (in UUID format) for the invocation to list invocation steps for. * **maxResults** (*integer*) -- The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the "nextToken" field when making another request to return the next batch of results. * **nextToken** (*string*) -- If the total number of results is greater than the "maxResults" value provided in the request, enter the token returned in the "nextToken" field in the response in this field to return the next batch of results. * **sessionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier for the session associated with the invocation steps. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). Return type: dict Returns: **Response Syntax** { 'invocationStepSummaries': [ { 'invocationId': 'string', 'invocationStepId': 'string', 'invocationStepTime': datetime(2015, 1, 1), 'sessionId': 'string' }, ], 'nextToken': 'string' } **Response Structure** * *(dict) --* * **invocationStepSummaries** *(list) --* A list of summaries for each invocation step associated with a session and if you specified it, an invocation within the session. * *(dict) --* Contains details about an invocation step within an invocation in a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. * **invocationId** *(string) --* A unique identifier for the invocation in UUID format. * **invocationStepId** *(string) --* The unique identifier (in UUID format) for the invocation step. * **invocationStepTime** *(datetime) --* The timestamp for when the invocation step was created. * **sessionId** *(string) --* The unique identifier for the session associated with the invocation step. * **nextToken** *(string) --* If the total number of results is greater than the "maxResults" value provided in the request, use this token when making another request in the "nextToken" field to return the next batch of results. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / list_flow_execution_events list_flow_execution_events ************************** AgentsforBedrockRuntime.Client.list_flow_execution_events(**kwargs) Lists events that occurred during a flow execution. Events provide detailed information about the execution progress, including node inputs and outputs, flow inputs and outputs, condition results, and failure events. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. See also: AWS API Documentation **Request Syntax** response = client.list_flow_execution_events( eventType='Node'|'Flow', executionIdentifier='string', flowAliasIdentifier='string', flowIdentifier='string', maxResults=123, nextToken='string' ) Parameters: * **eventType** (*string*) -- **[REQUIRED]** The type of events to retrieve. Specify "Node" for node-level events or "Flow" for flow-level events. * **executionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow execution. * **flowAliasIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow alias used for the execution. * **flowIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow. * **maxResults** (*integer*) -- The maximum number of events to return in a single response. If more events exist than the specified maxResults value, a token is included in the response so that the remaining results can be retrieved. * **nextToken** (*string*) -- A token to retrieve the next set of results. This value is returned in the response if more results are available. Return type: dict Returns: **Response Syntax** { 'flowExecutionEvents': [ { 'conditionResultEvent': { 'nodeName': 'string', 'satisfiedConditions': [ { 'conditionName': 'string' }, ], 'timestamp': datetime(2015, 1, 1) }, 'flowFailureEvent': { 'errorCode': 'VALIDATION'|'INTERNAL_SERVER'|'NODE_EXECUTION_FAILED', 'errorMessage': 'string', 'timestamp': datetime(2015, 1, 1) }, 'flowInputEvent': { 'fields': [ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'name': 'string' }, ], 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) }, 'flowOutputEvent': { 'fields': [ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'name': 'string' }, ], 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) }, 'nodeFailureEvent': { 'errorCode': 'VALIDATION'|'DEPENDENCY_FAILED'|'BAD_GATEWAY'|'INTERNAL_SERVER', 'errorMessage': 'string', 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) }, 'nodeInputEvent': { 'fields': [ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'name': 'string' }, ], 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) }, 'nodeOutputEvent': { 'fields': [ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'name': 'string' }, ], 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) } }, ], 'nextToken': 'string' } **Response Structure** * *(dict) --* * **flowExecutionEvents** *(list) --* A list of events that occurred during the flow execution. Events can include node inputs and outputs, flow inputs and outputs, condition results, and failure events. * *(dict) --* Represents an event that occurred during an flow execution. This is a union type that can contain one of several event types, such as node input and output events; flow input and output events; condition node result events, or failure events. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "conditionResultEvent", "flowFailureEvent", "flowInputEvent", "flowOutputEvent", "nodeFailureEvent", "nodeInputEvent", "nodeOutputEvent". 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'} * **conditionResultEvent** *(dict) --* Contains information about a condition evaluation result during the flow execution. This event is generated when a condition node in the flow evaluates its conditions. * **nodeName** *(string) --* The name of the condition node that evaluated the conditions. * **satisfiedConditions** *(list) --* A list of conditions that were satisfied during the evaluation. * *(dict) --* Represents a condition that was satisfied during a condition node evaluation in a flow execution. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **conditionName** *(string) --* The name of the condition that was satisfied. * **timestamp** *(datetime) --* The timestamp when the condition evaluation occurred. * **flowFailureEvent** *(dict) --* Contains information about a failure that occurred at the flow level during execution. * **errorCode** *(string) --* The error code that identifies the type of failure that occurred. * **errorMessage** *(string) --* A descriptive message that provides details about the failure. * **timestamp** *(datetime) --* The timestamp when the failure occurred. * **flowInputEvent** *(dict) --* Contains information about the inputs provided to the flow at the start of execution. * **fields** *(list) --* A list of input fields provided to the flow. * *(dict) --* Represents an input field provided to a flow during a flow execution. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **content** *(dict) --* The content of the input field, which can contain text or structured data. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The document content of the field, which can contain text or structured data. * **name** *(string) --* The name of the input field as defined in the flow's input schema. * **nodeName** *(string) --* The name of the node that receives the inputs. * **timestamp** *(datetime) --* The timestamp when the inputs are provided. * **flowOutputEvent** *(dict) --* Contains information about the outputs produced by the flow at the end of execution. * **fields** *(list) --* A list of output fields produced by the flow. * *(dict) --* Represents an output field produced by a flow during a flow execution. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **content** *(dict) --* The content of the output field, which can contain text or structured data. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The document content of the field, which can contain text or structured data. * **name** *(string) --* The name of the output field as defined in the flow's output schema. * **nodeName** *(string) --* The name of the node that produces the outputs. * **timestamp** *(datetime) --* The timestamp when the outputs are produced. * **nodeFailureEvent** *(dict) --* Contains information about a failure that occurred at a specific node during execution. * **errorCode** *(string) --* The error code that identifies the type of failure that occurred at the node. * **errorMessage** *(string) --* A descriptive message that provides details about the node failure. * **nodeName** *(string) --* The name of the node where the failure occurred. * **timestamp** *(datetime) --* The timestamp when the node failure occurred. * **nodeInputEvent** *(dict) --* Contains information about the inputs provided to a specific node during execution. * **fields** *(list) --* A list of input fields provided to the node. * *(dict) --* Represents an input field provided to a node during a flow execution. * **content** *(dict) --* The content of the input field, which can contain text or structured data. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The document content of the field, which can contain text or structured data. * **name** *(string) --* The name of the input field as defined in the node's input schema. * **nodeName** *(string) --* The name of the node that received the inputs. * **timestamp** *(datetime) --* The timestamp when the inputs were provided to the node. * **nodeOutputEvent** *(dict) --* Contains information about the outputs produced by a specific node during execution. * **fields** *(list) --* A list of output fields produced by the node. * *(dict) --* Represents an output field produced by a node during a flow execution. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **content** *(dict) --* The content of the output field, which can contain text or structured data. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The document content of the field, which can contain text or structured data. * **name** *(string) --* The name of the output field as defined in the node's output schema. * **nodeName** *(string) --* The name of the node that produced the outputs. * **timestamp** *(datetime) --* The timestamp when the outputs were produced by the node. * **nextToken** *(string) --* A token to retrieve the next set of results. This value is returned if more results are available. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / invoke_inline_agent invoke_inline_agent ******************* AgentsforBedrockRuntime.Client.invoke_inline_agent(**kwargs) Invokes an inline Amazon Bedrock agent using the configurations you provide with the request. * Specify the following fields for security purposes. * (Optional) "customerEncryptionKeyArn" – The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent. * (Optional) "idleSessionTTLinSeconds" – Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequent "InvokeInlineAgent" request begins a new session. * To override the default prompt behavior for agent orchestration and to use advanced prompts, include a "promptOverrideConfiguration" object. For more information, see Advanced prompts. * The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled. See also: AWS API Documentation **Request Syntax** response = client.invoke_inline_agent( actionGroups=[ { 'actionGroupExecutor': { 'customControl': 'RETURN_CONTROL', 'lambda': 'string' }, 'actionGroupName': 'string', 'apiSchema': { 'payload': 'string', 's3': { 's3BucketName': 'string', 's3ObjectKey': 'string' } }, 'description': 'string', 'functionSchema': { 'functions': [ { 'description': 'string', 'name': 'string', 'parameters': { 'string': { 'description': 'string', 'required': True|False, 'type': 'string'|'number'|'integer'|'boolean'|'array' } }, 'requireConfirmation': 'ENABLED'|'DISABLED' }, ] }, 'parentActionGroupSignature': 'AMAZON.UserInput'|'AMAZON.CodeInterpreter'|'ANTHROPIC.Computer'|'ANTHROPIC.Bash'|'ANTHROPIC.TextEditor', 'parentActionGroupSignatureParams': { 'string': 'string' } }, ], agentCollaboration='SUPERVISOR'|'SUPERVISOR_ROUTER'|'DISABLED', agentName='string', bedrockModelConfigurations={ 'performanceConfig': { 'latency': 'standard'|'optimized' } }, collaboratorConfigurations=[ { 'agentAliasArn': 'string', 'collaboratorInstruction': 'string', 'collaboratorName': 'string', 'relayConversationHistory': 'TO_COLLABORATOR'|'DISABLED' }, ], collaborators=[ { 'actionGroups': [ { 'actionGroupExecutor': { 'customControl': 'RETURN_CONTROL', 'lambda': 'string' }, 'actionGroupName': 'string', 'apiSchema': { 'payload': 'string', 's3': { 's3BucketName': 'string', 's3ObjectKey': 'string' } }, 'description': 'string', 'functionSchema': { 'functions': [ { 'description': 'string', 'name': 'string', 'parameters': { 'string': { 'description': 'string', 'required': True|False, 'type': 'string'|'number'|'integer'|'boolean'|'array' } }, 'requireConfirmation': 'ENABLED'|'DISABLED' }, ] }, 'parentActionGroupSignature': 'AMAZON.UserInput'|'AMAZON.CodeInterpreter'|'ANTHROPIC.Computer'|'ANTHROPIC.Bash'|'ANTHROPIC.TextEditor', 'parentActionGroupSignatureParams': { 'string': 'string' } }, ], 'agentCollaboration': 'SUPERVISOR'|'SUPERVISOR_ROUTER'|'DISABLED', 'agentName': 'string', 'collaboratorConfigurations': [ { 'agentAliasArn': 'string', 'collaboratorInstruction': 'string', 'collaboratorName': 'string', 'relayConversationHistory': 'TO_COLLABORATOR'|'DISABLED' }, ], 'customerEncryptionKeyArn': 'string', 'foundationModel': 'string', 'guardrailConfiguration': { 'guardrailIdentifier': 'string', 'guardrailVersion': 'string' }, 'idleSessionTTLInSeconds': 123, 'instruction': 'string', 'knowledgeBases': [ { 'description': 'string', 'knowledgeBaseId': 'string', 'retrievalConfiguration': { 'vectorSearchConfiguration': { 'filter': { 'andAll': [ {'... recursive ...'}, ], 'equals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'in': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'listContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notIn': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'orAll': [ {'... recursive ...'}, ], 'startsWith': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'stringContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None } }, 'implicitFilterConfiguration': { 'metadataAttributes': [ { 'description': 'string', 'key': 'string', 'type': 'STRING'|'NUMBER'|'BOOLEAN'|'STRING_LIST' }, ], 'modelArn': 'string' }, 'numberOfResults': 123, 'overrideSearchType': 'HYBRID'|'SEMANTIC', 'rerankingConfiguration': { 'bedrockRerankingConfiguration': { 'metadataConfiguration': { 'selectionMode': 'SELECTIVE'|'ALL', 'selectiveModeConfiguration': { 'fieldsToExclude': [ { 'fieldName': 'string' }, ], 'fieldsToInclude': [ { 'fieldName': 'string' }, ] } }, 'modelConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'modelArn': 'string' }, 'numberOfRerankedResults': 123 }, 'type': 'BEDROCK_RERANKING_MODEL' } } } }, ], 'promptOverrideConfiguration': { 'overrideLambda': 'string', 'promptConfigurations': [ { 'additionalModelRequestFields': {...}|[...]|123|123.4|'string'|True|None, 'basePromptTemplate': 'string', 'foundationModel': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'promptState': 'ENABLED'|'DISABLED', 'promptType': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, ] } }, ], customOrchestration={ 'executor': { 'lambda': 'string' } }, customerEncryptionKeyArn='string', enableTrace=True|False, endSession=True|False, foundationModel='string', guardrailConfiguration={ 'guardrailIdentifier': 'string', 'guardrailVersion': 'string' }, idleSessionTTLInSeconds=123, inlineSessionState={ 'conversationHistory': { 'messages': [ { 'content': [ { 'text': 'string' }, ], 'role': 'user'|'assistant' }, ] }, 'files': [ { 'name': 'string', 'source': { 'byteContent': { 'data': b'bytes', 'mediaType': 'string' }, 's3Location': { 'uri': 'string' }, 'sourceType': 'S3'|'BYTE_CONTENT' }, 'useCase': 'CODE_INTERPRETER'|'CHAT' }, ], 'invocationId': 'string', 'promptSessionAttributes': { 'string': 'string' }, 'returnControlInvocationResults': [ { 'apiResult': { 'actionGroup': 'string', 'agentId': 'string', 'apiPath': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'httpMethod': 'string', 'httpStatusCode': 123, 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' }, 'functionResult': { 'actionGroup': 'string', 'agentId': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'function': 'string', 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' } }, ], 'sessionAttributes': { 'string': 'string' } }, inputText='string', instruction='string', knowledgeBases=[ { 'description': 'string', 'knowledgeBaseId': 'string', 'retrievalConfiguration': { 'vectorSearchConfiguration': { 'filter': { 'andAll': [ {'... recursive ...'}, ], 'equals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'in': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'listContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notIn': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'orAll': [ {'... recursive ...'}, ], 'startsWith': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'stringContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None } }, 'implicitFilterConfiguration': { 'metadataAttributes': [ { 'description': 'string', 'key': 'string', 'type': 'STRING'|'NUMBER'|'BOOLEAN'|'STRING_LIST' }, ], 'modelArn': 'string' }, 'numberOfResults': 123, 'overrideSearchType': 'HYBRID'|'SEMANTIC', 'rerankingConfiguration': { 'bedrockRerankingConfiguration': { 'metadataConfiguration': { 'selectionMode': 'SELECTIVE'|'ALL', 'selectiveModeConfiguration': { 'fieldsToExclude': [ { 'fieldName': 'string' }, ], 'fieldsToInclude': [ { 'fieldName': 'string' }, ] } }, 'modelConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'modelArn': 'string' }, 'numberOfRerankedResults': 123 }, 'type': 'BEDROCK_RERANKING_MODEL' } } } }, ], orchestrationType='DEFAULT'|'CUSTOM_ORCHESTRATION', promptCreationConfigurations={ 'excludePreviousThinkingSteps': True|False, 'previousConversationTurnsToInclude': 123 }, promptOverrideConfiguration={ 'overrideLambda': 'string', 'promptConfigurations': [ { 'additionalModelRequestFields': {...}|[...]|123|123.4|'string'|True|None, 'basePromptTemplate': 'string', 'foundationModel': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'promptState': 'ENABLED'|'DISABLED', 'promptType': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, ] }, sessionId='string', streamingConfigurations={ 'applyGuardrailInterval': 123, 'streamFinalResponse': True|False } ) Parameters: * **actionGroups** (*list*) -- A list of action groups with each action group defining the action the inline agent needs to carry out. * *(dict) --* Contains details of the inline agent's action group. * **actionGroupExecutor** *(dict) --* The Amazon Resource Name (ARN) of the Lambda function containing the business logic that is carried out upon invoking the action or the custom control method for handling the information elicited from the user. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "customControl", "lambda". * **customControl** *(string) --* To return the action group invocation results directly in the "InvokeInlineAgent" response, specify "RETURN_CONTROL". * **lambda** *(string) --* The Amazon Resource Name (ARN) of the Lambda function containing the business logic that is carried out upon invoking the action. * **actionGroupName** *(string) --* **[REQUIRED]** The name of the action group. * **apiSchema** *(dict) --* Contains either details about the S3 object containing the OpenAPI schema for the action group or the JSON or YAML- formatted payload defining the schema. For more information, see Action group OpenAPI schemas. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "payload", "s3". * **payload** *(string) --* The JSON or YAML-formatted payload defining the OpenAPI schema for the action group. * **s3** *(dict) --* Contains details about the S3 object containing the OpenAPI schema for the action group. * **s3BucketName** *(string) --* The name of the S3 bucket. * **s3ObjectKey** *(string) --* The S3 object key for the S3 resource. * **description** *(string) --* A description of the action group. * **functionSchema** *(dict) --* Contains details about the function schema for the action group or the JSON or YAML-formatted payload defining the schema. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "functions". * **functions** *(list) --* A list of functions that each define an action in the action group. * *(dict) --* Defines parameters that the agent needs to invoke from the user to complete the function. Corresponds to an action in an action group. * **description** *(string) --* A description of the function and its purpose. * **name** *(string) --* **[REQUIRED]** A name for the function. * **parameters** *(dict) --* The parameters that the agent elicits from the user to fulfill the function. * *(string) --* * *(dict) --* Contains details about a parameter in a function for an action group. * **description** *(string) --* A description of the parameter. Helps the foundation model determine how to elicit the parameters from the user. * **required** *(boolean) --* Whether the parameter is required for the agent to complete the function for action group invocation. * **type** *(string) --* **[REQUIRED]** The data type of the parameter. * **requireConfirmation** *(string) --* Contains information if user confirmation is required to invoke the function. * **parentActionGroupSignature** *(string) --* Specify a built-in or computer use action for this action group. If you specify a value, you must leave the "description", "apiSchema", and "actionGroupExecutor" fields empty for this action group. * To allow your agent to request the user for additional information when trying to complete a task, set this field to "AMAZON.UserInput". * To allow your agent to generate, run, and troubleshoot code when trying to complete a task, set this field to "AMAZON.CodeInterpreter". * To allow your agent to use an Anthropic computer use tool, specify one of the following values. Warning: Computer use is a new Anthropic Claude model capability (in beta) available with Anthropic Claude 3.7 Sonnet and Claude 3.5 Sonnet v2 only. When operating computer use functionality, we recommend taking additional security precautions, such as executing computer actions in virtual environments with restricted data access and limited internet connectivity. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * "ANTHROPIC.Computer" - Gives the agent permission to use the mouse and keyboard and take screenshots. * "ANTHROPIC.TextEditor" - Gives the agent permission to view, create and edit files. * "ANTHROPIC.Bash" - Gives the agent permission to run commands in a bash shell. * **parentActionGroupSignatureParams** *(dict) --* The configuration settings for a computer use action. Warning: Computer use is a new Anthropic Claude model capability (in beta) available with Claude 3.7 Sonnet and Claude 3.5 Sonnet v2 only. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * *(string) --* * *(string) --* * **agentCollaboration** (*string*) -- Defines how the inline collaborator agent handles information across multiple collaborator agents to coordinate a final response. The inline collaborator agent can also be the supervisor. * **agentName** (*string*) -- The name for the agent. * **bedrockModelConfigurations** (*dict*) -- Model settings for the request. * **performanceConfig** *(dict) --* The latency configuration for the model. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". * **collaboratorConfigurations** (*list*) -- Settings for an inline agent collaborator called with InvokeInlineAgent. * *(dict) --* Settings of an inline collaborator agent. * **agentAliasArn** *(string) --* The Amazon Resource Name (ARN) of the inline collaborator agent. * **collaboratorInstruction** *(string) --* **[REQUIRED]** Instructions that tell the inline collaborator agent what it should do and how it should interact with users. * **collaboratorName** *(string) --* **[REQUIRED]** Name of the inline collaborator agent which must be the same name as specified for "agentName". * **relayConversationHistory** *(string) --* A relay conversation history for the inline collaborator agent. * **collaborators** (*list*) -- List of collaborator inline agents. * *(dict) --* List of inline collaborators. * **actionGroups** *(list) --* List of action groups with each action group defining tasks the inline collaborator agent needs to carry out. * *(dict) --* Contains details of the inline agent's action group. * **actionGroupExecutor** *(dict) --* The Amazon Resource Name (ARN) of the Lambda function containing the business logic that is carried out upon invoking the action or the custom control method for handling the information elicited from the user. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "customControl", "lambda". * **customControl** *(string) --* To return the action group invocation results directly in the "InvokeInlineAgent" response, specify "RETURN_CONTROL". * **lambda** *(string) --* The Amazon Resource Name (ARN) of the Lambda function containing the business logic that is carried out upon invoking the action. * **actionGroupName** *(string) --* **[REQUIRED]** The name of the action group. * **apiSchema** *(dict) --* Contains either details about the S3 object containing the OpenAPI schema for the action group or the JSON or YAML-formatted payload defining the schema. For more information, see Action group OpenAPI schemas. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "payload", "s3". * **payload** *(string) --* The JSON or YAML-formatted payload defining the OpenAPI schema for the action group. * **s3** *(dict) --* Contains details about the S3 object containing the OpenAPI schema for the action group. * **s3BucketName** *(string) --* The name of the S3 bucket. * **s3ObjectKey** *(string) --* The S3 object key for the S3 resource. * **description** *(string) --* A description of the action group. * **functionSchema** *(dict) --* Contains details about the function schema for the action group or the JSON or YAML-formatted payload defining the schema. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "functions". * **functions** *(list) --* A list of functions that each define an action in the action group. * *(dict) --* Defines parameters that the agent needs to invoke from the user to complete the function. Corresponds to an action in an action group. * **description** *(string) --* A description of the function and its purpose. * **name** *(string) --* **[REQUIRED]** A name for the function. * **parameters** *(dict) --* The parameters that the agent elicits from the user to fulfill the function. * *(string) --* * *(dict) --* Contains details about a parameter in a function for an action group. * **description** *(string) --* A description of the parameter. Helps the foundation model determine how to elicit the parameters from the user. * **required** *(boolean) --* Whether the parameter is required for the agent to complete the function for action group invocation. * **type** *(string) --* **[REQUIRED]** The data type of the parameter. * **requireConfirmation** *(string) --* Contains information if user confirmation is required to invoke the function. * **parentActionGroupSignature** *(string) --* Specify a built-in or computer use action for this action group. If you specify a value, you must leave the "description", "apiSchema", and "actionGroupExecutor" fields empty for this action group. * To allow your agent to request the user for additional information when trying to complete a task, set this field to "AMAZON.UserInput". * To allow your agent to generate, run, and troubleshoot code when trying to complete a task, set this field to "AMAZON.CodeInterpreter". * To allow your agent to use an Anthropic computer use tool, specify one of the following values. Warning: Computer use is a new Anthropic Claude model capability (in beta) available with Anthropic Claude 3.7 Sonnet and Claude 3.5 Sonnet v2 only. When operating computer use functionality, we recommend taking additional security precautions, such as executing computer actions in virtual environments with restricted data access and limited internet connectivity. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * "ANTHROPIC.Computer" - Gives the agent permission to use the mouse and keyboard and take screenshots. * "ANTHROPIC.TextEditor" - Gives the agent permission to view, create and edit files. * "ANTHROPIC.Bash" - Gives the agent permission to run commands in a bash shell. * **parentActionGroupSignatureParams** *(dict) --* The configuration settings for a computer use action. Warning: Computer use is a new Anthropic Claude model capability (in beta) available with Claude 3.7 Sonnet and Claude 3.5 Sonnet v2 only. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * *(string) --* * *(string) --* * **agentCollaboration** *(string) --* Defines how the inline supervisor agent handles information across multiple collaborator agents to coordinate a final response. * **agentName** *(string) --* Name of the inline collaborator agent which must be the same name as specified for "collaboratorName". * **collaboratorConfigurations** *(list) --* Settings of the collaborator agent. * *(dict) --* Settings of an inline collaborator agent. * **agentAliasArn** *(string) --* The Amazon Resource Name (ARN) of the inline collaborator agent. * **collaboratorInstruction** *(string) --* **[REQUIRED]** Instructions that tell the inline collaborator agent what it should do and how it should interact with users. * **collaboratorName** *(string) --* **[REQUIRED]** Name of the inline collaborator agent which must be the same name as specified for "agentName". * **relayConversationHistory** *(string) --* A relay conversation history for the inline collaborator agent. * **customerEncryptionKeyArn** *(string) --* The Amazon Resource Name (ARN) of the AWS KMS key that encrypts the inline collaborator. * **foundationModel** *(string) --* **[REQUIRED]** The foundation model used by the inline collaborator agent. * **guardrailConfiguration** *(dict) --* Details of the guardwrail associated with the inline collaborator. * **guardrailIdentifier** *(string) --* **[REQUIRED]** The unique identifier for the guardrail. * **guardrailVersion** *(string) --* **[REQUIRED]** The version of the guardrail. * **idleSessionTTLInSeconds** *(integer) --* The number of seconds for which the Amazon Bedrock keeps information about the user's conversation with the inline collaborator agent. A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout. * **instruction** *(string) --* **[REQUIRED]** Instruction that tell the inline collaborator agent what it should do and how it should interact with users. * **knowledgeBases** *(list) --* Knowledge base associated with the inline collaborator agent. * *(dict) --* Details of the knowledge base associated withe inline agent. * **description** *(string) --* **[REQUIRED]** The description of the knowledge base associated with the inline agent. * **knowledgeBaseId** *(string) --* **[REQUIRED]** The unique identifier for a knowledge base associated with the inline agent. * **retrievalConfiguration** *(dict) --* The configurations to apply to the knowledge base during query. For more information, see Query configurations. * **vectorSearchConfiguration** *(dict) --* **[REQUIRED]** Contains details about how the results from the vector search should be returned. For more information, see Query configurations. * **filter** *(dict) --* Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see Query configurations. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **andAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **equals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value matches the "value" in this object. The following example would return data sources with an "animal" attribute whose value is "cat": ""equals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than "1989": ""greaterThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than or equal to "1989": ""greaterThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **in** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is in the list specified in the "value" in this object. The following example would return data sources with an "animal" attribute that is either "cat" or "dog": ""in": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than to "1989". ""lessThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than or equal to "1989". ""lessThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **listContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is a list that contains the "value" as one of its members. The following example would return data sources with an "animals" attribute that is a list containing a "cat" member (for example "["dog", "cat"]"). ""listContains": { "key": "animals", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notEquals** *(dict) --* Knowledge base data sources are returned when: * It contains a metadata attribute whose name matches the "key" and whose value doesn't match the "value" in this object. * The key is not present in the document. The following example would return data sources that don't contain an "animal" attribute whose value is "cat". ""notEquals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notIn** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value isn't in the list specified in the "value" in this object. The following example would return data sources whose "animal" attribute is neither "cat" nor "dog". ""notIn": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **orAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **startsWith** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value starts with the "value" in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores. The following example would return data sources with an "animal" attribute starts with "ca" (for example, "cat" or "camel"). ""startsWith": { "key": "animal", "value": "ca" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **stringContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is one of the following: * A string that contains the "value" as a substring. The following example would return data sources with an "animal" attribute that contains the substring "at" (for example "cat"). ""stringContains": { "key": "animal", "value": "at" }" * A list with a member that contains the "value" as a substring. The following example would return data sources with an "animals" attribute that is a list containing a member that contains the substring "at" (for example "["dog", "cat"]"). ""stringContains": { "key": "animals", "value": "at" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **implicitFilterConfiguration** *(dict) --* Settings for implicit filtering. * **metadataAttributes** *(list) --* **[REQUIRED]** Metadata that can be used in a filter. * *(dict) --* Details about a metadata attribute. * **description** *(string) --* **[REQUIRED]** The attribute's description. * **key** *(string) --* **[REQUIRED]** The attribute's key. * **type** *(string) --* **[REQUIRED]** The attribute's type. * **modelArn** *(string) --* **[REQUIRED]** The model that generates the filter. * **numberOfResults** *(integer) --* The number of source chunks to retrieve. * **overrideSearchType** *(string) --* By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a "HYBRID" search using both vector embeddings and raw text, or "SEMANTIC" search using only vector embeddings. For other vector store configurations, only "SEMANTIC" search is available. For more information, see Test a knowledge base. * **rerankingConfiguration** *(dict) --* Contains configurations for reranking the retrieved results. For more information, see Improve the relevance of query responses with a reranker model. * **bedrockRerankingConfiguration** *(dict) --* Contains configurations for an Amazon Bedrock reranker model. * **metadataConfiguration** *(dict) --* Contains configurations for the metadata to use in reranking. * **selectionMode** *(string) --* **[REQUIRED]** Specifies whether to consider all metadata when reranking, or only the metadata that you select. If you specify "SELECTIVE", include the "selectiveModeConfiguration" field. * **selectiveModeConfiguration** *(dict) --* Contains configurations for the metadata fields to include or exclude when considering reranking. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "fieldsToExclude", "fieldsToInclude". * **fieldsToExclude** *(list) --* An array of objects, each of which specifies a metadata field to exclude from consideration when reranking. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **fieldsToInclude** *(list) --* An array of objects, each of which specifies a metadata field to include in consideration when reranking. The remaining metadata fields are ignored. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **modelConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for the reranker model. * **additionalModelRequestFields** *(dict) --* A JSON object whose keys are request fields for the model and whose values are values for those fields. * *(string) --* * (*document*) -- * **modelArn** *(string) --* **[REQUIRED]** The ARN of the reranker model to use. * **numberOfRerankedResults** *(integer) --* The number of results to return after reranking. * **type** *(string) --* **[REQUIRED]** The type of reranker model. * **promptOverrideConfiguration** *(dict) --* Contains configurations to override prompt templates in different parts of an inline collaborator sequence. For more information, see Advanced prompts. * **overrideLambda** *(string) --* The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence. If you specify this field, at least one of the "promptConfigurations" must contain a "parserMode" value that is set to "OVERRIDDEN". For more information, see Parser Lambda function in Amazon Bedrock Agents. * **promptConfigurations** *(list) --* **[REQUIRED]** Contains configurations to override a prompt template in one part of an agent sequence. For more information, see Advanced prompts. * *(dict) --* Contains configurations to override a prompt template in one part of an agent sequence. For more information, see Advanced prompts. * **additionalModelRequestFields** (*document*) -- If the Converse or ConverseStream operations support the model, "additionalModelRequestFields" contains additional inference parameters, beyond the base set of inference parameters in the "inferenceConfiguration" field. For more information, see *Inference request parameters and response fields for foundation models* in the Amazon Bedrock user guide. * **basePromptTemplate** *(string) --* Defines the prompt template with which to replace the default prompt template. You can use placeholder variables in the base prompt template to customize the prompt. For more information, see Prompt template placeholder variables. For more information, see Configure the prompt templates. * **foundationModel** *(string) --* The foundation model to use. * **inferenceConfiguration** *(dict) --* Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the "promptType". For more information, see Inference parameters for foundation models. * **maximumLength** *(integer) --* The maximum number of tokens allowed in the generated response. * **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) --* * **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. * **topK** *(integer) --* While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for "topK" is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set "topK" to 50, the model selects the next token from among the top 50 most likely choices. * **topP** *(float) --* While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for "Top P" determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set "topP" to 0.8, the model only selects the next token from the top 80% of the probability distribution of next tokens. * **parserMode** *(string) --* Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the "promptType". If you set the field as "OVERRIDDEN", the "overrideLambda" field in the PromptOverrideConfiguration must be specified with the ARN of a Lambda function. * **promptCreationMode** *(string) --* Specifies whether to override the default prompt template for this "promptType". Set this value to "OVERRIDDEN" to use the prompt that you provide in the "basePromptTemplate". If you leave it as "DEFAULT", the agent uses a default prompt template. * **promptState** *(string) --* Specifies whether to allow the inline agent to carry out the step specified in the "promptType". If you set this value to "DISABLED", the agent skips that step. The default state for each "promptType" is as follows. * "PRE_PROCESSING" – "ENABLED" * "ORCHESTRATION" – "ENABLED" * "KNOWLEDGE_BASE_RESPONSE_GENERATION" – "ENABLED" * "POST_PROCESSING" – "DISABLED" * **promptType** *(string) --* The step in the agent sequence that this prompt configuration applies to. * **customOrchestration** (*dict*) -- Contains details of the custom orchestration configured for the agent. * **executor** *(dict) --* The structure of the executor invoking the actions in custom orchestration. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "lambda". * **lambda** *(string) --* The Amazon Resource Name (ARN) of the Lambda function containing the business logic that is carried out upon invoking the action. * **customerEncryptionKeyArn** (*string*) -- The Amazon Resource Name (ARN) of the Amazon Web Services KMS key to use to encrypt your inline agent. * **enableTrace** (*boolean*) -- Specifies whether to turn on the trace or not to track the agent's reasoning process. For more information, see Using trace. * **endSession** (*boolean*) -- Specifies whether to end the session with the inline agent or not. * **foundationModel** (*string*) -- **[REQUIRED]** The model identifier (ID) of the model to use for orchestration by the inline agent. For example, "meta.llama3-1 -70b-instruct-v1:0". * **guardrailConfiguration** (*dict*) -- The guardrails to assign to the inline agent. * **guardrailIdentifier** *(string) --* **[REQUIRED]** The unique identifier for the guardrail. * **guardrailVersion** *(string) --* **[REQUIRED]** The version of the guardrail. * **idleSessionTTLInSeconds** (*integer*) -- The number of seconds for which the inline agent should maintain session information. After this time expires, the subsequent "InvokeInlineAgent" request begins a new session. A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and the data provided before the timeout is deleted. * **inlineSessionState** (*dict*) -- Parameters that specify the various attributes of a sessions. You can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group. For more information, see Control session context. Note: If you include "returnControlInvocationResults" in the "sessionState" field, the "inputText" field will be ignored. * **conversationHistory** *(dict) --* Contains the conversation history that persist across sessions. * **messages** *(list) --* The conversation's messages. * *(dict) --* Details about a message. * **content** *(list) --* **[REQUIRED]** The message's content. * *(dict) --* A content block. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The block's text. * **role** *(string) --* **[REQUIRED]** The message's role. * **files** *(list) --* Contains information about the files used by code interpreter. * *(dict) --* Contains details of the source files. * **name** *(string) --* **[REQUIRED]** The name of the source file. * **source** *(dict) --* **[REQUIRED]** Specifies where the files are located. * **byteContent** *(dict) --* The data and the text of the attached files. * **data** *(bytes) --* **[REQUIRED]** The raw bytes of the file to attach. The maximum size of all files that is attached is 10MB. You can attach a maximum of 5 files. * **mediaType** *(string) --* **[REQUIRED]** The MIME type of data contained in the file used for chat. * **s3Location** *(dict) --* The s3 location of the files to attach. * **uri** *(string) --* **[REQUIRED]** The uri of the s3 object. * **sourceType** *(string) --* **[REQUIRED]** The source type of the files to attach. * **useCase** *(string) --* **[REQUIRED]** Specifies how the source files will be used by the code interpreter. * **invocationId** *(string) --* The identifier of the invocation of an action. This value must match the "invocationId" returned in the "InvokeInlineAgent" response for the action whose results are provided in the "returnControlInvocationResults" field. For more information, see Return control to the agent developer. * **promptSessionAttributes** *(dict) --* Contains attributes that persist across a session and the values of those attributes. * *(string) --* * *(string) --* * **returnControlInvocationResults** *(list) --* Contains information about the results from the action group invocation. For more information, see Return control to the agent developer. Note: If you include this field in the "sessionState" field, the "inputText" field will be ignored. * *(dict) --* A result from the invocation of an action. For more information, see Return control to the agent developer and Control session context. This data type is used in the following API operations: * InvokeAgent request Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "apiResult", "functionResult". * **apiResult** *(dict) --* The result from the API response from the action group invocation. * **actionGroup** *(string) --* **[REQUIRED]** The action group that the API operation belongs to. * **agentId** *(string) --* The agent's ID. * **apiPath** *(string) --* The path to the API operation. * **confirmationState** *(string) --* Controls the API operations or functions to invoke based on the user confirmation. * **httpMethod** *(string) --* The HTTP method for the API operation. * **httpStatusCode** *(integer) --* http status code from API execution response (for example: 200, 400, 500). * **responseBody** *(dict) --* The response body from the API operation. The key of the object is the content type (currently, only "TEXT" is supported). The response may be returned directly or from the Lambda function. * *(string) --* * *(dict) --* Contains the body of the API response. This data type is used in the following API operations: * In the "returnControlInvocationResults" field of the InvokeAgent request * **body** *(string) --* The body of the API response. * **images** *(list) --* Lists details, including format and source, for the image in the response from the function call. You can specify only one image and the function in the "returnControlInvocationResults" must be a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * *(dict) --* Details about an image in the result from a function in the action group invocation. You can specify images only when the function is a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * **format** *(string) --* **[REQUIRED]** The type of image in the result. * **source** *(dict) --* **[REQUIRED]** The source of the image in the result. 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. If you use an Amazon Web Services SDK, you don't need to encode the image bytes in base64. * **responseState** *(string) --* Controls the final response state returned to end user when API/Function execution failed. When this state is FAILURE, the request would fail with dependency failure exception. When this state is REPROMPT, the API/function response will be sent to model for re- prompt * **functionResult** *(dict) --* The result from the function from the action group invocation. * **actionGroup** *(string) --* **[REQUIRED]** The action group that the function belongs to. * **agentId** *(string) --* The agent's ID. * **confirmationState** *(string) --* Contains the user confirmation information about the function that was called. * **function** *(string) --* The name of the function that was called. * **responseBody** *(dict) --* The response from the function call using the parameters. The response might be returned directly or from the Lambda function. Specify "TEXT" or "IMAGES". The key of the object is the content type. You can only specify one type. If you specify "IMAGES", you can specify only one image. You can specify images only when the function in the "returnControlInvocationResults" is a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * *(string) --* * *(dict) --* Contains the body of the API response. This data type is used in the following API operations: * In the "returnControlInvocationResults" field of the InvokeAgent request * **body** *(string) --* The body of the API response. * **images** *(list) --* Lists details, including format and source, for the image in the response from the function call. You can specify only one image and the function in the "returnControlInvocationResults" must be a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * *(dict) --* Details about an image in the result from a function in the action group invocation. You can specify images only when the function is a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * **format** *(string) --* **[REQUIRED]** The type of image in the result. * **source** *(dict) --* **[REQUIRED]** The source of the image in the result. 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. If you use an Amazon Web Services SDK, you don't need to encode the image bytes in base64. * **responseState** *(string) --* Controls the final response state returned to end user when API/Function execution failed. When this state is FAILURE, the request would fail with dependency failure exception. When this state is REPROMPT, the API/function response will be sent to model for re- prompt * **sessionAttributes** *(dict) --* Contains attributes that persist across a session and the values of those attributes. * *(string) --* * *(string) --* * **inputText** (*string*) -- The prompt text to send to the agent. Note: If you include "returnControlInvocationResults" in the "sessionState" field, the "inputText" field will be ignored. * **instruction** (*string*) -- **[REQUIRED]** The instructions that tell the inline agent what it should do and how it should interact with users. * **knowledgeBases** (*list*) -- Contains information of the knowledge bases to associate with. * *(dict) --* Details of the knowledge base associated withe inline agent. * **description** *(string) --* **[REQUIRED]** The description of the knowledge base associated with the inline agent. * **knowledgeBaseId** *(string) --* **[REQUIRED]** The unique identifier for a knowledge base associated with the inline agent. * **retrievalConfiguration** *(dict) --* The configurations to apply to the knowledge base during query. For more information, see Query configurations. * **vectorSearchConfiguration** *(dict) --* **[REQUIRED]** Contains details about how the results from the vector search should be returned. For more information, see Query configurations. * **filter** *(dict) --* Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see Query configurations. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **andAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **equals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value matches the "value" in this object. The following example would return data sources with an "animal" attribute whose value is "cat": ""equals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than "1989": ""greaterThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than or equal to "1989": ""greaterThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **in** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is in the list specified in the "value" in this object. The following example would return data sources with an "animal" attribute that is either "cat" or "dog": ""in": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than to "1989". ""lessThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than or equal to "1989". ""lessThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **listContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is a list that contains the "value" as one of its members. The following example would return data sources with an "animals" attribute that is a list containing a "cat" member (for example "["dog", "cat"]"). ""listContains": { "key": "animals", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notEquals** *(dict) --* Knowledge base data sources are returned when: * It contains a metadata attribute whose name matches the "key" and whose value doesn't match the "value" in this object. * The key is not present in the document. The following example would return data sources that don't contain an "animal" attribute whose value is "cat". ""notEquals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notIn** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value isn't in the list specified in the "value" in this object. The following example would return data sources whose "animal" attribute is neither "cat" nor "dog". ""notIn": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **orAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **startsWith** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value starts with the "value" in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores. The following example would return data sources with an "animal" attribute starts with "ca" (for example, "cat" or "camel"). ""startsWith": { "key": "animal", "value": "ca" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **stringContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is one of the following: * A string that contains the "value" as a substring. The following example would return data sources with an "animal" attribute that contains the substring "at" (for example "cat"). ""stringContains": { "key": "animal", "value": "at" }" * A list with a member that contains the "value" as a substring. The following example would return data sources with an "animals" attribute that is a list containing a member that contains the substring "at" (for example "["dog", "cat"]"). ""stringContains": { "key": "animals", "value": "at" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **implicitFilterConfiguration** *(dict) --* Settings for implicit filtering. * **metadataAttributes** *(list) --* **[REQUIRED]** Metadata that can be used in a filter. * *(dict) --* Details about a metadata attribute. * **description** *(string) --* **[REQUIRED]** The attribute's description. * **key** *(string) --* **[REQUIRED]** The attribute's key. * **type** *(string) --* **[REQUIRED]** The attribute's type. * **modelArn** *(string) --* **[REQUIRED]** The model that generates the filter. * **numberOfResults** *(integer) --* The number of source chunks to retrieve. * **overrideSearchType** *(string) --* By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a "HYBRID" search using both vector embeddings and raw text, or "SEMANTIC" search using only vector embeddings. For other vector store configurations, only "SEMANTIC" search is available. For more information, see Test a knowledge base. * **rerankingConfiguration** *(dict) --* Contains configurations for reranking the retrieved results. For more information, see Improve the relevance of query responses with a reranker model. * **bedrockRerankingConfiguration** *(dict) --* Contains configurations for an Amazon Bedrock reranker model. * **metadataConfiguration** *(dict) --* Contains configurations for the metadata to use in reranking. * **selectionMode** *(string) --* **[REQUIRED]** Specifies whether to consider all metadata when reranking, or only the metadata that you select. If you specify "SELECTIVE", include the "selectiveModeConfiguration" field. * **selectiveModeConfiguration** *(dict) --* Contains configurations for the metadata fields to include or exclude when considering reranking. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "fieldsToExclude", "fieldsToInclude". * **fieldsToExclude** *(list) --* An array of objects, each of which specifies a metadata field to exclude from consideration when reranking. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **fieldsToInclude** *(list) --* An array of objects, each of which specifies a metadata field to include in consideration when reranking. The remaining metadata fields are ignored. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **modelConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for the reranker model. * **additionalModelRequestFields** *(dict) --* A JSON object whose keys are request fields for the model and whose values are values for those fields. * *(string) --* * (*document*) -- * **modelArn** *(string) --* **[REQUIRED]** The ARN of the reranker model to use. * **numberOfRerankedResults** *(integer) --* The number of results to return after reranking. * **type** *(string) --* **[REQUIRED]** The type of reranker model. * **orchestrationType** (*string*) -- Specifies the type of orchestration strategy for the agent. This is set to DEFAULT orchestration type, by default. * **promptCreationConfigurations** (*dict*) -- Specifies parameters that control how the service populates the agent prompt for an "InvokeInlineAgent" request. You can control which aspects of previous invocations in the same agent session the service uses to populate the agent prompt. This gives you more granular control over the contextual history that is used to process the current request. * **excludePreviousThinkingSteps** *(boolean) --* If "true", the service removes any content between "" tags from previous conversations in an agent session. The service will only remove content from already processed turns. This helps you remove content which might not be useful for current and subsequent invocations. This can reduce the input token count and potentially save costs. The default value is "false". * **previousConversationTurnsToInclude** *(integer) --* The number of previous conversations from the ongoing agent session to include in the conversation history of the agent prompt, during the current invocation. This gives you more granular control over the context that the model is made aware of, and helps the model remove older context which is no longer useful during the ongoing agent session. * **promptOverrideConfiguration** (*dict*) -- Configurations for advanced prompts used to override the default prompts to enhance the accuracy of the inline agent. * **overrideLambda** *(string) --* The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence. If you specify this field, at least one of the "promptConfigurations" must contain a "parserMode" value that is set to "OVERRIDDEN". For more information, see Parser Lambda function in Amazon Bedrock Agents. * **promptConfigurations** *(list) --* **[REQUIRED]** Contains configurations to override a prompt template in one part of an agent sequence. For more information, see Advanced prompts. * *(dict) --* Contains configurations to override a prompt template in one part of an agent sequence. For more information, see Advanced prompts. * **additionalModelRequestFields** (*document*) -- If the Converse or ConverseStream operations support the model, "additionalModelRequestFields" contains additional inference parameters, beyond the base set of inference parameters in the "inferenceConfiguration" field. For more information, see *Inference request parameters and response fields for foundation models* in the Amazon Bedrock user guide. * **basePromptTemplate** *(string) --* Defines the prompt template with which to replace the default prompt template. You can use placeholder variables in the base prompt template to customize the prompt. For more information, see Prompt template placeholder variables. For more information, see Configure the prompt templates. * **foundationModel** *(string) --* The foundation model to use. * **inferenceConfiguration** *(dict) --* Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the "promptType". For more information, see Inference parameters for foundation models. * **maximumLength** *(integer) --* The maximum number of tokens allowed in the generated response. * **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) --* * **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. * **topK** *(integer) --* While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for "topK" is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set "topK" to 50, the model selects the next token from among the top 50 most likely choices. * **topP** *(float) --* While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for "Top P" determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set "topP" to 0.8, the model only selects the next token from the top 80% of the probability distribution of next tokens. * **parserMode** *(string) --* Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the "promptType". If you set the field as "OVERRIDDEN", the "overrideLambda" field in the PromptOverrideConfiguration must be specified with the ARN of a Lambda function. * **promptCreationMode** *(string) --* Specifies whether to override the default prompt template for this "promptType". Set this value to "OVERRIDDEN" to use the prompt that you provide in the "basePromptTemplate". If you leave it as "DEFAULT", the agent uses a default prompt template. * **promptState** *(string) --* Specifies whether to allow the inline agent to carry out the step specified in the "promptType". If you set this value to "DISABLED", the agent skips that step. The default state for each "promptType" is as follows. * "PRE_PROCESSING" – "ENABLED" * "ORCHESTRATION" – "ENABLED" * "KNOWLEDGE_BASE_RESPONSE_GENERATION" – "ENABLED" * "POST_PROCESSING" – "DISABLED" * **promptType** *(string) --* The step in the agent sequence that this prompt configuration applies to. * **sessionId** (*string*) -- **[REQUIRED]** The unique identifier of the session. Use the same value across requests to continue the same conversation. * **streamingConfigurations** (*dict*) -- Specifies the configurations for streaming. Note: To use agent streaming, you need permissions to perform the "bedrock:InvokeModelWithResponseStream" action. * **applyGuardrailInterval** *(integer) --* The guardrail interval to apply as response is generated. By default, the guardrail interval is set to 50 characters. If a larger interval is specified, the response will be generated in larger chunks with fewer "ApplyGuardrail" calls. The following examples show the response generated for *Hello, I am an agent* input string. **Example response in chunks: Interval set to 3 characters** "'Hel', 'lo, ','I am', ' an', ' Age', 'nt'" Each chunk has at least 3 characters except for the last chunk **Example response in chunks: Interval set to 20 or more characters** "Hello, I am an Agent" * **streamFinalResponse** *(boolean) --* Specifies whether to enable streaming for the final response. This is set to "false" by default. 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** { 'completion': EventStream({ 'accessDeniedException': { 'message': 'string' }, 'badGatewayException': { 'message': 'string', 'resourceName': 'string' }, 'chunk': { 'attribution': { 'citations': [ { 'generatedResponsePart': { 'textResponsePart': { 'span': { 'end': 123, 'start': 123 }, 'text': 'string' } }, 'retrievedReferences': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, ] }, 'bytes': b'bytes' }, 'conflictException': { 'message': 'string' }, 'dependencyFailedException': { 'message': 'string', 'resourceName': 'string' }, 'files': { 'files': [ { 'bytes': b'bytes', 'name': 'string', 'type': 'string' }, ] }, 'internalServerException': { 'message': 'string', 'reason': 'string' }, 'resourceNotFoundException': { 'message': 'string' }, 'returnControl': { 'invocationId': 'string', 'invocationInputs': [ { 'apiInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'apiPath': 'string', 'collaboratorName': 'string', 'httpMethod': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': { 'properties': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } } } }, 'functionInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string', 'function': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, ] }, 'serviceQuotaExceededException': { 'message': 'string' }, 'throttlingException': { 'message': 'string' }, 'trace': { 'callerChain': [ { 'agentAliasArn': 'string' }, ], 'collaboratorName': 'string', 'eventTime': datetime(2015, 1, 1), 'sessionId': 'string', 'trace': { 'customOrchestrationTrace': { 'event': { 'text': 'string' }, 'traceId': 'string' }, 'failureTrace': { 'failureCode': 123, 'failureReason': 'string', 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'traceId': 'string' }, 'guardrailTrace': { 'action': 'INTERVENED'|'NONE', 'inputAssessments': [ { 'contentPolicy': { 'filters': [ { 'action': 'BLOCKED', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK' }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'action': 'BLOCKED'|'ANONYMIZED', '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' }, ], 'regexes': [ { 'action': 'BLOCKED'|'ANONYMIZED', 'match': 'string', 'name': 'string', 'regex': 'string' }, ] }, 'topicPolicy': { 'topics': [ { 'action': 'BLOCKED', 'name': 'string', 'type': 'DENY' }, ] }, 'wordPolicy': { 'customWords': [ { 'action': 'BLOCKED', 'match': 'string' }, ], 'managedWordLists': [ { 'action': 'BLOCKED', 'match': 'string', 'type': 'PROFANITY' }, ] } }, ], 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'outputAssessments': [ { 'contentPolicy': { 'filters': [ { 'action': 'BLOCKED', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK' }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'action': 'BLOCKED'|'ANONYMIZED', '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' }, ], 'regexes': [ { 'action': 'BLOCKED'|'ANONYMIZED', 'match': 'string', 'name': 'string', 'regex': 'string' }, ] }, 'topicPolicy': { 'topics': [ { 'action': 'BLOCKED', 'name': 'string', 'type': 'DENY' }, ] }, 'wordPolicy': { 'customWords': [ { 'action': 'BLOCKED', 'match': 'string' }, ], 'managedWordLists': [ { 'action': 'BLOCKED', 'match': 'string', 'type': 'PROFANITY' }, ] } }, ], 'traceId': 'string' }, 'orchestrationTrace': { 'invocationInput': { 'actionGroupInvocationInput': { 'actionGroupName': 'string', 'apiPath': 'string', 'executionType': 'LAMBDA'|'RETURN_CONTROL', 'function': 'string', 'invocationId': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, 'verb': 'string' }, 'agentCollaboratorInvocationInput': { 'agentCollaboratorAliasArn': 'string', 'agentCollaboratorName': 'string', 'input': { 'returnControlResults': { 'invocationId': 'string', 'returnControlInvocationResults': [ { 'apiResult': { 'actionGroup': 'string', 'agentId': 'string', 'apiPath': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'httpMethod': 'string', 'httpStatusCode': 123, 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' }, 'functionResult': { 'actionGroup': 'string', 'agentId': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'function': 'string', 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' } }, ] }, 'text': 'string', 'type': 'TEXT'|'RETURN_CONTROL' } }, 'codeInterpreterInvocationInput': { 'code': 'string', 'files': [ 'string', ] }, 'invocationType': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'FINISH'|'ACTION_GROUP_CODE_INTERPRETER'|'AGENT_COLLABORATOR', 'knowledgeBaseLookupInput': { 'knowledgeBaseId': 'string', 'text': 'string' }, 'traceId': 'string' }, 'modelInvocationInput': { 'foundationModel': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'rawResponse': { 'content': 'string' }, 'reasoningContent': { 'reasoningText': { 'signature': 'string', 'text': 'string' }, 'redactedContent': b'bytes' }, 'traceId': 'string' }, 'observation': { 'actionGroupInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'text': 'string' }, 'agentCollaboratorInvocationOutput': { 'agentCollaboratorAliasArn': 'string', 'agentCollaboratorName': 'string', 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'output': { 'returnControlPayload': { 'invocationId': 'string', 'invocationInputs': [ { 'apiInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'apiPath': 'string', 'collaboratorName': 'string', 'httpMethod': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': { 'properties': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } } } }, 'functionInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string', 'function': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, ] }, 'text': 'string', 'type': 'TEXT'|'RETURN_CONTROL' } }, 'codeInterpreterInvocationOutput': { 'executionError': 'string', 'executionOutput': 'string', 'executionTimeout': True|False, 'files': [ 'string', ], 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'finalResponse': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'text': 'string' }, 'knowledgeBaseLookupOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'retrievedReferences': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, 'repromptResponse': { 'source': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'PARSER', 'text': 'string' }, 'traceId': 'string', 'type': 'ACTION_GROUP'|'AGENT_COLLABORATOR'|'KNOWLEDGE_BASE'|'FINISH'|'ASK_USER'|'REPROMPT' }, 'rationale': { 'text': 'string', 'traceId': 'string' } }, 'postProcessingTrace': { 'modelInvocationInput': { 'foundationModel': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'parsedResponse': { 'text': 'string' }, 'rawResponse': { 'content': 'string' }, 'reasoningContent': { 'reasoningText': { 'signature': 'string', 'text': 'string' }, 'redactedContent': b'bytes' }, 'traceId': 'string' } }, 'preProcessingTrace': { 'modelInvocationInput': { 'foundationModel': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'parsedResponse': { 'isValid': True|False, 'rationale': 'string' }, 'rawResponse': { 'content': 'string' }, 'reasoningContent': { 'reasoningText': { 'signature': 'string', 'text': 'string' }, 'redactedContent': b'bytes' }, 'traceId': 'string' } }, 'routingClassifierTrace': { 'invocationInput': { 'actionGroupInvocationInput': { 'actionGroupName': 'string', 'apiPath': 'string', 'executionType': 'LAMBDA'|'RETURN_CONTROL', 'function': 'string', 'invocationId': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, 'verb': 'string' }, 'agentCollaboratorInvocationInput': { 'agentCollaboratorAliasArn': 'string', 'agentCollaboratorName': 'string', 'input': { 'returnControlResults': { 'invocationId': 'string', 'returnControlInvocationResults': [ { 'apiResult': { 'actionGroup': 'string', 'agentId': 'string', 'apiPath': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'httpMethod': 'string', 'httpStatusCode': 123, 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' }, 'functionResult': { 'actionGroup': 'string', 'agentId': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'function': 'string', 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' } }, ] }, 'text': 'string', 'type': 'TEXT'|'RETURN_CONTROL' } }, 'codeInterpreterInvocationInput': { 'code': 'string', 'files': [ 'string', ] }, 'invocationType': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'FINISH'|'ACTION_GROUP_CODE_INTERPRETER'|'AGENT_COLLABORATOR', 'knowledgeBaseLookupInput': { 'knowledgeBaseId': 'string', 'text': 'string' }, 'traceId': 'string' }, 'modelInvocationInput': { 'foundationModel': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'rawResponse': { 'content': 'string' }, 'traceId': 'string' }, 'observation': { 'actionGroupInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'text': 'string' }, 'agentCollaboratorInvocationOutput': { 'agentCollaboratorAliasArn': 'string', 'agentCollaboratorName': 'string', 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'output': { 'returnControlPayload': { 'invocationId': 'string', 'invocationInputs': [ { 'apiInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'apiPath': 'string', 'collaboratorName': 'string', 'httpMethod': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': { 'properties': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } } } }, 'functionInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string', 'function': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, ] }, 'text': 'string', 'type': 'TEXT'|'RETURN_CONTROL' } }, 'codeInterpreterInvocationOutput': { 'executionError': 'string', 'executionOutput': 'string', 'executionTimeout': True|False, 'files': [ 'string', ], 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'finalResponse': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'text': 'string' }, 'knowledgeBaseLookupOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'retrievedReferences': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, 'repromptResponse': { 'source': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'PARSER', 'text': 'string' }, 'traceId': 'string', 'type': 'ACTION_GROUP'|'AGENT_COLLABORATOR'|'KNOWLEDGE_BASE'|'FINISH'|'ASK_USER'|'REPROMPT' } } } }, 'validationException': { 'message': 'string' } }), 'contentType': 'string', 'sessionId': 'string' } **Response Structure** # This section is too large to render. # Please see the AWS API Documentation linked below. AWS API Documentation **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / end_session end_session *********** AgentsforBedrockRuntime.Client.end_session(**kwargs) Ends the session. After you end a session, you can still access its content but you can’t add to it. To delete the session and it's content, you use the DeleteSession API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. See also: AWS API Documentation **Request Syntax** response = client.end_session( sessionIdentifier='string' ) Parameters: **sessionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier for the session to end. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). Return type: dict Returns: **Response Syntax** { 'sessionArn': 'string', 'sessionId': 'string', 'sessionStatus': 'ACTIVE'|'EXPIRED'|'ENDED' } **Response Structure** * *(dict) --* * **sessionArn** *(string) --* The Amazon Resource Name (ARN) of the session you ended. * **sessionId** *(string) --* The unique identifier of the session you ended. * **sessionStatus** *(string) --* The current status of the session you ended. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / delete_session delete_session ************** AgentsforBedrockRuntime.Client.delete_session(**kwargs) Deletes a session that you ended. You can't delete a session with an "ACTIVE" status. To delete an active session, you must first end it with the EndSession API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. See also: AWS API Documentation **Request Syntax** response = client.delete_session( sessionIdentifier='string' ) Parameters: **sessionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier for the session to be deleted. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / list_sessions list_sessions ************* AgentsforBedrockRuntime.Client.list_sessions(**kwargs) Lists all sessions in your Amazon Web Services account. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. See also: AWS API Documentation **Request Syntax** response = client.list_sessions( maxResults=123, nextToken='string' ) Parameters: * **maxResults** (*integer*) -- The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the "nextToken" field when making another request to return the next batch of results. * **nextToken** (*string*) -- If the total number of results is greater than the "maxResults" value provided in the request, enter the token returned in the "nextToken" field in the response in this field to return the next batch of results. Return type: dict Returns: **Response Syntax** { 'nextToken': 'string', 'sessionSummaries': [ { 'createdAt': datetime(2015, 1, 1), 'lastUpdatedAt': datetime(2015, 1, 1), 'sessionArn': 'string', 'sessionId': 'string', 'sessionStatus': 'ACTIVE'|'EXPIRED'|'ENDED' }, ] } **Response Structure** * *(dict) --* * **nextToken** *(string) --* If the total number of results is greater than the "maxResults" value provided in the request, use this token when making another request in the "nextToken" field to return the next batch of results. * **sessionSummaries** *(list) --* A list of summaries for each session in your Amazon Web Services account. * *(dict) --* Contains details about a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. * **createdAt** *(datetime) --* The timestamp for when the session was created. * **lastUpdatedAt** *(datetime) --* The timestamp for when the session was last modified. * **sessionArn** *(string) --* The Amazon Resource Name (ARN) of the session. * **sessionId** *(string) --* The unique identifier for the session. * **sessionStatus** *(string) --* The current status of the session. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / get_invocation_step get_invocation_step ******************* AgentsforBedrockRuntime.Client.get_invocation_step(**kwargs) Retrieves the details of a specific invocation step within an invocation in a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. See also: AWS API Documentation **Request Syntax** response = client.get_invocation_step( invocationIdentifier='string', invocationStepId='string', sessionIdentifier='string' ) Parameters: * **invocationIdentifier** (*string*) -- **[REQUIRED]** The unique identifier for the invocation in UUID format. * **invocationStepId** (*string*) -- **[REQUIRED]** The unique identifier (in UUID format) for the specific invocation step to retrieve. * **sessionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier for the invocation step's associated session. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). Return type: dict Returns: **Response Syntax** { 'invocationStep': { 'invocationId': 'string', 'invocationStepId': 'string', 'invocationStepTime': datetime(2015, 1, 1), 'payload': { 'contentBlocks': [ { 'image': { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string' } } }, 'text': 'string' }, ] }, 'sessionId': 'string' } } **Response Structure** * *(dict) --* * **invocationStep** *(dict) --* The complete details of the requested invocation step. * **invocationId** *(string) --* The unique identifier (in UUID format) for the invocation that includes the invocation step. * **invocationStepId** *(string) --* The unique identifier (in UUID format) for the invocation step. * **invocationStepTime** *(datetime) --* The timestamp for when the invocation step was created. * **payload** *(dict) --* Payload content, such as text and images, for the invocation step. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "contentBlocks". 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'} * **contentBlocks** *(list) --* The content for the invocation step. * *(dict) --* A block of content that you pass to, or receive from, a Amazon Bedrock session in an invocation step. You pass the content to a session in the "payLoad" of the PutInvocationStep API operation. You retrieve the content with the GetInvocationStep API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "image", "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'} * **image** *(dict) --* The image in the invocation step. * **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 Amazon Web Services SDK, you don't need to encode the image bytes in base64. * **s3Location** *(dict) --* The path to the Amazon S3 bucket where the image is stored. * **uri** *(string) --* The path to the Amazon S3 bucket where the image is stored. * **text** *(string) --* The text in the invocation step. * **sessionId** *(string) --* The unique identifier of the session containing the invocation step. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / put_invocation_step put_invocation_step ******************* AgentsforBedrockRuntime.Client.put_invocation_step(**kwargs) Add an invocation step to an invocation in a session. An invocation step stores fine-grained state checkpoints, including text and images, for each interaction. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. Related APIs: * GetInvocationStep * ListInvocationSteps * ListInvocations * ListSessions See also: AWS API Documentation **Request Syntax** response = client.put_invocation_step( invocationIdentifier='string', invocationStepId='string', invocationStepTime=datetime(2015, 1, 1), payload={ 'contentBlocks': [ { 'image': { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes', 's3Location': { 'uri': 'string' } } }, 'text': 'string' }, ] }, sessionIdentifier='string' ) Parameters: * **invocationIdentifier** (*string*) -- **[REQUIRED]** The unique identifier (in UUID format) of the invocation to add the invocation step to. * **invocationStepId** (*string*) -- The unique identifier of the invocation step in UUID format. * **invocationStepTime** (*datetime*) -- **[REQUIRED]** The timestamp for when the invocation step occurred. * **payload** (*dict*) -- **[REQUIRED]** The payload for the invocation step, including text and images for the interaction. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "contentBlocks". * **contentBlocks** *(list) --* The content for the invocation step. * *(dict) --* A block of content that you pass to, or receive from, a Amazon Bedrock session in an invocation step. You pass the content to a session in the "payLoad" of the PutInvocationStep API operation. You retrieve the content with the GetInvocationStep API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "image", "text". * **image** *(dict) --* The image in the invocation step. * **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 Amazon Web Services SDK, you don't need to encode the image bytes in base64. * **s3Location** *(dict) --* The path to the Amazon S3 bucket where the image is stored. * **uri** *(string) --* **[REQUIRED]** The path to the Amazon S3 bucket where the image is stored. * **text** *(string) --* The text in the invocation step. * **sessionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier for the session to add the invocation step to. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). Return type: dict Returns: **Response Syntax** { 'invocationStepId': 'string' } **Response Structure** * *(dict) --* * **invocationStepId** *(string) --* The unique identifier of the invocation step in UUID format. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / get_flow_execution get_flow_execution ****************** AgentsforBedrockRuntime.Client.get_flow_execution(**kwargs) Retrieves details about a specific flow execution, including its status, start and end times, and any errors that occurred during execution. See also: AWS API Documentation **Request Syntax** response = client.get_flow_execution( executionIdentifier='string', flowAliasIdentifier='string', flowIdentifier='string' ) Parameters: * **executionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow execution to retrieve. * **flowAliasIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow alias used for the execution. * **flowIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow. Return type: dict Returns: **Response Syntax** { 'endedAt': datetime(2015, 1, 1), 'errors': [ { 'error': 'ExecutionTimedOut', 'message': 'string', 'nodeName': 'string' }, ], 'executionArn': 'string', 'flowAliasIdentifier': 'string', 'flowIdentifier': 'string', 'flowVersion': 'string', 'startedAt': datetime(2015, 1, 1), 'status': 'Running'|'Succeeded'|'Failed'|'TimedOut'|'Aborted' } **Response Structure** * *(dict) --* * **endedAt** *(datetime) --* The timestamp when the flow execution ended. This field is only populated when the execution has completed, failed, timed out, or been aborted. * **errors** *(list) --* A list of errors that occurred during the flow execution. Each error includes an error code, message, and the node where the error occurred, if applicable. * *(dict) --* Contains information about an error that occurred during an flow execution. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **error** *(string) --* The error code for the type of error that occurred. * **message** *(string) --* A descriptive message that provides details about the error. * **nodeName** *(string) --* The name of the node in the flow where the error occurred (if applicable). * **executionArn** *(string) --* The Amazon Resource Name (ARN) that uniquely identifies the flow execution. * **flowAliasIdentifier** *(string) --* The unique identifier of the flow alias used for the execution. * **flowIdentifier** *(string) --* The unique identifier of the flow. * **flowVersion** *(string) --* The version of the flow used for the execution. * **startedAt** *(datetime) --* The timestamp when the flow execution started. * **status** *(string) --* The current status of the flow execution. Flow executions time out after 24 hours. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / stop_flow_execution stop_flow_execution ******************* AgentsforBedrockRuntime.Client.stop_flow_execution(**kwargs) Stops an Amazon Bedrock flow's execution. This operation prevents further processing of the flow and changes the execution status to "Aborted". See also: AWS API Documentation **Request Syntax** response = client.stop_flow_execution( executionIdentifier='string', flowAliasIdentifier='string', flowIdentifier='string' ) Parameters: * **executionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow execution to stop. * **flowAliasIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow alias used for the execution. * **flowIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow. Return type: dict Returns: **Response Syntax** { 'executionArn': 'string', 'status': 'Running'|'Succeeded'|'Failed'|'TimedOut'|'Aborted' } **Response Structure** * *(dict) --* * **executionArn** *(string) --* The Amazon Resource Name (ARN) that uniquely identifies the flow execution that was stopped. * **status** *(string) --* The updated status of the flow execution after the stop request. This will typically be ABORTED if the execution was successfully stopped. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / create_session create_session ************** AgentsforBedrockRuntime.Client.create_session(**kwargs) Creates a session to temporarily store conversations for generative AI (GenAI) applications built with open-source frameworks such as LangGraph and LlamaIndex. Sessions enable you to save the state of conversations at checkpoints, with the added security and infrastructure of Amazon Web Services. For more information, see Store and retrieve conversation history and context with Amazon Bedrock sessions. By default, Amazon Bedrock uses Amazon Web Services-managed keys for session encryption, including session metadata, or you can use your own KMS key. For more information, see Amazon Bedrock session encryption. Note: You use a session to store state and conversation history for generative AI applications built with open-source frameworks. For Amazon Bedrock Agents, the service automatically manages conversation context and associates them with the agent-specific sessionId you specify in the InvokeAgent API operation. Related APIs: * ListSessions * GetSession * EndSession * DeleteSession See also: AWS API Documentation **Request Syntax** response = client.create_session( encryptionKeyArn='string', sessionMetadata={ 'string': 'string' }, tags={ 'string': 'string' } ) Parameters: * **encryptionKeyArn** (*string*) -- The Amazon Resource Name (ARN) of the KMS key to use to encrypt the session data. The user or role creating the session must have permission to use the key. For more information, see Amazon Bedrock session encryption. * **sessionMetadata** (*dict*) -- A map of key-value pairs containing attributes to be persisted across the session. For example, the user's ID, their language preference, and the type of device they are using. * *(string) --* * *(string) --* * **tags** (*dict*) -- Specify the key-value pairs for the tags that you want to attach to the session. * *(string) --* Key of a tag * *(string) --* Value of a tag Return type: dict Returns: **Response Syntax** { 'createdAt': datetime(2015, 1, 1), 'sessionArn': 'string', 'sessionId': 'string', 'sessionStatus': 'ACTIVE'|'EXPIRED'|'ENDED' } **Response Structure** * *(dict) --* * **createdAt** *(datetime) --* The timestamp for when the session was created. * **sessionArn** *(string) --* The Amazon Resource Name (ARN) of the created session. * **sessionId** *(string) --* The unique identifier for the session. * **sessionStatus** *(string) --* The current status of the session. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / list_tags_for_resource list_tags_for_resource ********************** AgentsforBedrockRuntime.Client.list_tags_for_resource(**kwargs) List all the tags for the resource you specify. See also: AWS API Documentation **Request Syntax** response = client.list_tags_for_resource( resourceArn='string' ) Parameters: **resourceArn** (*string*) -- **[REQUIRED]** The Amazon Resource Name (ARN) of the resource for which to list tags. Return type: dict Returns: **Response Syntax** { 'tags': { 'string': 'string' } } **Response Structure** * *(dict) --* * **tags** *(dict) --* The key-value pairs for the tags associated with the resource. * *(string) --* Key of a tag * *(string) --* Value of a tag **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / untag_resource untag_resource ************** AgentsforBedrockRuntime.Client.untag_resource(**kwargs) Remove tags from a resource. See also: AWS API Documentation **Request Syntax** response = client.untag_resource( resourceArn='string', tagKeys=[ 'string', ] ) Parameters: * **resourceArn** (*string*) -- **[REQUIRED]** The Amazon Resource Name (ARN) of the resource from which to remove tags. * **tagKeys** (*list*) -- **[REQUIRED]** A list of keys of the tags to remove from the resource. * *(string) --* Key of a tag Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / get_waiter get_waiter ********** AgentsforBedrockRuntime.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" AgentsforBedrockRuntime / Client / list_invocations list_invocations **************** AgentsforBedrockRuntime.Client.list_invocations(**kwargs) Lists all invocations associated with a specific session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. See also: AWS API Documentation **Request Syntax** response = client.list_invocations( maxResults=123, nextToken='string', sessionIdentifier='string' ) Parameters: * **maxResults** (*integer*) -- The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the "nextToken" field when making another request to return the next batch of results. * **nextToken** (*string*) -- If the total number of results is greater than the "maxResults" value provided in the request, enter the token returned in the "nextToken" field in the response in this field to return the next batch of results. * **sessionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier for the session to list invocations for. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). Return type: dict Returns: **Response Syntax** { 'invocationSummaries': [ { 'createdAt': datetime(2015, 1, 1), 'invocationId': 'string', 'sessionId': 'string' }, ], 'nextToken': 'string' } **Response Structure** * *(dict) --* * **invocationSummaries** *(list) --* A list of invocation summaries associated with the session. * *(dict) --* Contains details about an invocation in a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. * **createdAt** *(datetime) --* The timestamp for when the invocation was created. * **invocationId** *(string) --* A unique identifier for the invocation in UUID format. * **sessionId** *(string) --* The unique identifier for the session associated with the invocation. * **nextToken** *(string) --* If the total number of results is greater than the "maxResults" value provided in the request, use this token when making another request in the "nextToken" field to return the next batch of results. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / create_invocation create_invocation ***************** AgentsforBedrockRuntime.Client.create_invocation(**kwargs) Creates a new invocation within a session. An invocation groups the related invocation steps that store the content from a conversation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. Related APIs * ListInvocations * ListSessions * GetSession See also: AWS API Documentation **Request Syntax** response = client.create_invocation( description='string', invocationId='string', sessionIdentifier='string' ) Parameters: * **description** (*string*) -- A description for the interactions in the invocation. For example, "User asking about weather in Seattle". * **invocationId** (*string*) -- A unique identifier for the invocation in UUID format. * **sessionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier for the associated session for the invocation. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). Return type: dict Returns: **Response Syntax** { 'createdAt': datetime(2015, 1, 1), 'invocationId': 'string', 'sessionId': 'string' } **Response Structure** * *(dict) --* * **createdAt** *(datetime) --* The timestamp for when the invocation was created. * **invocationId** *(string) --* The unique identifier for the invocation. * **sessionId** *(string) --* The unique identifier for the session associated with the invocation. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / get_execution_flow_snapshot get_execution_flow_snapshot *************************** AgentsforBedrockRuntime.Client.get_execution_flow_snapshot(**kwargs) Retrieves the flow definition snapshot used for a flow execution. The snapshot represents the flow metadata and definition as it existed at the time the execution was started. Note that even if the flow is edited after an execution starts, the snapshot connected to the execution remains unchanged. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. See also: AWS API Documentation **Request Syntax** response = client.get_execution_flow_snapshot( executionIdentifier='string', flowAliasIdentifier='string', flowIdentifier='string' ) Parameters: * **executionIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow execution. * **flowAliasIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow alias used for the flow execution. * **flowIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow. Return type: dict Returns: **Response Syntax** { 'customerEncryptionKeyArn': 'string', 'definition': 'string', 'executionRoleArn': 'string', 'flowAliasIdentifier': 'string', 'flowIdentifier': 'string', 'flowVersion': 'string' } **Response Structure** * *(dict) --* * **customerEncryptionKeyArn** *(string) --* The Amazon Resource Name (ARN) of the customer managed KMS key that's used to encrypt the flow snapshot. * **definition** *(string) --* The flow definition used for the flow execution, including the nodes, connections, and configuration at the time when the execution started. The definition returns as a string that follows the structure of a FlowDefinition object. * **executionRoleArn** *(string) --* The Amazon Resource Name (ARN) of the IAM service role that's used by the flow execution. * **flowAliasIdentifier** *(string) --* The unique identifier of the flow alias used for the flow execution. * **flowIdentifier** *(string) --* The unique identifier of the flow. * **flowVersion** *(string) --* The version of the flow used for the flow execution. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / retrieve_and_generate_stream retrieve_and_generate_stream **************************** AgentsforBedrockRuntime.Client.retrieve_and_generate_stream(**kwargs) Queries a knowledge base and generates responses based on the retrieved results, with output in streaming format. Note: The CLI doesn't support streaming operations in Amazon Bedrock, including "InvokeModelWithResponseStream". This operation requires permission for the "bedrock:RetrieveAndGenerate" action. See also: AWS API Documentation **Request Syntax** response = client.retrieve_and_generate_stream( input={ 'text': 'string' }, retrieveAndGenerateConfiguration={ 'externalSourcesConfiguration': { 'generationConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'guardrailConfiguration': { 'guardrailId': 'string', 'guardrailVersion': 'string' }, 'inferenceConfig': { 'textInferenceConfig': { 'maxTokens': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topP': ... } }, 'performanceConfig': { 'latency': 'standard'|'optimized' }, 'promptTemplate': { 'textPromptTemplate': 'string' } }, 'modelArn': 'string', 'sources': [ { 'byteContent': { 'contentType': 'string', 'data': b'bytes', 'identifier': 'string' }, 's3Location': { 'uri': 'string' }, 'sourceType': 'S3'|'BYTE_CONTENT' }, ] }, 'knowledgeBaseConfiguration': { 'generationConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'guardrailConfiguration': { 'guardrailId': 'string', 'guardrailVersion': 'string' }, 'inferenceConfig': { 'textInferenceConfig': { 'maxTokens': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topP': ... } }, 'performanceConfig': { 'latency': 'standard'|'optimized' }, 'promptTemplate': { 'textPromptTemplate': 'string' } }, 'knowledgeBaseId': 'string', 'modelArn': 'string', 'orchestrationConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'inferenceConfig': { 'textInferenceConfig': { 'maxTokens': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topP': ... } }, 'performanceConfig': { 'latency': 'standard'|'optimized' }, 'promptTemplate': { 'textPromptTemplate': 'string' }, 'queryTransformationConfiguration': { 'type': 'QUERY_DECOMPOSITION' } }, 'retrievalConfiguration': { 'vectorSearchConfiguration': { 'filter': { 'andAll': [ {'... recursive ...'}, ], 'equals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'in': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'listContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notIn': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'orAll': [ {'... recursive ...'}, ], 'startsWith': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'stringContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None } }, 'implicitFilterConfiguration': { 'metadataAttributes': [ { 'description': 'string', 'key': 'string', 'type': 'STRING'|'NUMBER'|'BOOLEAN'|'STRING_LIST' }, ], 'modelArn': 'string' }, 'numberOfResults': 123, 'overrideSearchType': 'HYBRID'|'SEMANTIC', 'rerankingConfiguration': { 'bedrockRerankingConfiguration': { 'metadataConfiguration': { 'selectionMode': 'SELECTIVE'|'ALL', 'selectiveModeConfiguration': { 'fieldsToExclude': [ { 'fieldName': 'string' }, ], 'fieldsToInclude': [ { 'fieldName': 'string' }, ] } }, 'modelConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'modelArn': 'string' }, 'numberOfRerankedResults': 123 }, 'type': 'BEDROCK_RERANKING_MODEL' } } } }, 'type': 'KNOWLEDGE_BASE'|'EXTERNAL_SOURCES' }, sessionConfiguration={ 'kmsKeyArn': 'string' }, sessionId='string' ) Parameters: * **input** (*dict*) -- **[REQUIRED]** Contains the query to be made to the knowledge base. * **text** *(string) --* **[REQUIRED]** The query made to the knowledge base. * **retrieveAndGenerateConfiguration** (*dict*) -- Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations. * **externalSourcesConfiguration** *(dict) --* The configuration for the external source wrapper object in the "retrieveAndGenerate" function. * **generationConfiguration** *(dict) --* The prompt used with the external source wrapper object with the "retrieveAndGenerate" function. * **additionalModelRequestFields** *(dict) --* Additional model parameters and their corresponding values not included in the textInferenceConfig structure for an external source. Takes in custom model parameters specific to the language model being used. * *(string) --* * (*document*) -- * **guardrailConfiguration** *(dict) --* The configuration details for the guardrail. * **guardrailId** *(string) --* **[REQUIRED]** The unique identifier for the guardrail. * **guardrailVersion** *(string) --* **[REQUIRED]** The version of the guardrail. * **inferenceConfig** *(dict) --* Configuration settings for inference when using RetrieveAndGenerate to generate responses while using an external source. * **textInferenceConfig** *(dict) --* Configuration settings specific to text generation while generating responses using RetrieveAndGenerate. * **maxTokens** *(integer) --* The maximum number of tokens to generate in the output text. Do not use the minimum of 0 or the maximum of 65536. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * **stopSequences** *(list) --* A list of sequences of characters that, if generated, will cause the model to stop generating further tokens. Do not use a minimum length of 1 or a maximum length of 1000. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * *(string) --* * **temperature** *(float) --* Controls the random-ness of text generated by the language model, influencing how much the model sticks to the most predictable next words versus exploring more surprising options. A lower temperature value (e.g. 0.2 or 0.3) makes model outputs more deterministic or predictable, while a higher temperature (e.g. 0.8 or 0.9) makes the outputs more creative or unpredictable. * **topP** *(float) --* A probability distribution threshold which controls what the model considers for the set of possible next tokens. The model will only consider the top p% of the probability distribution when generating the next token. * **performanceConfig** *(dict) --* The latency configuration for the model. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". * **promptTemplate** *(dict) --* Contain the textPromptTemplate string for the external source wrapper object. * **textPromptTemplate** *(string) --* The template for the prompt that's sent to the model for response generation. You can include prompt placeholders, which become replaced before the prompt is sent to the model to provide instructions and context to the model. In addition, you can include XML tags to delineate meaningful sections of the prompt template. For more information, see the following resources: * Knowledge base prompt templates * Use XML tags with Anthropic Claude models * **modelArn** *(string) --* **[REQUIRED]** The model Amazon Resource Name (ARN) for the external source wrapper object in the "retrieveAndGenerate" function. * **sources** *(list) --* **[REQUIRED]** The document for the external source wrapper object in the "retrieveAndGenerate" function. * *(dict) --* The unique external source of the content contained in the wrapper object. * **byteContent** *(dict) --* The identifier, contentType, and data of the external source wrapper object. * **contentType** *(string) --* **[REQUIRED]** The MIME type of the document contained in the wrapper object. * **data** *(bytes) --* **[REQUIRED]** The byte value of the file to upload, encoded as a Base-64 string. * **identifier** *(string) --* **[REQUIRED]** The file name of the document contained in the wrapper object. * **s3Location** *(dict) --* The S3 location of the external source wrapper object. * **uri** *(string) --* **[REQUIRED]** The file location of the S3 wrapper object. * **sourceType** *(string) --* **[REQUIRED]** The source type of the external source wrapper object. * **knowledgeBaseConfiguration** *(dict) --* Contains details about the knowledge base for retrieving information and generating responses. * **generationConfiguration** *(dict) --* Contains configurations for response generation based on the knowledge base query results. * **additionalModelRequestFields** *(dict) --* Additional model parameters and corresponding values not included in the textInferenceConfig structure for a knowledge base. This allows users to provide custom model parameters specific to the language model being used. * *(string) --* * (*document*) -- * **guardrailConfiguration** *(dict) --* The configuration details for the guardrail. * **guardrailId** *(string) --* **[REQUIRED]** The unique identifier for the guardrail. * **guardrailVersion** *(string) --* **[REQUIRED]** The version of the guardrail. * **inferenceConfig** *(dict) --* Configuration settings for inference when using RetrieveAndGenerate to generate responses while using a knowledge base as a source. * **textInferenceConfig** *(dict) --* Configuration settings specific to text generation while generating responses using RetrieveAndGenerate. * **maxTokens** *(integer) --* The maximum number of tokens to generate in the output text. Do not use the minimum of 0 or the maximum of 65536. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * **stopSequences** *(list) --* A list of sequences of characters that, if generated, will cause the model to stop generating further tokens. Do not use a minimum length of 1 or a maximum length of 1000. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * *(string) --* * **temperature** *(float) --* Controls the random-ness of text generated by the language model, influencing how much the model sticks to the most predictable next words versus exploring more surprising options. A lower temperature value (e.g. 0.2 or 0.3) makes model outputs more deterministic or predictable, while a higher temperature (e.g. 0.8 or 0.9) makes the outputs more creative or unpredictable. * **topP** *(float) --* A probability distribution threshold which controls what the model considers for the set of possible next tokens. The model will only consider the top p% of the probability distribution when generating the next token. * **performanceConfig** *(dict) --* The latency configuration for the model. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". * **promptTemplate** *(dict) --* Contains the template for the prompt that's sent to the model for response generation. Generation prompts must include the "$search_results$" variable. For more information, see Use placeholder variables in the user guide. * **textPromptTemplate** *(string) --* The template for the prompt that's sent to the model for response generation. You can include prompt placeholders, which become replaced before the prompt is sent to the model to provide instructions and context to the model. In addition, you can include XML tags to delineate meaningful sections of the prompt template. For more information, see the following resources: * Knowledge base prompt templates * Use XML tags with Anthropic Claude models * **knowledgeBaseId** *(string) --* **[REQUIRED]** The unique identifier of the knowledge base that is queried. * **modelArn** *(string) --* **[REQUIRED]** The ARN of the foundation model or inference profile used to generate a response. * **orchestrationConfiguration** *(dict) --* Settings for how the model processes the prompt prior to retrieval and generation. * **additionalModelRequestFields** *(dict) --* Additional model parameters and corresponding values not included in the textInferenceConfig structure for a knowledge base. This allows users to provide custom model parameters specific to the language model being used. * *(string) --* * (*document*) -- * **inferenceConfig** *(dict) --* Configuration settings for inference when using RetrieveAndGenerate to generate responses while using a knowledge base as a source. * **textInferenceConfig** *(dict) --* Configuration settings specific to text generation while generating responses using RetrieveAndGenerate. * **maxTokens** *(integer) --* The maximum number of tokens to generate in the output text. Do not use the minimum of 0 or the maximum of 65536. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * **stopSequences** *(list) --* A list of sequences of characters that, if generated, will cause the model to stop generating further tokens. Do not use a minimum length of 1 or a maximum length of 1000. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * *(string) --* * **temperature** *(float) --* Controls the random-ness of text generated by the language model, influencing how much the model sticks to the most predictable next words versus exploring more surprising options. A lower temperature value (e.g. 0.2 or 0.3) makes model outputs more deterministic or predictable, while a higher temperature (e.g. 0.8 or 0.9) makes the outputs more creative or unpredictable. * **topP** *(float) --* A probability distribution threshold which controls what the model considers for the set of possible next tokens. The model will only consider the top p% of the probability distribution when generating the next token. * **performanceConfig** *(dict) --* The latency configuration for the model. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". * **promptTemplate** *(dict) --* Contains the template for the prompt that's sent to the model. Orchestration prompts must include the "$conversation_history$" and "$output_format_instructions$" variables. For more information, see Use placeholder variables in the user guide. * **textPromptTemplate** *(string) --* The template for the prompt that's sent to the model for response generation. You can include prompt placeholders, which become replaced before the prompt is sent to the model to provide instructions and context to the model. In addition, you can include XML tags to delineate meaningful sections of the prompt template. For more information, see the following resources: * Knowledge base prompt templates * Use XML tags with Anthropic Claude models * **queryTransformationConfiguration** *(dict) --* To split up the prompt and retrieve multiple sources, set the transformation type to "QUERY_DECOMPOSITION". * **type** *(string) --* **[REQUIRED]** The type of transformation to apply to the prompt. * **retrievalConfiguration** *(dict) --* Contains configurations for how to retrieve and return the knowledge base query. * **vectorSearchConfiguration** *(dict) --* **[REQUIRED]** Contains details about how the results from the vector search should be returned. For more information, see Query configurations. * **filter** *(dict) --* Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see Query configurations. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **andAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **equals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value matches the "value" in this object. The following example would return data sources with an "animal" attribute whose value is "cat": ""equals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than "1989": ""greaterThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than or equal to "1989": ""greaterThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **in** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is in the list specified in the "value" in this object. The following example would return data sources with an "animal" attribute that is either "cat" or "dog": ""in": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than to "1989". ""lessThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than or equal to "1989". ""lessThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **listContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is a list that contains the "value" as one of its members. The following example would return data sources with an "animals" attribute that is a list containing a "cat" member (for example "["dog", "cat"]"). ""listContains": { "key": "animals", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notEquals** *(dict) --* Knowledge base data sources are returned when: * It contains a metadata attribute whose name matches the "key" and whose value doesn't match the "value" in this object. * The key is not present in the document. The following example would return data sources that don't contain an "animal" attribute whose value is "cat". ""notEquals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notIn** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value isn't in the list specified in the "value" in this object. The following example would return data sources whose "animal" attribute is neither "cat" nor "dog". ""notIn": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **orAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **startsWith** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value starts with the "value" in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores. The following example would return data sources with an "animal" attribute starts with "ca" (for example, "cat" or "camel"). ""startsWith": { "key": "animal", "value": "ca" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **stringContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is one of the following: * A string that contains the "value" as a substring. The following example would return data sources with an "animal" attribute that contains the substring "at" (for example "cat"). ""stringContains": { "key": "animal", "value": "at" }" * A list with a member that contains the "value" as a substring. The following example would return data sources with an "animals" attribute that is a list containing a member that contains the substring "at" (for example "["dog", "cat"]"). ""stringContains": { "key": "animals", "value": "at" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **implicitFilterConfiguration** *(dict) --* Settings for implicit filtering. * **metadataAttributes** *(list) --* **[REQUIRED]** Metadata that can be used in a filter. * *(dict) --* Details about a metadata attribute. * **description** *(string) --* **[REQUIRED]** The attribute's description. * **key** *(string) --* **[REQUIRED]** The attribute's key. * **type** *(string) --* **[REQUIRED]** The attribute's type. * **modelArn** *(string) --* **[REQUIRED]** The model that generates the filter. * **numberOfResults** *(integer) --* The number of source chunks to retrieve. * **overrideSearchType** *(string) --* By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a "HYBRID" search using both vector embeddings and raw text, or "SEMANTIC" search using only vector embeddings. For other vector store configurations, only "SEMANTIC" search is available. For more information, see Test a knowledge base. * **rerankingConfiguration** *(dict) --* Contains configurations for reranking the retrieved results. For more information, see Improve the relevance of query responses with a reranker model. * **bedrockRerankingConfiguration** *(dict) --* Contains configurations for an Amazon Bedrock reranker model. * **metadataConfiguration** *(dict) --* Contains configurations for the metadata to use in reranking. * **selectionMode** *(string) --* **[REQUIRED]** Specifies whether to consider all metadata when reranking, or only the metadata that you select. If you specify "SELECTIVE", include the "selectiveModeConfiguration" field. * **selectiveModeConfiguration** *(dict) --* Contains configurations for the metadata fields to include or exclude when considering reranking. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "fieldsToExclude", "fieldsToInclude". * **fieldsToExclude** *(list) --* An array of objects, each of which specifies a metadata field to exclude from consideration when reranking. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **fieldsToInclude** *(list) --* An array of objects, each of which specifies a metadata field to include in consideration when reranking. The remaining metadata fields are ignored. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **modelConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for the reranker model. * **additionalModelRequestFields** *(dict) --* A JSON object whose keys are request fields for the model and whose values are values for those fields. * *(string) --* * (*document*) -- * **modelArn** *(string) --* **[REQUIRED]** The ARN of the reranker model to use. * **numberOfRerankedResults** *(integer) --* The number of results to return after reranking. * **type** *(string) --* **[REQUIRED]** The type of reranker model. * **type** *(string) --* **[REQUIRED]** The type of resource that contains your data for retrieving information and generating responses. Note: If you choose to use "EXTERNAL_SOURCES", then currently only Anthropic Claude 3 Sonnet models for knowledge bases are supported. * **sessionConfiguration** (*dict*) -- Contains details about the session with the knowledge base. * **kmsKeyArn** *(string) --* **[REQUIRED]** The ARN of the KMS key encrypting the session. * **sessionId** (*string*) -- The unique identifier of the session. When you first make a "RetrieveAndGenerate" request, Amazon Bedrock automatically generates this value. You must reuse this value for all subsequent requests in the same conversational session. This value allows Amazon Bedrock to maintain context and knowledge from previous interactions. You can't explicitly set the "sessionId" yourself. 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** { 'sessionId': 'string', 'stream': EventStream({ 'accessDeniedException': { 'message': 'string' }, 'badGatewayException': { 'message': 'string', 'resourceName': 'string' }, 'citation': { 'citation': { 'generatedResponsePart': { 'textResponsePart': { 'span': { 'end': 123, 'start': 123 }, 'text': 'string' } }, 'retrievedReferences': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, 'generatedResponsePart': { 'textResponsePart': { 'span': { 'end': 123, 'start': 123 }, 'text': 'string' } }, 'retrievedReferences': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, 'conflictException': { 'message': 'string' }, 'dependencyFailedException': { 'message': 'string', 'resourceName': 'string' }, 'guardrail': { 'action': 'INTERVENED'|'NONE' }, 'internalServerException': { 'message': 'string', 'reason': 'string' }, 'output': { 'text': 'string' }, 'resourceNotFoundException': { 'message': 'string' }, 'serviceQuotaExceededException': { 'message': 'string' }, 'throttlingException': { 'message': 'string' }, 'validationException': { 'message': 'string' } }) } **Response Structure** * *(dict) --* * **sessionId** *(string) --* The session ID. * **stream** ("EventStream") -- A stream of events from the model. * **accessDeniedException** *(dict) --* The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User Guide. * **message** *(string) --* * **badGatewayException** *(dict) --* The request failed due to a bad gateway error. * **message** *(string) --* * **resourceName** *(string) --* The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS. * **citation** *(dict) --* A citation event. * **citation** *(dict) --* The citation. * **generatedResponsePart** *(dict) --* Contains the generated response and metadata * **textResponsePart** *(dict) --* Contains metadata about a textual part of the generated response that is accompanied by a citation. * **span** *(dict) --* Contains information about where the text with a citation begins and ends in the generated output. * **end** *(integer) --* Where the text with a citation ends in the generated output. * **start** *(integer) --* Where the text with a citation starts in the generated output. * **text** *(string) --* The part of the generated text that contains a citation. * **retrievedReferences** *(list) --* Contains metadata about the sources cited for the generated response. * *(dict) --* Contains metadata about a source cited for the generated response. This data type is used in the following API operations: * RetrieveAndGenerate response – in the "retrievedReferences" field * InvokeAgent response – in the "retrievedReferences" field * **content** *(dict) --* Contains the cited text from the data source. * **byteContent** *(string) --* A data URI with base64-encoded content from the data source. The URI is in the following format: returned in the following format: "data:image/jpeg;base64,${base64-encoded string}". * **row** *(list) --* Specifies information about the rows with the cells to return in retrieval. * *(dict) --* Contains information about a column with a cell to return in retrieval. * **columnName** *(string) --* The name of the column. * **columnValue** *(string) --* The value in the column. * **type** *(string) --* The data type of the value. * **text** *(string) --* The cited text from the data source. * **type** *(string) --* The type of content in the retrieval result. * **location** *(dict) --* Contains information about the location of the data source. * **confluenceLocation** *(dict) --* The Confluence data source location. * **url** *(string) --* The Confluence host URL for the data source location. * **customDocumentLocation** *(dict) --* Specifies the location of a document in a custom data source. * **id** *(string) --* The ID of the document. * **kendraDocumentLocation** *(dict) --* The location of a document in Amazon Kendra. * **uri** *(string) --* The document's uri. * **s3Location** *(dict) --* The S3 data source location. * **uri** *(string) --* The S3 URI for the data source location. * **salesforceLocation** *(dict) --* The Salesforce data source location. * **url** *(string) --* The Salesforce host URL for the data source location. * **sharePointLocation** *(dict) --* The SharePoint data source location. * **url** *(string) --* The SharePoint site URL for the data source location. * **sqlLocation** *(dict) --* Specifies information about the SQL query used to retrieve the result. * **query** *(string) --* The SQL query used to retrieve the result. * **type** *(string) --* The type of data source location. * **webLocation** *(dict) --* The web URL/URLs data source location. * **url** *(string) --* The web URL/URLs for the data source location. * **metadata** *(dict) --* Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering. * *(string) --* * (*document*) -- * **generatedResponsePart** *(dict) --* The generated response to the citation event. * **textResponsePart** *(dict) --* Contains metadata about a textual part of the generated response that is accompanied by a citation. * **span** *(dict) --* Contains information about where the text with a citation begins and ends in the generated output. * **end** *(integer) --* Where the text with a citation ends in the generated output. * **start** *(integer) --* Where the text with a citation starts in the generated output. * **text** *(string) --* The part of the generated text that contains a citation. * **retrievedReferences** *(list) --* The retrieved references of the citation event. * *(dict) --* Contains metadata about a source cited for the generated response. This data type is used in the following API operations: * RetrieveAndGenerate response – in the "retrievedReferences" field * InvokeAgent response – in the "retrievedReferences" field * **content** *(dict) --* Contains the cited text from the data source. * **byteContent** *(string) --* A data URI with base64-encoded content from the data source. The URI is in the following format: returned in the following format: "data:image/jpeg;base64,${base64-encoded string}". * **row** *(list) --* Specifies information about the rows with the cells to return in retrieval. * *(dict) --* Contains information about a column with a cell to return in retrieval. * **columnName** *(string) --* The name of the column. * **columnValue** *(string) --* The value in the column. * **type** *(string) --* The data type of the value. * **text** *(string) --* The cited text from the data source. * **type** *(string) --* The type of content in the retrieval result. * **location** *(dict) --* Contains information about the location of the data source. * **confluenceLocation** *(dict) --* The Confluence data source location. * **url** *(string) --* The Confluence host URL for the data source location. * **customDocumentLocation** *(dict) --* Specifies the location of a document in a custom data source. * **id** *(string) --* The ID of the document. * **kendraDocumentLocation** *(dict) --* The location of a document in Amazon Kendra. * **uri** *(string) --* The document's uri. * **s3Location** *(dict) --* The S3 data source location. * **uri** *(string) --* The S3 URI for the data source location. * **salesforceLocation** *(dict) --* The Salesforce data source location. * **url** *(string) --* The Salesforce host URL for the data source location. * **sharePointLocation** *(dict) --* The SharePoint data source location. * **url** *(string) --* The SharePoint site URL for the data source location. * **sqlLocation** *(dict) --* Specifies information about the SQL query used to retrieve the result. * **query** *(string) --* The SQL query used to retrieve the result. * **type** *(string) --* The type of data source location. * **webLocation** *(dict) --* The web URL/URLs data source location. * **url** *(string) --* The web URL/URLs for the data source location. * **metadata** *(dict) --* Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering. * *(string) --* * (*document*) -- * **conflictException** *(dict) --* Error occurred because of a conflict while performing an operation. * **message** *(string) --* * **dependencyFailedException** *(dict) --* The request failed due to a dependency error. * **message** *(string) --* * **resourceName** *(string) --* The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS. * **guardrail** *(dict) --* A guardrail event. * **action** *(string) --* The guardrail action. * **internalServerException** *(dict) --* An internal server error occurred. Retry your request. * **message** *(string) --* * **reason** *(string) --* The reason for the exception. If the reason is "BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE", the model invocation service is unavailable. Retry your request. * **output** *(dict) --* An output event. * **text** *(string) --* A text response. * **resourceNotFoundException** *(dict) --* The specified resource ARN was not found. For troubleshooting this error, see ResourceNotFound in the Amazon Bedrock User Guide. * **message** *(string) --* * **serviceQuotaExceededException** *(dict) --* Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can resubmit your request later. * **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) --* * **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) --* **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / retrieve retrieve ******** AgentsforBedrockRuntime.Client.retrieve(**kwargs) Queries a knowledge base and retrieves information from it. See also: AWS API Documentation **Request Syntax** response = client.retrieve( guardrailConfiguration={ 'guardrailId': 'string', 'guardrailVersion': 'string' }, knowledgeBaseId='string', nextToken='string', retrievalConfiguration={ 'vectorSearchConfiguration': { 'filter': { 'andAll': [ {'... recursive ...'}, ], 'equals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'in': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'listContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notIn': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'orAll': [ {'... recursive ...'}, ], 'startsWith': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'stringContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None } }, 'implicitFilterConfiguration': { 'metadataAttributes': [ { 'description': 'string', 'key': 'string', 'type': 'STRING'|'NUMBER'|'BOOLEAN'|'STRING_LIST' }, ], 'modelArn': 'string' }, 'numberOfResults': 123, 'overrideSearchType': 'HYBRID'|'SEMANTIC', 'rerankingConfiguration': { 'bedrockRerankingConfiguration': { 'metadataConfiguration': { 'selectionMode': 'SELECTIVE'|'ALL', 'selectiveModeConfiguration': { 'fieldsToExclude': [ { 'fieldName': 'string' }, ], 'fieldsToInclude': [ { 'fieldName': 'string' }, ] } }, 'modelConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'modelArn': 'string' }, 'numberOfRerankedResults': 123 }, 'type': 'BEDROCK_RERANKING_MODEL' } } }, retrievalQuery={ 'text': 'string' } ) Parameters: * **guardrailConfiguration** (*dict*) -- Guardrail settings. * **guardrailId** *(string) --* **[REQUIRED]** The unique identifier for the guardrail. * **guardrailVersion** *(string) --* **[REQUIRED]** The version of the guardrail. * **knowledgeBaseId** (*string*) -- **[REQUIRED]** The unique identifier of the knowledge base to query. * **nextToken** (*string*) -- If there are more results than can fit in the response, the response returns a "nextToken". Use this token in the "nextToken" field of another request to retrieve the next batch of results. * **retrievalConfiguration** (*dict*) -- Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations. * **vectorSearchConfiguration** *(dict) --* **[REQUIRED]** Contains details about how the results from the vector search should be returned. For more information, see Query configurations. * **filter** *(dict) --* Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see Query configurations. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **andAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **equals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value matches the "value" in this object. The following example would return data sources with an "animal" attribute whose value is "cat": ""equals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than "1989": ""greaterThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than or equal to "1989": ""greaterThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **in** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is in the list specified in the "value" in this object. The following example would return data sources with an "animal" attribute that is either "cat" or "dog": ""in": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than to "1989". ""lessThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than or equal to "1989". ""lessThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **listContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is a list that contains the "value" as one of its members. The following example would return data sources with an "animals" attribute that is a list containing a "cat" member (for example "["dog", "cat"]"). ""listContains": { "key": "animals", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notEquals** *(dict) --* Knowledge base data sources are returned when: * It contains a metadata attribute whose name matches the "key" and whose value doesn't match the "value" in this object. * The key is not present in the document. The following example would return data sources that don't contain an "animal" attribute whose value is "cat". ""notEquals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notIn** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value isn't in the list specified in the "value" in this object. The following example would return data sources whose "animal" attribute is neither "cat" nor "dog". ""notIn": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **orAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **startsWith** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value starts with the "value" in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores. The following example would return data sources with an "animal" attribute starts with "ca" (for example, "cat" or "camel"). ""startsWith": { "key": "animal", "value": "ca" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **stringContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is one of the following: * A string that contains the "value" as a substring. The following example would return data sources with an "animal" attribute that contains the substring "at" (for example "cat"). ""stringContains": { "key": "animal", "value": "at" }" * A list with a member that contains the "value" as a substring. The following example would return data sources with an "animals" attribute that is a list containing a member that contains the substring "at" (for example "["dog", "cat"]"). ""stringContains": { "key": "animals", "value": "at" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **implicitFilterConfiguration** *(dict) --* Settings for implicit filtering. * **metadataAttributes** *(list) --* **[REQUIRED]** Metadata that can be used in a filter. * *(dict) --* Details about a metadata attribute. * **description** *(string) --* **[REQUIRED]** The attribute's description. * **key** *(string) --* **[REQUIRED]** The attribute's key. * **type** *(string) --* **[REQUIRED]** The attribute's type. * **modelArn** *(string) --* **[REQUIRED]** The model that generates the filter. * **numberOfResults** *(integer) --* The number of source chunks to retrieve. * **overrideSearchType** *(string) --* By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a "HYBRID" search using both vector embeddings and raw text, or "SEMANTIC" search using only vector embeddings. For other vector store configurations, only "SEMANTIC" search is available. For more information, see Test a knowledge base. * **rerankingConfiguration** *(dict) --* Contains configurations for reranking the retrieved results. For more information, see Improve the relevance of query responses with a reranker model. * **bedrockRerankingConfiguration** *(dict) --* Contains configurations for an Amazon Bedrock reranker model. * **metadataConfiguration** *(dict) --* Contains configurations for the metadata to use in reranking. * **selectionMode** *(string) --* **[REQUIRED]** Specifies whether to consider all metadata when reranking, or only the metadata that you select. If you specify "SELECTIVE", include the "selectiveModeConfiguration" field. * **selectiveModeConfiguration** *(dict) --* Contains configurations for the metadata fields to include or exclude when considering reranking. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "fieldsToExclude", "fieldsToInclude". * **fieldsToExclude** *(list) --* An array of objects, each of which specifies a metadata field to exclude from consideration when reranking. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **fieldsToInclude** *(list) --* An array of objects, each of which specifies a metadata field to include in consideration when reranking. The remaining metadata fields are ignored. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **modelConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for the reranker model. * **additionalModelRequestFields** *(dict) --* A JSON object whose keys are request fields for the model and whose values are values for those fields. * *(string) --* * (*document*) -- * **modelArn** *(string) --* **[REQUIRED]** The ARN of the reranker model to use. * **numberOfRerankedResults** *(integer) --* The number of results to return after reranking. * **type** *(string) --* **[REQUIRED]** The type of reranker model. * **retrievalQuery** (*dict*) -- **[REQUIRED]** Contains the query to send the knowledge base. * **text** *(string) --* **[REQUIRED]** The text of the query made to the knowledge base. Return type: dict Returns: **Response Syntax** { 'guardrailAction': 'INTERVENED'|'NONE', 'nextToken': 'string', 'retrievalResults': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'score': 123.0 }, ] } **Response Structure** * *(dict) --* * **guardrailAction** *(string) --* Specifies if there is a guardrail intervention in the response. * **nextToken** *(string) --* If there are more results than can fit in the response, the response returns a "nextToken". Use this token in the "nextToken" field of another request to retrieve the next batch of results. * **retrievalResults** *(list) --* A list of results from querying the knowledge base. * *(dict) --* Details about a result from querying the knowledge base. This data type is used in the following API operations: * Retrieve response – in the "retrievalResults" field * **content** *(dict) --* Contains information about the content of the chunk. * **byteContent** *(string) --* A data URI with base64-encoded content from the data source. The URI is in the following format: returned in the following format: "data:image/jpeg;base64,${base64-encoded string}". * **row** *(list) --* Specifies information about the rows with the cells to return in retrieval. * *(dict) --* Contains information about a column with a cell to return in retrieval. * **columnName** *(string) --* The name of the column. * **columnValue** *(string) --* The value in the column. * **type** *(string) --* The data type of the value. * **text** *(string) --* The cited text from the data source. * **type** *(string) --* The type of content in the retrieval result. * **location** *(dict) --* Contains information about the location of the data source. * **confluenceLocation** *(dict) --* The Confluence data source location. * **url** *(string) --* The Confluence host URL for the data source location. * **customDocumentLocation** *(dict) --* Specifies the location of a document in a custom data source. * **id** *(string) --* The ID of the document. * **kendraDocumentLocation** *(dict) --* The location of a document in Amazon Kendra. * **uri** *(string) --* The document's uri. * **s3Location** *(dict) --* The S3 data source location. * **uri** *(string) --* The S3 URI for the data source location. * **salesforceLocation** *(dict) --* The Salesforce data source location. * **url** *(string) --* The Salesforce host URL for the data source location. * **sharePointLocation** *(dict) --* The SharePoint data source location. * **url** *(string) --* The SharePoint site URL for the data source location. * **sqlLocation** *(dict) --* Specifies information about the SQL query used to retrieve the result. * **query** *(string) --* The SQL query used to retrieve the result. * **type** *(string) --* The type of data source location. * **webLocation** *(dict) --* The web URL/URLs data source location. * **url** *(string) --* The web URL/URLs for the data source location. * **metadata** *(dict) --* Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering. * *(string) --* * (*document*) -- * **score** *(float) --* The level of relevance of the result to the query. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / invoke_agent invoke_agent ************ AgentsforBedrockRuntime.Client.invoke_agent(**kwargs) Sends a prompt for the agent to process and respond to. Note the following fields for the request: * To continue the same conversation with an agent, use the same "sessionId" value in the request. * To activate trace enablement, turn "enableTrace" to "true". Trace enablement helps you follow the agent's reasoning process that led it to the information it processed, the actions it took, and the final result it yielded. For more information, see Trace enablement. * End a conversation by setting "endSession" to "true". * In the "sessionState" object, you can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group. The response contains both **chunk** and **trace** attributes. The final response is returned in the "bytes" field of the "chunk" object. The "InvokeAgent" returns one chunk for the entire interaction. * The "attribution" object contains citations for parts of the response. * If you set "enableTrace" to "true" in the request, you can trace the agent's steps and reasoning process that led it to the response. * If the action predicted was configured to return control, the response returns parameters for the action, elicited from the user, in the "returnControl" field. * Errors are also surfaced in the response. See also: AWS API Documentation **Request Syntax** response = client.invoke_agent( agentAliasId='string', agentId='string', bedrockModelConfigurations={ 'performanceConfig': { 'latency': 'standard'|'optimized' } }, enableTrace=True|False, endSession=True|False, inputText='string', memoryId='string', promptCreationConfigurations={ 'excludePreviousThinkingSteps': True|False, 'previousConversationTurnsToInclude': 123 }, sessionId='string', sessionState={ 'conversationHistory': { 'messages': [ { 'content': [ { 'text': 'string' }, ], 'role': 'user'|'assistant' }, ] }, 'files': [ { 'name': 'string', 'source': { 'byteContent': { 'data': b'bytes', 'mediaType': 'string' }, 's3Location': { 'uri': 'string' }, 'sourceType': 'S3'|'BYTE_CONTENT' }, 'useCase': 'CODE_INTERPRETER'|'CHAT' }, ], 'invocationId': 'string', 'knowledgeBaseConfigurations': [ { 'knowledgeBaseId': 'string', 'retrievalConfiguration': { 'vectorSearchConfiguration': { 'filter': { 'andAll': [ {'... recursive ...'}, ], 'equals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'in': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'listContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notIn': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'orAll': [ {'... recursive ...'}, ], 'startsWith': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'stringContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None } }, 'implicitFilterConfiguration': { 'metadataAttributes': [ { 'description': 'string', 'key': 'string', 'type': 'STRING'|'NUMBER'|'BOOLEAN'|'STRING_LIST' }, ], 'modelArn': 'string' }, 'numberOfResults': 123, 'overrideSearchType': 'HYBRID'|'SEMANTIC', 'rerankingConfiguration': { 'bedrockRerankingConfiguration': { 'metadataConfiguration': { 'selectionMode': 'SELECTIVE'|'ALL', 'selectiveModeConfiguration': { 'fieldsToExclude': [ { 'fieldName': 'string' }, ], 'fieldsToInclude': [ { 'fieldName': 'string' }, ] } }, 'modelConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'modelArn': 'string' }, 'numberOfRerankedResults': 123 }, 'type': 'BEDROCK_RERANKING_MODEL' } } } }, ], 'promptSessionAttributes': { 'string': 'string' }, 'returnControlInvocationResults': [ { 'apiResult': { 'actionGroup': 'string', 'agentId': 'string', 'apiPath': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'httpMethod': 'string', 'httpStatusCode': 123, 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' }, 'functionResult': { 'actionGroup': 'string', 'agentId': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'function': 'string', 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' } }, ], 'sessionAttributes': { 'string': 'string' } }, sourceArn='string', streamingConfigurations={ 'applyGuardrailInterval': 123, 'streamFinalResponse': True|False } ) Parameters: * **agentAliasId** (*string*) -- **[REQUIRED]** The alias of the agent to use. * **agentId** (*string*) -- **[REQUIRED]** The unique identifier of the agent to use. * **bedrockModelConfigurations** (*dict*) -- Model performance settings for the request. * **performanceConfig** *(dict) --* The performance configuration for the model. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". * **enableTrace** (*boolean*) -- Specifies whether to turn on the trace or not to track the agent's reasoning process. For more information, see Trace enablement. * **endSession** (*boolean*) -- Specifies whether to end the session with the agent or not. * **inputText** (*string*) -- The prompt text to send the agent. Note: If you include "returnControlInvocationResults" in the "sessionState" field, the "inputText" field will be ignored. * **memoryId** (*string*) -- The unique identifier of the agent memory. * **promptCreationConfigurations** (*dict*) -- Specifies parameters that control how the service populates the agent prompt for an "InvokeAgent" request. You can control which aspects of previous invocations in the same agent session the service uses to populate the agent prompt. This gives you more granular control over the contextual history that is used to process the current request. * **excludePreviousThinkingSteps** *(boolean) --* If "true", the service removes any content between "" tags from previous conversations in an agent session. The service will only remove content from already processed turns. This helps you remove content which might not be useful for current and subsequent invocations. This can reduce the input token count and potentially save costs. The default value is "false". * **previousConversationTurnsToInclude** *(integer) --* The number of previous conversations from the ongoing agent session to include in the conversation history of the agent prompt, during the current invocation. This gives you more granular control over the context that the model is made aware of, and helps the model remove older context which is no longer useful during the ongoing agent session. * **sessionId** (*string*) -- **[REQUIRED]** The unique identifier of the session. Use the same value across requests to continue the same conversation. * **sessionState** (*dict*) -- Contains parameters that specify various attributes of the session. For more information, see Control session context. Note: If you include "returnControlInvocationResults" in the "sessionState" field, the "inputText" field will be ignored. * **conversationHistory** *(dict) --* The state's conversation history. * **messages** *(list) --* The conversation's messages. * *(dict) --* Details about a message. * **content** *(list) --* **[REQUIRED]** The message's content. * *(dict) --* A content block. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "text". * **text** *(string) --* The block's text. * **role** *(string) --* **[REQUIRED]** The message's role. * **files** *(list) --* Contains information about the files used by code interpreter. * *(dict) --* Contains details of the source files. * **name** *(string) --* **[REQUIRED]** The name of the source file. * **source** *(dict) --* **[REQUIRED]** Specifies where the files are located. * **byteContent** *(dict) --* The data and the text of the attached files. * **data** *(bytes) --* **[REQUIRED]** The raw bytes of the file to attach. The maximum size of all files that is attached is 10MB. You can attach a maximum of 5 files. * **mediaType** *(string) --* **[REQUIRED]** The MIME type of data contained in the file used for chat. * **s3Location** *(dict) --* The s3 location of the files to attach. * **uri** *(string) --* **[REQUIRED]** The uri of the s3 object. * **sourceType** *(string) --* **[REQUIRED]** The source type of the files to attach. * **useCase** *(string) --* **[REQUIRED]** Specifies how the source files will be used by the code interpreter. * **invocationId** *(string) --* The identifier of the invocation of an action. This value must match the "invocationId" returned in the "InvokeAgent" response for the action whose results are provided in the "returnControlInvocationResults" field. For more information, see Return control to the agent developer and Control session context. * **knowledgeBaseConfigurations** *(list) --* An array of configurations, each of which applies to a knowledge base attached to the agent. * *(dict) --* Configurations to apply to a knowledge base attached to the agent during query. For more information, see Knowledge base retrieval configurations. * **knowledgeBaseId** *(string) --* **[REQUIRED]** The unique identifier for a knowledge base attached to the agent. * **retrievalConfiguration** *(dict) --* **[REQUIRED]** The configurations to apply to the knowledge base during query. For more information, see Query configurations. * **vectorSearchConfiguration** *(dict) --* **[REQUIRED]** Contains details about how the results from the vector search should be returned. For more information, see Query configurations. * **filter** *(dict) --* Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see Query configurations. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **andAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **equals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value matches the "value" in this object. The following example would return data sources with an "animal" attribute whose value is "cat": ""equals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than "1989": ""greaterThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than or equal to "1989": ""greaterThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **in** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is in the list specified in the "value" in this object. The following example would return data sources with an "animal" attribute that is either "cat" or "dog": ""in": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than to "1989". ""lessThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than or equal to "1989". ""lessThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **listContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is a list that contains the "value" as one of its members. The following example would return data sources with an "animals" attribute that is a list containing a "cat" member (for example "["dog", "cat"]"). ""listContains": { "key": "animals", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notEquals** *(dict) --* Knowledge base data sources are returned when: * It contains a metadata attribute whose name matches the "key" and whose value doesn't match the "value" in this object. * The key is not present in the document. The following example would return data sources that don't contain an "animal" attribute whose value is "cat". ""notEquals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notIn** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value isn't in the list specified in the "value" in this object. The following example would return data sources whose "animal" attribute is neither "cat" nor "dog". ""notIn": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **orAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **startsWith** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value starts with the "value" in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores. The following example would return data sources with an "animal" attribute starts with "ca" (for example, "cat" or "camel"). ""startsWith": { "key": "animal", "value": "ca" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **stringContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is one of the following: * A string that contains the "value" as a substring. The following example would return data sources with an "animal" attribute that contains the substring "at" (for example "cat"). ""stringContains": { "key": "animal", "value": "at" }" * A list with a member that contains the "value" as a substring. The following example would return data sources with an "animals" attribute that is a list containing a member that contains the substring "at" (for example "["dog", "cat"]"). ""stringContains": { "key": "animals", "value": "at" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **implicitFilterConfiguration** *(dict) --* Settings for implicit filtering. * **metadataAttributes** *(list) --* **[REQUIRED]** Metadata that can be used in a filter. * *(dict) --* Details about a metadata attribute. * **description** *(string) --* **[REQUIRED]** The attribute's description. * **key** *(string) --* **[REQUIRED]** The attribute's key. * **type** *(string) --* **[REQUIRED]** The attribute's type. * **modelArn** *(string) --* **[REQUIRED]** The model that generates the filter. * **numberOfResults** *(integer) --* The number of source chunks to retrieve. * **overrideSearchType** *(string) --* By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a "HYBRID" search using both vector embeddings and raw text, or "SEMANTIC" search using only vector embeddings. For other vector store configurations, only "SEMANTIC" search is available. For more information, see Test a knowledge base. * **rerankingConfiguration** *(dict) --* Contains configurations for reranking the retrieved results. For more information, see Improve the relevance of query responses with a reranker model. * **bedrockRerankingConfiguration** *(dict) --* Contains configurations for an Amazon Bedrock reranker model. * **metadataConfiguration** *(dict) --* Contains configurations for the metadata to use in reranking. * **selectionMode** *(string) --* **[REQUIRED]** Specifies whether to consider all metadata when reranking, or only the metadata that you select. If you specify "SELECTIVE", include the "selectiveModeConfiguration" field. * **selectiveModeConfiguration** *(dict) --* Contains configurations for the metadata fields to include or exclude when considering reranking. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "fieldsToExclude", "fieldsToInclude". * **fieldsToExclude** *(list) --* An array of objects, each of which specifies a metadata field to exclude from consideration when reranking. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **fieldsToInclude** *(list) --* An array of objects, each of which specifies a metadata field to include in consideration when reranking. The remaining metadata fields are ignored. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **modelConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for the reranker model. * **additionalModelRequestFields** *(dict) --* A JSON object whose keys are request fields for the model and whose values are values for those fields. * *(string) --* * (*document*) -- * **modelArn** *(string) --* **[REQUIRED]** The ARN of the reranker model to use. * **numberOfRerankedResults** *(integer) --* The number of results to return after reranking. * **type** *(string) --* **[REQUIRED]** The type of reranker model. * **promptSessionAttributes** *(dict) --* Contains attributes that persist across a prompt and the values of those attributes. * In orchestration prompt template, these attributes replace the $prompt_session_attributes$ placeholder variable. For more information, see Prompt template placeholder variables. * In multi-agent collaboration, the "promptSessionAttributes" will only be used by supervisor agent when $prompt_session_attributes$ is present in prompt template. * *(string) --* * *(string) --* * **returnControlInvocationResults** *(list) --* Contains information about the results from the action group invocation. For more information, see Return control to the agent developer and Control session context. Note: If you include this field, the "inputText" field will be ignored. * *(dict) --* A result from the invocation of an action. For more information, see Return control to the agent developer and Control session context. This data type is used in the following API operations: * InvokeAgent request Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "apiResult", "functionResult". * **apiResult** *(dict) --* The result from the API response from the action group invocation. * **actionGroup** *(string) --* **[REQUIRED]** The action group that the API operation belongs to. * **agentId** *(string) --* The agent's ID. * **apiPath** *(string) --* The path to the API operation. * **confirmationState** *(string) --* Controls the API operations or functions to invoke based on the user confirmation. * **httpMethod** *(string) --* The HTTP method for the API operation. * **httpStatusCode** *(integer) --* http status code from API execution response (for example: 200, 400, 500). * **responseBody** *(dict) --* The response body from the API operation. The key of the object is the content type (currently, only "TEXT" is supported). The response may be returned directly or from the Lambda function. * *(string) --* * *(dict) --* Contains the body of the API response. This data type is used in the following API operations: * In the "returnControlInvocationResults" field of the InvokeAgent request * **body** *(string) --* The body of the API response. * **images** *(list) --* Lists details, including format and source, for the image in the response from the function call. You can specify only one image and the function in the "returnControlInvocationResults" must be a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * *(dict) --* Details about an image in the result from a function in the action group invocation. You can specify images only when the function is a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * **format** *(string) --* **[REQUIRED]** The type of image in the result. * **source** *(dict) --* **[REQUIRED]** The source of the image in the result. 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. If you use an Amazon Web Services SDK, you don't need to encode the image bytes in base64. * **responseState** *(string) --* Controls the final response state returned to end user when API/Function execution failed. When this state is FAILURE, the request would fail with dependency failure exception. When this state is REPROMPT, the API/function response will be sent to model for re- prompt * **functionResult** *(dict) --* The result from the function from the action group invocation. * **actionGroup** *(string) --* **[REQUIRED]** The action group that the function belongs to. * **agentId** *(string) --* The agent's ID. * **confirmationState** *(string) --* Contains the user confirmation information about the function that was called. * **function** *(string) --* The name of the function that was called. * **responseBody** *(dict) --* The response from the function call using the parameters. The response might be returned directly or from the Lambda function. Specify "TEXT" or "IMAGES". The key of the object is the content type. You can only specify one type. If you specify "IMAGES", you can specify only one image. You can specify images only when the function in the "returnControlInvocationResults" is a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * *(string) --* * *(dict) --* Contains the body of the API response. This data type is used in the following API operations: * In the "returnControlInvocationResults" field of the InvokeAgent request * **body** *(string) --* The body of the API response. * **images** *(list) --* Lists details, including format and source, for the image in the response from the function call. You can specify only one image and the function in the "returnControlInvocationResults" must be a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * *(dict) --* Details about an image in the result from a function in the action group invocation. You can specify images only when the function is a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. * **format** *(string) --* **[REQUIRED]** The type of image in the result. * **source** *(dict) --* **[REQUIRED]** The source of the image in the result. 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. If you use an Amazon Web Services SDK, you don't need to encode the image bytes in base64. * **responseState** *(string) --* Controls the final response state returned to end user when API/Function execution failed. When this state is FAILURE, the request would fail with dependency failure exception. When this state is REPROMPT, the API/function response will be sent to model for re- prompt * **sessionAttributes** *(dict) --* Contains attributes that persist across a session and the values of those attributes. If "sessionAttributes" are passed to a supervisor agent in multi-agent collaboration, it will be forwarded to all agent collaborators. * *(string) --* * *(string) --* * **sourceArn** (*string*) -- The ARN of the resource making the request. * **streamingConfigurations** (*dict*) -- Specifies the configurations for streaming. Note: To use agent streaming, you need permissions to perform the "bedrock:InvokeModelWithResponseStream" action. * **applyGuardrailInterval** *(integer) --* The guardrail interval to apply as response is generated. By default, the guardrail interval is set to 50 characters. If a larger interval is specified, the response will be generated in larger chunks with fewer "ApplyGuardrail" calls. The following examples show the response generated for *Hello, I am an agent* input string. **Example response in chunks: Interval set to 3 characters** "'Hel', 'lo, ','I am', ' an', ' Age', 'nt'" Each chunk has at least 3 characters except for the last chunk **Example response in chunks: Interval set to 20 or more characters** "Hello, I am an Agent" * **streamFinalResponse** *(boolean) --* Specifies whether to enable streaming for the final response. This is set to "false" by default. 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** { 'completion': EventStream({ 'accessDeniedException': { 'message': 'string' }, 'badGatewayException': { 'message': 'string', 'resourceName': 'string' }, 'chunk': { 'attribution': { 'citations': [ { 'generatedResponsePart': { 'textResponsePart': { 'span': { 'end': 123, 'start': 123 }, 'text': 'string' } }, 'retrievedReferences': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, ] }, 'bytes': b'bytes' }, 'conflictException': { 'message': 'string' }, 'dependencyFailedException': { 'message': 'string', 'resourceName': 'string' }, 'files': { 'files': [ { 'bytes': b'bytes', 'name': 'string', 'type': 'string' }, ] }, 'internalServerException': { 'message': 'string', 'reason': 'string' }, 'modelNotReadyException': { 'message': 'string' }, 'resourceNotFoundException': { 'message': 'string' }, 'returnControl': { 'invocationId': 'string', 'invocationInputs': [ { 'apiInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'apiPath': 'string', 'collaboratorName': 'string', 'httpMethod': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': { 'properties': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } } } }, 'functionInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string', 'function': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, ] }, 'serviceQuotaExceededException': { 'message': 'string' }, 'throttlingException': { 'message': 'string' }, 'trace': { 'agentAliasId': 'string', 'agentId': 'string', 'agentVersion': 'string', 'callerChain': [ { 'agentAliasArn': 'string' }, ], 'collaboratorName': 'string', 'eventTime': datetime(2015, 1, 1), 'sessionId': 'string', 'trace': { 'customOrchestrationTrace': { 'event': { 'text': 'string' }, 'traceId': 'string' }, 'failureTrace': { 'failureCode': 123, 'failureReason': 'string', 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'traceId': 'string' }, 'guardrailTrace': { 'action': 'INTERVENED'|'NONE', 'inputAssessments': [ { 'contentPolicy': { 'filters': [ { 'action': 'BLOCKED', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK' }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'action': 'BLOCKED'|'ANONYMIZED', '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' }, ], 'regexes': [ { 'action': 'BLOCKED'|'ANONYMIZED', 'match': 'string', 'name': 'string', 'regex': 'string' }, ] }, 'topicPolicy': { 'topics': [ { 'action': 'BLOCKED', 'name': 'string', 'type': 'DENY' }, ] }, 'wordPolicy': { 'customWords': [ { 'action': 'BLOCKED', 'match': 'string' }, ], 'managedWordLists': [ { 'action': 'BLOCKED', 'match': 'string', 'type': 'PROFANITY' }, ] } }, ], 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'outputAssessments': [ { 'contentPolicy': { 'filters': [ { 'action': 'BLOCKED', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK' }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'action': 'BLOCKED'|'ANONYMIZED', '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' }, ], 'regexes': [ { 'action': 'BLOCKED'|'ANONYMIZED', 'match': 'string', 'name': 'string', 'regex': 'string' }, ] }, 'topicPolicy': { 'topics': [ { 'action': 'BLOCKED', 'name': 'string', 'type': 'DENY' }, ] }, 'wordPolicy': { 'customWords': [ { 'action': 'BLOCKED', 'match': 'string' }, ], 'managedWordLists': [ { 'action': 'BLOCKED', 'match': 'string', 'type': 'PROFANITY' }, ] } }, ], 'traceId': 'string' }, 'orchestrationTrace': { 'invocationInput': { 'actionGroupInvocationInput': { 'actionGroupName': 'string', 'apiPath': 'string', 'executionType': 'LAMBDA'|'RETURN_CONTROL', 'function': 'string', 'invocationId': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, 'verb': 'string' }, 'agentCollaboratorInvocationInput': { 'agentCollaboratorAliasArn': 'string', 'agentCollaboratorName': 'string', 'input': { 'returnControlResults': { 'invocationId': 'string', 'returnControlInvocationResults': [ { 'apiResult': { 'actionGroup': 'string', 'agentId': 'string', 'apiPath': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'httpMethod': 'string', 'httpStatusCode': 123, 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' }, 'functionResult': { 'actionGroup': 'string', 'agentId': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'function': 'string', 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' } }, ] }, 'text': 'string', 'type': 'TEXT'|'RETURN_CONTROL' } }, 'codeInterpreterInvocationInput': { 'code': 'string', 'files': [ 'string', ] }, 'invocationType': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'FINISH'|'ACTION_GROUP_CODE_INTERPRETER'|'AGENT_COLLABORATOR', 'knowledgeBaseLookupInput': { 'knowledgeBaseId': 'string', 'text': 'string' }, 'traceId': 'string' }, 'modelInvocationInput': { 'foundationModel': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'rawResponse': { 'content': 'string' }, 'reasoningContent': { 'reasoningText': { 'signature': 'string', 'text': 'string' }, 'redactedContent': b'bytes' }, 'traceId': 'string' }, 'observation': { 'actionGroupInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'text': 'string' }, 'agentCollaboratorInvocationOutput': { 'agentCollaboratorAliasArn': 'string', 'agentCollaboratorName': 'string', 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'output': { 'returnControlPayload': { 'invocationId': 'string', 'invocationInputs': [ { 'apiInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'apiPath': 'string', 'collaboratorName': 'string', 'httpMethod': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': { 'properties': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } } } }, 'functionInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string', 'function': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, ] }, 'text': 'string', 'type': 'TEXT'|'RETURN_CONTROL' } }, 'codeInterpreterInvocationOutput': { 'executionError': 'string', 'executionOutput': 'string', 'executionTimeout': True|False, 'files': [ 'string', ], 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'finalResponse': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'text': 'string' }, 'knowledgeBaseLookupOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'retrievedReferences': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, 'repromptResponse': { 'source': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'PARSER', 'text': 'string' }, 'traceId': 'string', 'type': 'ACTION_GROUP'|'AGENT_COLLABORATOR'|'KNOWLEDGE_BASE'|'FINISH'|'ASK_USER'|'REPROMPT' }, 'rationale': { 'text': 'string', 'traceId': 'string' } }, 'postProcessingTrace': { 'modelInvocationInput': { 'foundationModel': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'parsedResponse': { 'text': 'string' }, 'rawResponse': { 'content': 'string' }, 'reasoningContent': { 'reasoningText': { 'signature': 'string', 'text': 'string' }, 'redactedContent': b'bytes' }, 'traceId': 'string' } }, 'preProcessingTrace': { 'modelInvocationInput': { 'foundationModel': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'parsedResponse': { 'isValid': True|False, 'rationale': 'string' }, 'rawResponse': { 'content': 'string' }, 'reasoningContent': { 'reasoningText': { 'signature': 'string', 'text': 'string' }, 'redactedContent': b'bytes' }, 'traceId': 'string' } }, 'routingClassifierTrace': { 'invocationInput': { 'actionGroupInvocationInput': { 'actionGroupName': 'string', 'apiPath': 'string', 'executionType': 'LAMBDA'|'RETURN_CONTROL', 'function': 'string', 'invocationId': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, 'verb': 'string' }, 'agentCollaboratorInvocationInput': { 'agentCollaboratorAliasArn': 'string', 'agentCollaboratorName': 'string', 'input': { 'returnControlResults': { 'invocationId': 'string', 'returnControlInvocationResults': [ { 'apiResult': { 'actionGroup': 'string', 'agentId': 'string', 'apiPath': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'httpMethod': 'string', 'httpStatusCode': 123, 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' }, 'functionResult': { 'actionGroup': 'string', 'agentId': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'function': 'string', 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT' } }, ] }, 'text': 'string', 'type': 'TEXT'|'RETURN_CONTROL' } }, 'codeInterpreterInvocationInput': { 'code': 'string', 'files': [ 'string', ] }, 'invocationType': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'FINISH'|'ACTION_GROUP_CODE_INTERPRETER'|'AGENT_COLLABORATOR', 'knowledgeBaseLookupInput': { 'knowledgeBaseId': 'string', 'text': 'string' }, 'traceId': 'string' }, 'modelInvocationInput': { 'foundationModel': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'rawResponse': { 'content': 'string' }, 'traceId': 'string' }, 'observation': { 'actionGroupInvocationOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'text': 'string' }, 'agentCollaboratorInvocationOutput': { 'agentCollaboratorAliasArn': 'string', 'agentCollaboratorName': 'string', 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'output': { 'returnControlPayload': { 'invocationId': 'string', 'invocationInputs': [ { 'apiInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'apiPath': 'string', 'collaboratorName': 'string', 'httpMethod': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': { 'properties': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } } } }, 'functionInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string', 'function': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, ] }, 'text': 'string', 'type': 'TEXT'|'RETURN_CONTROL' } }, 'codeInterpreterInvocationOutput': { 'executionError': 'string', 'executionOutput': 'string', 'executionTimeout': True|False, 'files': [ 'string', ], 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'finalResponse': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'text': 'string' }, 'knowledgeBaseLookupOutput': { 'metadata': { 'clientRequestId': 'string', 'endTime': datetime(2015, 1, 1), 'operationTotalTimeMs': 123, 'startTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'retrievedReferences': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, 'repromptResponse': { 'source': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'PARSER', 'text': 'string' }, 'traceId': 'string', 'type': 'ACTION_GROUP'|'AGENT_COLLABORATOR'|'KNOWLEDGE_BASE'|'FINISH'|'ASK_USER'|'REPROMPT' } } } }, 'validationException': { 'message': 'string' } }), 'contentType': 'string', 'memoryId': 'string', 'sessionId': 'string' } **Response Structure** # This section is too large to render. # Please see the AWS API Documentation linked below. AWS API Documentation **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ModelNotReadyExceptio n" * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / get_session get_session *********** AgentsforBedrockRuntime.Client.get_session(**kwargs) Retrieves details about a specific session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. See also: AWS API Documentation **Request Syntax** response = client.get_session( sessionIdentifier='string' ) Parameters: **sessionIdentifier** (*string*) -- **[REQUIRED]** A unique identifier for the session to retrieve. You can specify either the session's "sessionId" or its Amazon Resource Name (ARN). Return type: dict Returns: **Response Syntax** { 'createdAt': datetime(2015, 1, 1), 'encryptionKeyArn': 'string', 'lastUpdatedAt': datetime(2015, 1, 1), 'sessionArn': 'string', 'sessionId': 'string', 'sessionMetadata': { 'string': 'string' }, 'sessionStatus': 'ACTIVE'|'EXPIRED'|'ENDED' } **Response Structure** * *(dict) --* * **createdAt** *(datetime) --* The timestamp for when the session was created. * **encryptionKeyArn** *(string) --* The Amazon Resource Name (ARN) of the Key Management Service key used to encrypt the session data. For more information, see Amazon Bedrock session encryption. * **lastUpdatedAt** *(datetime) --* The timestamp for when the session was last modified. * **sessionArn** *(string) --* The Amazon Resource Name (ARN) of the session. * **sessionId** *(string) --* The unique identifier for the session in UUID format. * **sessionMetadata** *(dict) --* A map of key-value pairs containing attributes persisted across the session. * *(string) --* * *(string) --* * **sessionStatus** *(string) --* The current status of the session. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / close close ***** AgentsforBedrockRuntime.Client.close() Closes underlying endpoint connections. AgentsforBedrockRuntime / Client / retrieve_and_generate retrieve_and_generate ********************* AgentsforBedrockRuntime.Client.retrieve_and_generate(**kwargs) Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile. The response only cites sources that are relevant to the query. See also: AWS API Documentation **Request Syntax** response = client.retrieve_and_generate( input={ 'text': 'string' }, retrieveAndGenerateConfiguration={ 'externalSourcesConfiguration': { 'generationConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'guardrailConfiguration': { 'guardrailId': 'string', 'guardrailVersion': 'string' }, 'inferenceConfig': { 'textInferenceConfig': { 'maxTokens': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topP': ... } }, 'performanceConfig': { 'latency': 'standard'|'optimized' }, 'promptTemplate': { 'textPromptTemplate': 'string' } }, 'modelArn': 'string', 'sources': [ { 'byteContent': { 'contentType': 'string', 'data': b'bytes', 'identifier': 'string' }, 's3Location': { 'uri': 'string' }, 'sourceType': 'S3'|'BYTE_CONTENT' }, ] }, 'knowledgeBaseConfiguration': { 'generationConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'guardrailConfiguration': { 'guardrailId': 'string', 'guardrailVersion': 'string' }, 'inferenceConfig': { 'textInferenceConfig': { 'maxTokens': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topP': ... } }, 'performanceConfig': { 'latency': 'standard'|'optimized' }, 'promptTemplate': { 'textPromptTemplate': 'string' } }, 'knowledgeBaseId': 'string', 'modelArn': 'string', 'orchestrationConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'inferenceConfig': { 'textInferenceConfig': { 'maxTokens': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topP': ... } }, 'performanceConfig': { 'latency': 'standard'|'optimized' }, 'promptTemplate': { 'textPromptTemplate': 'string' }, 'queryTransformationConfiguration': { 'type': 'QUERY_DECOMPOSITION' } }, 'retrievalConfiguration': { 'vectorSearchConfiguration': { 'filter': { 'andAll': [ {'... recursive ...'}, ], 'equals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'in': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'listContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notIn': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'orAll': [ {'... recursive ...'}, ], 'startsWith': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'stringContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None } }, 'implicitFilterConfiguration': { 'metadataAttributes': [ { 'description': 'string', 'key': 'string', 'type': 'STRING'|'NUMBER'|'BOOLEAN'|'STRING_LIST' }, ], 'modelArn': 'string' }, 'numberOfResults': 123, 'overrideSearchType': 'HYBRID'|'SEMANTIC', 'rerankingConfiguration': { 'bedrockRerankingConfiguration': { 'metadataConfiguration': { 'selectionMode': 'SELECTIVE'|'ALL', 'selectiveModeConfiguration': { 'fieldsToExclude': [ { 'fieldName': 'string' }, ], 'fieldsToInclude': [ { 'fieldName': 'string' }, ] } }, 'modelConfiguration': { 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None }, 'modelArn': 'string' }, 'numberOfRerankedResults': 123 }, 'type': 'BEDROCK_RERANKING_MODEL' } } } }, 'type': 'KNOWLEDGE_BASE'|'EXTERNAL_SOURCES' }, sessionConfiguration={ 'kmsKeyArn': 'string' }, sessionId='string' ) Parameters: * **input** (*dict*) -- **[REQUIRED]** Contains the query to be made to the knowledge base. * **text** *(string) --* **[REQUIRED]** The query made to the knowledge base. * **retrieveAndGenerateConfiguration** (*dict*) -- Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations. * **externalSourcesConfiguration** *(dict) --* The configuration for the external source wrapper object in the "retrieveAndGenerate" function. * **generationConfiguration** *(dict) --* The prompt used with the external source wrapper object with the "retrieveAndGenerate" function. * **additionalModelRequestFields** *(dict) --* Additional model parameters and their corresponding values not included in the textInferenceConfig structure for an external source. Takes in custom model parameters specific to the language model being used. * *(string) --* * (*document*) -- * **guardrailConfiguration** *(dict) --* The configuration details for the guardrail. * **guardrailId** *(string) --* **[REQUIRED]** The unique identifier for the guardrail. * **guardrailVersion** *(string) --* **[REQUIRED]** The version of the guardrail. * **inferenceConfig** *(dict) --* Configuration settings for inference when using RetrieveAndGenerate to generate responses while using an external source. * **textInferenceConfig** *(dict) --* Configuration settings specific to text generation while generating responses using RetrieveAndGenerate. * **maxTokens** *(integer) --* The maximum number of tokens to generate in the output text. Do not use the minimum of 0 or the maximum of 65536. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * **stopSequences** *(list) --* A list of sequences of characters that, if generated, will cause the model to stop generating further tokens. Do not use a minimum length of 1 or a maximum length of 1000. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * *(string) --* * **temperature** *(float) --* Controls the random-ness of text generated by the language model, influencing how much the model sticks to the most predictable next words versus exploring more surprising options. A lower temperature value (e.g. 0.2 or 0.3) makes model outputs more deterministic or predictable, while a higher temperature (e.g. 0.8 or 0.9) makes the outputs more creative or unpredictable. * **topP** *(float) --* A probability distribution threshold which controls what the model considers for the set of possible next tokens. The model will only consider the top p% of the probability distribution when generating the next token. * **performanceConfig** *(dict) --* The latency configuration for the model. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". * **promptTemplate** *(dict) --* Contain the textPromptTemplate string for the external source wrapper object. * **textPromptTemplate** *(string) --* The template for the prompt that's sent to the model for response generation. You can include prompt placeholders, which become replaced before the prompt is sent to the model to provide instructions and context to the model. In addition, you can include XML tags to delineate meaningful sections of the prompt template. For more information, see the following resources: * Knowledge base prompt templates * Use XML tags with Anthropic Claude models * **modelArn** *(string) --* **[REQUIRED]** The model Amazon Resource Name (ARN) for the external source wrapper object in the "retrieveAndGenerate" function. * **sources** *(list) --* **[REQUIRED]** The document for the external source wrapper object in the "retrieveAndGenerate" function. * *(dict) --* The unique external source of the content contained in the wrapper object. * **byteContent** *(dict) --* The identifier, contentType, and data of the external source wrapper object. * **contentType** *(string) --* **[REQUIRED]** The MIME type of the document contained in the wrapper object. * **data** *(bytes) --* **[REQUIRED]** The byte value of the file to upload, encoded as a Base-64 string. * **identifier** *(string) --* **[REQUIRED]** The file name of the document contained in the wrapper object. * **s3Location** *(dict) --* The S3 location of the external source wrapper object. * **uri** *(string) --* **[REQUIRED]** The file location of the S3 wrapper object. * **sourceType** *(string) --* **[REQUIRED]** The source type of the external source wrapper object. * **knowledgeBaseConfiguration** *(dict) --* Contains details about the knowledge base for retrieving information and generating responses. * **generationConfiguration** *(dict) --* Contains configurations for response generation based on the knowledge base query results. * **additionalModelRequestFields** *(dict) --* Additional model parameters and corresponding values not included in the textInferenceConfig structure for a knowledge base. This allows users to provide custom model parameters specific to the language model being used. * *(string) --* * (*document*) -- * **guardrailConfiguration** *(dict) --* The configuration details for the guardrail. * **guardrailId** *(string) --* **[REQUIRED]** The unique identifier for the guardrail. * **guardrailVersion** *(string) --* **[REQUIRED]** The version of the guardrail. * **inferenceConfig** *(dict) --* Configuration settings for inference when using RetrieveAndGenerate to generate responses while using a knowledge base as a source. * **textInferenceConfig** *(dict) --* Configuration settings specific to text generation while generating responses using RetrieveAndGenerate. * **maxTokens** *(integer) --* The maximum number of tokens to generate in the output text. Do not use the minimum of 0 or the maximum of 65536. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * **stopSequences** *(list) --* A list of sequences of characters that, if generated, will cause the model to stop generating further tokens. Do not use a minimum length of 1 or a maximum length of 1000. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * *(string) --* * **temperature** *(float) --* Controls the random-ness of text generated by the language model, influencing how much the model sticks to the most predictable next words versus exploring more surprising options. A lower temperature value (e.g. 0.2 or 0.3) makes model outputs more deterministic or predictable, while a higher temperature (e.g. 0.8 or 0.9) makes the outputs more creative or unpredictable. * **topP** *(float) --* A probability distribution threshold which controls what the model considers for the set of possible next tokens. The model will only consider the top p% of the probability distribution when generating the next token. * **performanceConfig** *(dict) --* The latency configuration for the model. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". * **promptTemplate** *(dict) --* Contains the template for the prompt that's sent to the model for response generation. Generation prompts must include the "$search_results$" variable. For more information, see Use placeholder variables in the user guide. * **textPromptTemplate** *(string) --* The template for the prompt that's sent to the model for response generation. You can include prompt placeholders, which become replaced before the prompt is sent to the model to provide instructions and context to the model. In addition, you can include XML tags to delineate meaningful sections of the prompt template. For more information, see the following resources: * Knowledge base prompt templates * Use XML tags with Anthropic Claude models * **knowledgeBaseId** *(string) --* **[REQUIRED]** The unique identifier of the knowledge base that is queried. * **modelArn** *(string) --* **[REQUIRED]** The ARN of the foundation model or inference profile used to generate a response. * **orchestrationConfiguration** *(dict) --* Settings for how the model processes the prompt prior to retrieval and generation. * **additionalModelRequestFields** *(dict) --* Additional model parameters and corresponding values not included in the textInferenceConfig structure for a knowledge base. This allows users to provide custom model parameters specific to the language model being used. * *(string) --* * (*document*) -- * **inferenceConfig** *(dict) --* Configuration settings for inference when using RetrieveAndGenerate to generate responses while using a knowledge base as a source. * **textInferenceConfig** *(dict) --* Configuration settings specific to text generation while generating responses using RetrieveAndGenerate. * **maxTokens** *(integer) --* The maximum number of tokens to generate in the output text. Do not use the minimum of 0 or the maximum of 65536. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * **stopSequences** *(list) --* A list of sequences of characters that, if generated, will cause the model to stop generating further tokens. Do not use a minimum length of 1 or a maximum length of 1000. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model. * *(string) --* * **temperature** *(float) --* Controls the random-ness of text generated by the language model, influencing how much the model sticks to the most predictable next words versus exploring more surprising options. A lower temperature value (e.g. 0.2 or 0.3) makes model outputs more deterministic or predictable, while a higher temperature (e.g. 0.8 or 0.9) makes the outputs more creative or unpredictable. * **topP** *(float) --* A probability distribution threshold which controls what the model considers for the set of possible next tokens. The model will only consider the top p% of the probability distribution when generating the next token. * **performanceConfig** *(dict) --* The latency configuration for the model. * **latency** *(string) --* To use a latency-optimized version of the model, set to "optimized". * **promptTemplate** *(dict) --* Contains the template for the prompt that's sent to the model. Orchestration prompts must include the "$conversation_history$" and "$output_format_instructions$" variables. For more information, see Use placeholder variables in the user guide. * **textPromptTemplate** *(string) --* The template for the prompt that's sent to the model for response generation. You can include prompt placeholders, which become replaced before the prompt is sent to the model to provide instructions and context to the model. In addition, you can include XML tags to delineate meaningful sections of the prompt template. For more information, see the following resources: * Knowledge base prompt templates * Use XML tags with Anthropic Claude models * **queryTransformationConfiguration** *(dict) --* To split up the prompt and retrieve multiple sources, set the transformation type to "QUERY_DECOMPOSITION". * **type** *(string) --* **[REQUIRED]** The type of transformation to apply to the prompt. * **retrievalConfiguration** *(dict) --* Contains configurations for how to retrieve and return the knowledge base query. * **vectorSearchConfiguration** *(dict) --* **[REQUIRED]** Contains details about how the results from the vector search should be returned. For more information, see Query configurations. * **filter** *(dict) --* Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see Query configurations. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **andAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **equals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value matches the "value" in this object. The following example would return data sources with an "animal" attribute whose value is "cat": ""equals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than "1989": ""greaterThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **greaterThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is greater than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is greater than or equal to "1989": ""greaterThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **in** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is in the list specified in the "value" in this object. The following example would return data sources with an "animal" attribute that is either "cat" or "dog": ""in": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThan** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than to "1989". ""lessThan": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **lessThanOrEquals** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is less than or equal to the "value" in this object. The following example would return data sources with an "year" attribute whose value is less than or equal to "1989". ""lessThanOrEquals": { "key": "year", "value": 1989 }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **listContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is a list that contains the "value" as one of its members. The following example would return data sources with an "animals" attribute that is a list containing a "cat" member (for example "["dog", "cat"]"). ""listContains": { "key": "animals", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notEquals** *(dict) --* Knowledge base data sources are returned when: * It contains a metadata attribute whose name matches the "key" and whose value doesn't match the "value" in this object. * The key is not present in the document. The following example would return data sources that don't contain an "animal" attribute whose value is "cat". ""notEquals": { "key": "animal", "value": "cat" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **notIn** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value isn't in the list specified in the "value" in this object. The following example would return data sources whose "animal" attribute is neither "cat" nor "dog". ""notIn": { "key": "animal", "value": ["cat", "dog"] }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **orAll** *(list) --* Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list. * *(dict) --* Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. This data type is used in the following API operations: * Retrieve request – in the "filter" field * RetrieveAndGenerate request – in the "filter" field Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "andAll", "equals", "greaterThan", "greaterThanOrEquals", "in", "lessThan", "lessThanOrEquals", "listContains", "notEquals", "notIn", "orAll", "startsWith", "stringContains". * **startsWith** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value starts with the "value" in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores. The following example would return data sources with an "animal" attribute starts with "ca" (for example, "cat" or "camel"). ""startsWith": { "key": "animal", "value": "ca" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **stringContains** *(dict) --* Knowledge base data sources are returned if they contain a metadata attribute whose name matches the "key" and whose value is one of the following: * A string that contains the "value" as a substring. The following example would return data sources with an "animal" attribute that contains the substring "at" (for example "cat"). ""stringContains": { "key": "animal", "value": "at" }" * A list with a member that contains the "value" as a substring. The following example would return data sources with an "animals" attribute that is a list containing a member that contains the substring "at" (for example "["dog", "cat"]"). ""stringContains": { "key": "animals", "value": "at" }" * **key** *(string) --* **[REQUIRED]** The name that the metadata attribute must match. * **value** (*document*) -- **[REQUIRED]** The value to whcih to compare the value of the metadata attribute. * **implicitFilterConfiguration** *(dict) --* Settings for implicit filtering. * **metadataAttributes** *(list) --* **[REQUIRED]** Metadata that can be used in a filter. * *(dict) --* Details about a metadata attribute. * **description** *(string) --* **[REQUIRED]** The attribute's description. * **key** *(string) --* **[REQUIRED]** The attribute's key. * **type** *(string) --* **[REQUIRED]** The attribute's type. * **modelArn** *(string) --* **[REQUIRED]** The model that generates the filter. * **numberOfResults** *(integer) --* The number of source chunks to retrieve. * **overrideSearchType** *(string) --* By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a "HYBRID" search using both vector embeddings and raw text, or "SEMANTIC" search using only vector embeddings. For other vector store configurations, only "SEMANTIC" search is available. For more information, see Test a knowledge base. * **rerankingConfiguration** *(dict) --* Contains configurations for reranking the retrieved results. For more information, see Improve the relevance of query responses with a reranker model. * **bedrockRerankingConfiguration** *(dict) --* Contains configurations for an Amazon Bedrock reranker model. * **metadataConfiguration** *(dict) --* Contains configurations for the metadata to use in reranking. * **selectionMode** *(string) --* **[REQUIRED]** Specifies whether to consider all metadata when reranking, or only the metadata that you select. If you specify "SELECTIVE", include the "selectiveModeConfiguration" field. * **selectiveModeConfiguration** *(dict) --* Contains configurations for the metadata fields to include or exclude when considering reranking. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "fieldsToExclude", "fieldsToInclude". * **fieldsToExclude** *(list) --* An array of objects, each of which specifies a metadata field to exclude from consideration when reranking. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **fieldsToInclude** *(list) --* An array of objects, each of which specifies a metadata field to include in consideration when reranking. The remaining metadata fields are ignored. * *(dict) --* Contains information for a metadata field to include in or exclude from consideration when reranking. * **fieldName** *(string) --* **[REQUIRED]** The name of a metadata field to include in or exclude from consideration when reranking. * **modelConfiguration** *(dict) --* **[REQUIRED]** Contains configurations for the reranker model. * **additionalModelRequestFields** *(dict) --* A JSON object whose keys are request fields for the model and whose values are values for those fields. * *(string) --* * (*document*) -- * **modelArn** *(string) --* **[REQUIRED]** The ARN of the reranker model to use. * **numberOfRerankedResults** *(integer) --* The number of results to return after reranking. * **type** *(string) --* **[REQUIRED]** The type of reranker model. * **type** *(string) --* **[REQUIRED]** The type of resource that contains your data for retrieving information and generating responses. Note: If you choose to use "EXTERNAL_SOURCES", then currently only Anthropic Claude 3 Sonnet models for knowledge bases are supported. * **sessionConfiguration** (*dict*) -- Contains details about the session with the knowledge base. * **kmsKeyArn** *(string) --* **[REQUIRED]** The ARN of the KMS key encrypting the session. * **sessionId** (*string*) -- The unique identifier of the session. When you first make a "RetrieveAndGenerate" request, Amazon Bedrock automatically generates this value. You must reuse this value for all subsequent requests in the same conversational session. This value allows Amazon Bedrock to maintain context and knowledge from previous interactions. You can't explicitly set the "sessionId" yourself. Return type: dict Returns: **Response Syntax** { 'citations': [ { 'generatedResponsePart': { 'textResponsePart': { 'span': { 'end': 123, 'start': 123 }, 'text': 'string' } }, 'retrievedReferences': [ { 'content': { 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ], 'text': 'string', 'type': 'TEXT'|'IMAGE'|'ROW' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'sqlLocation': { 'query': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, ], 'guardrailAction': 'INTERVENED'|'NONE', 'output': { 'text': 'string' }, 'sessionId': 'string' } **Response Structure** * *(dict) --* * **citations** *(list) --* A list of segments of the generated response that are based on sources in the knowledge base, alongside information about the sources. * *(dict) --* An object containing a segment of the generated response that is based on a source in the knowledge base, alongside information about the source. This data type is used in the following API operations: * InvokeAgent response – in the "citations" field * RetrieveAndGenerate response – in the "citations" field * **generatedResponsePart** *(dict) --* Contains the generated response and metadata * **textResponsePart** *(dict) --* Contains metadata about a textual part of the generated response that is accompanied by a citation. * **span** *(dict) --* Contains information about where the text with a citation begins and ends in the generated output. * **end** *(integer) --* Where the text with a citation ends in the generated output. * **start** *(integer) --* Where the text with a citation starts in the generated output. * **text** *(string) --* The part of the generated text that contains a citation. * **retrievedReferences** *(list) --* Contains metadata about the sources cited for the generated response. * *(dict) --* Contains metadata about a source cited for the generated response. This data type is used in the following API operations: * RetrieveAndGenerate response – in the "retrievedReferences" field * InvokeAgent response – in the "retrievedReferences" field * **content** *(dict) --* Contains the cited text from the data source. * **byteContent** *(string) --* A data URI with base64-encoded content from the data source. The URI is in the following format: returned in the following format: "data:image/jpeg;base64,${base64-encoded string}". * **row** *(list) --* Specifies information about the rows with the cells to return in retrieval. * *(dict) --* Contains information about a column with a cell to return in retrieval. * **columnName** *(string) --* The name of the column. * **columnValue** *(string) --* The value in the column. * **type** *(string) --* The data type of the value. * **text** *(string) --* The cited text from the data source. * **type** *(string) --* The type of content in the retrieval result. * **location** *(dict) --* Contains information about the location of the data source. * **confluenceLocation** *(dict) --* The Confluence data source location. * **url** *(string) --* The Confluence host URL for the data source location. * **customDocumentLocation** *(dict) --* Specifies the location of a document in a custom data source. * **id** *(string) --* The ID of the document. * **kendraDocumentLocation** *(dict) --* The location of a document in Amazon Kendra. * **uri** *(string) --* The document's uri. * **s3Location** *(dict) --* The S3 data source location. * **uri** *(string) --* The S3 URI for the data source location. * **salesforceLocation** *(dict) --* The Salesforce data source location. * **url** *(string) --* The Salesforce host URL for the data source location. * **sharePointLocation** *(dict) --* The SharePoint data source location. * **url** *(string) --* The SharePoint site URL for the data source location. * **sqlLocation** *(dict) --* Specifies information about the SQL query used to retrieve the result. * **query** *(string) --* The SQL query used to retrieve the result. * **type** *(string) --* The type of data source location. * **webLocation** *(dict) --* The web URL/URLs data source location. * **url** *(string) --* The web URL/URLs for the data source location. * **metadata** *(dict) --* Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering. * *(string) --* * (*document*) -- * **guardrailAction** *(string) --* Specifies if there is a guardrail intervention in the response. * **output** *(dict) --* Contains the response generated from querying the knowledge base. * **text** *(string) --* The response generated from querying the knowledge base. * **sessionId** *(string) --* The unique identifier of the session. When you first make a "RetrieveAndGenerate" request, Amazon Bedrock automatically generates this value. You must reuse this value for all subsequent requests in the same conversational session. This value allows Amazon Bedrock to maintain context and knowledge from previous interactions. You can't explicitly set the "sessionId" yourself. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / list_flow_executions list_flow_executions ******************** AgentsforBedrockRuntime.Client.list_flow_executions(**kwargs) Lists all executions of a flow. Results can be paginated and include summary information about each execution, such as status, start and end times, and the execution's Amazon Resource Name (ARN). Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. See also: AWS API Documentation **Request Syntax** response = client.list_flow_executions( flowAliasIdentifier='string', flowIdentifier='string', maxResults=123, nextToken='string' ) Parameters: * **flowAliasIdentifier** (*string*) -- The unique identifier of the flow alias to list executions for. * **flowIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow to list executions for. * **maxResults** (*integer*) -- The maximum number of flow executions to return in a single response. If more executions exist than the specified "maxResults" value, a token is included in the response so that the remaining results can be retrieved. * **nextToken** (*string*) -- A token to retrieve the next set of results. This value is returned in the response if more results are available. Return type: dict Returns: **Response Syntax** { 'flowExecutionSummaries': [ { 'createdAt': datetime(2015, 1, 1), 'endedAt': datetime(2015, 1, 1), 'executionArn': 'string', 'flowAliasIdentifier': 'string', 'flowIdentifier': 'string', 'flowVersion': 'string', 'status': 'Running'|'Succeeded'|'Failed'|'TimedOut'|'Aborted' }, ], 'nextToken': 'string' } **Response Structure** * *(dict) --* * **flowExecutionSummaries** *(list) --* A list of flow execution summaries. Each summary includes the execution ARN, flow identifier, flow alias identifier, flow version, status, and timestamps. * *(dict) --* Contains summary information about a flow execution, including its status, timestamps, and identifiers. Note: Flow executions is in preview release for Amazon Bedrock and is subject to change. * **createdAt** *(datetime) --* The timestamp when the flow execution was created. * **endedAt** *(datetime) --* The timestamp when the flow execution ended. This field is only populated when the execution has completed, failed, timed out, or been aborted. * **executionArn** *(string) --* The Amazon Resource Name (ARN) that uniquely identifies the flow execution. * **flowAliasIdentifier** *(string) --* The unique identifier of the flow alias used for the execution. * **flowIdentifier** *(string) --* The unique identifier of the flow. * **flowVersion** *(string) --* The version of the flow used for the execution. * **status** *(string) --* The current status of the flow execution. Flow executions time out after 24 hours. * **nextToken** *(string) --* A token to retrieve the next set of results. This value is returned if more results are available. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" AgentsforBedrockRuntime / Client / invoke_flow invoke_flow *********** AgentsforBedrockRuntime.Client.invoke_flow(**kwargs) Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide. Note: The CLI doesn't support streaming operations in Amazon Bedrock, including "InvokeFlow". See also: AWS API Documentation **Request Syntax** response = client.invoke_flow( enableTrace=True|False, executionId='string', flowAliasIdentifier='string', flowIdentifier='string', inputs=[ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'nodeInputName': 'string', 'nodeName': 'string', 'nodeOutputName': 'string' }, ], modelPerformanceConfiguration={ 'performanceConfig': { 'latency': 'standard'|'optimized' } } ) Parameters: * **enableTrace** (*boolean*) -- Specifies whether to return the trace for the flow or not. Traces track inputs and outputs for nodes in the flow. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock. * **executionId** (*string*) -- The unique identifier for the current flow execution. If you don't provide a value, Amazon Bedrock creates the identifier for you. * **flowAliasIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow alias. * **flowIdentifier** (*string*) -- **[REQUIRED]** The unique identifier of the flow. * **inputs** (*list*) -- **[REQUIRED]** A list of objects, each containing information about an input into the flow. * *(dict) --* Contains information about an input into the prompt flow and where to send it. * **content** *(dict) --* **[REQUIRED]** Contains information about an input into the prompt flow. Note: This is a Tagged Union structure. Only one of the following top level keys can be set: "document". * **document** (*document*) -- The input to send to the prompt flow input node. * **nodeInputName** *(string) --* The name of the input from the flow input node. * **nodeName** *(string) --* **[REQUIRED]** The name of the flow input node that begins the prompt flow. * **nodeOutputName** *(string) --* The name of the output from the flow input node that begins the prompt flow. * **modelPerformanceConfiguration** (*dict*) -- Model performance settings for the request. * **performanceConfig** *(dict) --* The latency configuration for the model. * **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** { 'executionId': 'string', 'responseStream': EventStream({ 'accessDeniedException': { 'message': 'string' }, 'badGatewayException': { 'message': 'string', 'resourceName': 'string' }, 'conflictException': { 'message': 'string' }, 'dependencyFailedException': { 'message': 'string', 'resourceName': 'string' }, 'flowCompletionEvent': { 'completionReason': 'SUCCESS'|'INPUT_REQUIRED' }, 'flowMultiTurnInputRequestEvent': { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'nodeName': 'string', 'nodeType': 'FlowInputNode'|'FlowOutputNode'|'LambdaFunctionNode'|'KnowledgeBaseNode'|'PromptNode'|'ConditionNode'|'LexNode' }, 'flowOutputEvent': { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'nodeName': 'string', 'nodeType': 'FlowInputNode'|'FlowOutputNode'|'LambdaFunctionNode'|'KnowledgeBaseNode'|'PromptNode'|'ConditionNode'|'LexNode' }, 'flowTraceEvent': { 'trace': { 'conditionNodeResultTrace': { 'nodeName': 'string', 'satisfiedConditions': [ { 'conditionName': 'string' }, ], 'timestamp': datetime(2015, 1, 1) }, 'nodeActionTrace': { 'nodeName': 'string', 'operationName': 'string', 'requestId': 'string', 'serviceName': 'string', 'timestamp': datetime(2015, 1, 1) }, 'nodeInputTrace': { 'fields': [ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'nodeInputName': 'string' }, ], 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) }, 'nodeOutputTrace': { 'fields': [ { 'content': { 'document': {...}|[...]|123|123.4|'string'|True|None }, 'nodeOutputName': 'string' }, ], 'nodeName': 'string', 'timestamp': datetime(2015, 1, 1) } } }, 'internalServerException': { 'message': 'string', 'reason': 'string' }, 'resourceNotFoundException': { 'message': 'string' }, 'serviceQuotaExceededException': { 'message': 'string' }, 'throttlingException': { 'message': 'string' }, 'validationException': { 'message': 'string' } }) } **Response Structure** * *(dict) --* * **executionId** *(string) --* The unique identifier for the current flow execution. * **responseStream** ("EventStream") -- The output of the flow, returned as a stream. If there's an error, the error is returned. * **accessDeniedException** *(dict) --* The request is denied because of missing access permissions. Check your permissions and retry your request. * **message** *(string) --* * **badGatewayException** *(dict) --* There was an issue with a dependency due to a server issue. Retry your request. * **message** *(string) --* * **resourceName** *(string) --* The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS. * **conflictException** *(dict) --* There was a conflict performing an operation. Resolve the conflict and retry your request. * **message** *(string) --* * **dependencyFailedException** *(dict) --* There was an issue with a dependency. Check the resource configurations and retry the request. * **message** *(string) --* * **resourceName** *(string) --* The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS. * **flowCompletionEvent** *(dict) --* Contains information about why the flow completed. * **completionReason** *(string) --* The reason that the flow completed. * **flowMultiTurnInputRequestEvent** *(dict) --* The event stream containing the multi-turn input request information from the flow. * **content** *(dict) --* The content payload containing the input request details for the multi-turn interaction. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The requested additional input to send back to the multi-turn flow node. * **nodeName** *(string) --* The name of the node in the flow that is requesting the input. * **nodeType** *(string) --* The type of the node in the flow that is requesting the input. * **flowOutputEvent** *(dict) --* Contains information about an output from flow invocation. * **content** *(dict) --* The content in the output. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The content in the output. * **nodeName** *(string) --* The name of the flow output node that the output is from. * **nodeType** *(string) --* The type of the node that the output is from. * **flowTraceEvent** *(dict) --* Contains information about a trace, which tracks an input or output for a node in the flow. * **trace** *(dict) --* The trace object containing information about an input or output for a node in the flow. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "conditionNodeResultTrace", "nodeActionTrace", "nodeInputTrace", "nodeOutputTrace". 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'} * **conditionNodeResultTrace** *(dict) --* Contains information about an output from a condition node. * **nodeName** *(string) --* The name of the condition node. * **satisfiedConditions** *(list) --* An array of objects containing information about the conditions that were satisfied. * *(dict) --* Contains information about a condition that was satisfied. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock. * **conditionName** *(string) --* The name of the condition. * **timestamp** *(datetime) --* The date and time that the trace was returned. * **nodeActionTrace** *(dict) --* Contains information about an action (operation) called by a node. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock. * **nodeName** *(string) --* The name of the node that called the operation. * **operationName** *(string) --* The name of the operation that the node called. * **requestId** *(string) --* The ID of the request that the node made to the operation. * **serviceName** *(string) --* The name of the service that the node called. * **timestamp** *(datetime) --* The date and time that the operation was called. * **nodeInputTrace** *(dict) --* Contains information about the input into a node. * **fields** *(list) --* An array of objects containing information about each field in the input. * *(dict) --* Contains information about a field in the input into a node. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock. * **content** *(dict) --* The content of the node input. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The content of the node input. * **nodeInputName** *(string) --* The name of the node input. * **nodeName** *(string) --* The name of the node that received the input. * **timestamp** *(datetime) --* The date and time that the trace was returned. * **nodeOutputTrace** *(dict) --* Contains information about the output from a node. * **fields** *(list) --* An array of objects containing information about each field in the output. * *(dict) --* Contains information about a field in the output from a node. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock. * **content** *(dict) --* The content of the node output. Note: This is a Tagged Union structure. Only one of the following top level keys will be set: "document". 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'} * **document** (*document*) -- The content of the node output. * **nodeOutputName** *(string) --* The name of the node output. * **nodeName** *(string) --* The name of the node that yielded the output. * **timestamp** *(datetime) --* The date and time that the trace was returned. * **internalServerException** *(dict) --* An internal server error occurred. Retry your request. * **message** *(string) --* * **reason** *(string) --* The reason for the exception. If the reason is "BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE", the model invocation service is unavailable. Retry your request. * **resourceNotFoundException** *(dict) --* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again. * **message** *(string) --* * **serviceQuotaExceededException** *(dict) --* The number of requests exceeds the service quota. Resubmit your request later. * **message** *(string) --* * **throttlingException** *(dict) --* The number of requests exceeds the limit. Resubmit your request later. * **message** *(string) --* * **validationException** *(dict) --* Input validation failed. Check your request parameters and retry the request. * **message** *(string) --* **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / tag_resource tag_resource ************ AgentsforBedrockRuntime.Client.tag_resource(**kwargs) Associate tags with a resource. For more information, see Tagging resources in the Amazon Bedrock User Guide. See also: AWS API Documentation **Request Syntax** response = client.tag_resource( resourceArn='string', tags={ 'string': 'string' } ) Parameters: * **resourceArn** (*string*) -- **[REQUIRED]** The Amazon Resource Name (ARN) of the resource to tag. * **tags** (*dict*) -- **[REQUIRED]** An object containing key-value pairs that define the tags to attach to the resource. * *(string) --* Key of a tag * *(string) --* Value of a tag Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / delete_agent_memory delete_agent_memory ******************* AgentsforBedrockRuntime.Client.delete_agent_memory(**kwargs) Deletes memory from the specified memory identifier. See also: AWS API Documentation **Request Syntax** response = client.delete_agent_memory( agentAliasId='string', agentId='string', memoryId='string', sessionId='string' ) Parameters: * **agentAliasId** (*string*) -- **[REQUIRED]** The unique identifier of an alias of an agent. * **agentId** (*string*) -- **[REQUIRED]** The unique identifier of the agent to which the alias belongs. * **memoryId** (*string*) -- The unique identifier of the memory. * **sessionId** (*string*) -- The unique session identifier of the memory. Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception" AgentsforBedrockRuntime / Client / generate_query generate_query ************** AgentsforBedrockRuntime.Client.generate_query(**kwargs) Generates an SQL query from a natural language query. For more information, see Generate a query for structured data in the Amazon Bedrock User Guide. See also: AWS API Documentation **Request Syntax** response = client.generate_query( queryGenerationInput={ 'text': 'string', 'type': 'TEXT' }, transformationConfiguration={ 'mode': 'TEXT_TO_SQL', 'textToSqlConfiguration': { 'knowledgeBaseConfiguration': { 'knowledgeBaseArn': 'string' }, 'type': 'KNOWLEDGE_BASE' } } ) Parameters: * **queryGenerationInput** (*dict*) -- **[REQUIRED]** Specifies information about a natural language query to transform into SQL. * **text** *(string) --* **[REQUIRED]** The text of the query. * **type** *(string) --* **[REQUIRED]** The type of the query. * **transformationConfiguration** (*dict*) -- **[REQUIRED]** Specifies configurations for transforming the natural language query into SQL. * **mode** *(string) --* **[REQUIRED]** The mode of the transformation. * **textToSqlConfiguration** *(dict) --* Specifies configurations for transforming text to SQL. * **knowledgeBaseConfiguration** *(dict) --* Specifies configurations for a knowledge base to use in transformation. * **knowledgeBaseArn** *(string) --* **[REQUIRED]** The ARN of the knowledge base * **type** *(string) --* **[REQUIRED]** The type of resource to use in transformation. Return type: dict Returns: **Response Syntax** { 'queries': [ { 'sql': 'string', 'type': 'REDSHIFT_SQL' }, ] } **Response Structure** * *(dict) --* * **queries** *(list) --* A list of objects, each of which defines a generated query that can correspond to the natural language queries. * *(dict) --* Contains information about a query generated for a natural language query. * **sql** *(string) --* An SQL query that corresponds to the natural language query. * **type** *(string) --* The type of transformed query. **Exceptions** * "AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.ConflictException" * "AgentsforBedrockRuntime.Client.exceptions.ValidationException" * "AgentsforBedrockRuntime.Client.exceptions.InternalServerExcepti on" * "AgentsforBedrockRuntime.Client.exceptions.DependencyFailedExcep tion" * "AgentsforBedrockRuntime.Client.exceptions.BadGatewayException" * "AgentsforBedrockRuntime.Client.exceptions.ThrottlingException" * "AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException" * "AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededE xception"