Agents for Amazon Bedrock Runtime 2023-07-26
- Client: Aws\BedrockAgentRuntime\BedrockAgentRuntimeClient
- Service ID: bedrock-agent-runtime
- Version: 2023-07-26
This page describes the parameters and results for the operations of the Agents for Amazon Bedrock Runtime (2023-07-26), and shows how to use the Aws\BedrockAgentRuntime\BedrockAgentRuntimeClient object to call the described operations. This documentation is specific to the 2023-07-26 API version of the service.
Operation Summary
Each of the following operations can be created from a client using
$client->getCommand('CommandName')
, where "CommandName" is the
name of one of the following operations. Note: a command is a value that
encapsulates an operation and the parameters used to create an HTTP request.
You can also create and send a command immediately using the magic methods
available on a client object: $client->commandName(/* parameters */)
.
You can send the command asynchronously (returning a promise) by appending the
word "Async" to the operation name: $client->commandNameAsync(/* parameters */)
.
- DeleteAgentMemory ( array $params = [] )
- Deletes memory from the specified memory identifier.
- GetAgentMemory ( array $params = [] )
- Gets the sessions stored in the memory of the agent.
- InvokeAgent ( array $params = [] )
- The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeAgent.
- InvokeFlow ( array $params = [] )
- Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream.
- Retrieve ( array $params = [] )
- Queries a knowledge base and retrieves information from it.
- RetrieveAndGenerate ( array $params = [] )
- Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile.
Paginators
Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:
Operations
DeleteAgentMemory
$result = $client->deleteAgentMemory
([/* ... */]); $promise = $client->deleteAgentMemoryAsync
([/* ... */]);
Deletes memory from the specified memory identifier.
Parameter Syntax
$result = $client->deleteAgentMemory([ 'agentAliasId' => '<string>', // REQUIRED 'agentId' => '<string>', // REQUIRED 'memoryId' => '<string>', ]);
Parameter Details
Members
- agentAliasId
-
- Required: Yes
- Type: string
The unique identifier of an alias of an agent.
- agentId
-
- Required: Yes
- Type: string
The unique identifier of the agent to which the alias belongs.
- memoryId
-
- Type: string
The unique identifier of the memory.
Result Syntax
[]
Result Details
Errors
- ConflictException:
There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException:
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException:
Input validation failed. Check your request parameters and retry the request.
- InternalServerException:
An internal server error occurred. Retry your request.
- DependencyFailedException:
There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException:
There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException:
The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException:
The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException:
The number of requests exceeds the service quota. Resubmit your request later.
GetAgentMemory
$result = $client->getAgentMemory
([/* ... */]); $promise = $client->getAgentMemoryAsync
([/* ... */]);
Gets the sessions stored in the memory of the agent.
Parameter Syntax
$result = $client->getAgentMemory([ 'agentAliasId' => '<string>', // REQUIRED 'agentId' => '<string>', // REQUIRED 'maxItems' => <integer>, 'memoryId' => '<string>', // REQUIRED 'memoryType' => 'SESSION_SUMMARY', // REQUIRED 'nextToken' => '<string>', ]);
Parameter Details
Members
- agentAliasId
-
- Required: Yes
- Type: string
The unique identifier of an alias of an agent.
- agentId
-
- Required: Yes
- Type: string
The unique identifier of the agent to which the alias belongs.
- maxItems
-
- Type: int
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
-
- Required: Yes
- Type: string
The unique identifier of the memory.
- memoryType
-
- Required: Yes
- Type: string
The type of memory.
- nextToken
-
- Type: 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.
Result Syntax
[ 'memoryContents' => [ [ 'sessionSummary' => [ 'memoryId' => '<string>', 'sessionExpiryTime' => <DateTime>, 'sessionId' => '<string>', 'sessionStartTime' => <DateTime>, 'summaryText' => '<string>', ], ], // ... ], 'nextToken' => '<string>', ]
Result Details
Members
- memoryContents
-
- Type: Array of Memory structures
Contains details of the sessions stored in the memory
- nextToken
-
- Type: 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.
Errors
- ConflictException:
There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException:
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException:
Input validation failed. Check your request parameters and retry the request.
- InternalServerException:
An internal server error occurred. Retry your request.
- DependencyFailedException:
There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException:
There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException:
The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException:
The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException:
The number of requests exceeds the service quota. Resubmit your request later.
InvokeAgent
$result = $client->invokeAgent
([/* ... */]); $promise = $client->invokeAgentAsync
([/* ... */]);
The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeAgent
.
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
totrue
. 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
totrue
. -
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 is returned in the bytes
field of the chunk
object.
-
The
attribution
object contains citations for parts of the response. -
If you set
enableTrace
totrue
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.
Parameter Syntax
$result = $client->invokeAgent([ 'agentAliasId' => '<string>', // REQUIRED 'agentId' => '<string>', // REQUIRED 'enableTrace' => true || false, 'endSession' => true || false, 'inputText' => '<string>', 'memoryId' => '<string>', 'sessionId' => '<string>', // REQUIRED 'sessionState' => [ 'files' => [ [ 'name' => '<string>', // REQUIRED 'source' => [ // REQUIRED 'byteContent' => [ 'data' => <string || resource || Psr\Http\Message\StreamInterface>, // REQUIRED 'mediaType' => '<string>', // REQUIRED ], 's3Location' => [ 'uri' => '<string>', // REQUIRED ], 'sourceType' => 'S3|BYTE_CONTENT', // REQUIRED ], 'useCase' => 'CODE_INTERPRETER|CHAT', // REQUIRED ], // ... ], 'invocationId' => '<string>', 'knowledgeBaseConfigurations' => [ [ 'knowledgeBaseId' => '<string>', // REQUIRED 'retrievalConfiguration' => [ // REQUIRED 'vectorSearchConfiguration' => [ // REQUIRED 'filter' => [ 'andAll' => [ [...], // RECURSIVE // ... ], 'equals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'greaterThan' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'greaterThanOrEquals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'in' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'lessThan' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'lessThanOrEquals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'listContains' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'notEquals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'notIn' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'orAll' => [ [...], // RECURSIVE // ... ], 'startsWith' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'stringContains' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], ], 'numberOfResults' => <integer>, 'overrideSearchType' => 'HYBRID|SEMANTIC', ], ], ], // ... ], 'promptSessionAttributes' => ['<string>', ...], 'returnControlInvocationResults' => [ [ 'apiResult' => [ 'actionGroup' => '<string>', // REQUIRED 'apiPath' => '<string>', 'confirmationState' => 'CONFIRM|DENY', 'httpMethod' => '<string>', 'httpStatusCode' => <integer>, 'responseBody' => [ '<String>' => [ 'body' => '<string>', ], // ... ], 'responseState' => 'FAILURE|REPROMPT', ], 'functionResult' => [ 'actionGroup' => '<string>', // REQUIRED 'confirmationState' => 'CONFIRM|DENY', 'function' => '<string>', 'responseBody' => [ '<String>' => [ 'body' => '<string>', ], // ... ], 'responseState' => 'FAILURE|REPROMPT', ], ], // ... ], 'sessionAttributes' => ['<string>', ...], ], ]);
Parameter Details
Members
- agentAliasId
-
- Required: Yes
- Type: string
The alias of the agent to use.
- agentId
-
- Required: Yes
- Type: string
The unique identifier of the agent to use.
- enableTrace
-
- Type: boolean
Specifies whether to turn on the trace or not to track the agent's reasoning process. For more information, see Trace enablement.
- endSession
-
- Type: boolean
Specifies whether to end the session with the agent or not.
- inputText
-
- Type: string
The prompt text to send the agent.
If you include
returnControlInvocationResults
in thesessionState
field, theinputText
field will be ignored. - memoryId
-
- Type: string
The unique identifier of the agent memory.
- sessionId
-
- Required: Yes
- Type: string
The unique identifier of the session. Use the same value across requests to continue the same conversation.
- sessionState
-
- Type: SessionState structure
Contains parameters that specify various attributes of the session. For more information, see Control session context.
If you include
returnControlInvocationResults
in thesessionState
field, theinputText
field will be ignored.
Result Syntax
[ 'completion' => [ // EventParsingIterator 'accessDeniedException' => [ 'message' => '<string>', ], 'badGatewayException' => [ 'message' => '<string>', 'resourceName' => '<string>', ], 'chunk' => [ 'attribution' => [ 'citations' => [ [ 'generatedResponsePart' => [ 'textResponsePart' => [ 'span' => [ 'end' => <integer>, 'start' => <integer>, ], 'text' => '<string>', ], ], 'retrievedReferences' => [ [ 'content' => [ 'text' => '<string>', ], 'location' => [ 'confluenceLocation' => [ 'url' => '<string>', ], 's3Location' => [ 'uri' => '<string>', ], 'salesforceLocation' => [ 'url' => '<string>', ], 'sharePointLocation' => [ 'url' => '<string>', ], 'type' => 'S3|WEB|CONFLUENCE|SALESFORCE|SHAREPOINT', 'webLocation' => [ 'url' => '<string>', ], ], 'metadata' => [ '<RetrievalResultMetadataKey>' => [ ], // ... ], ], // ... ], ], // ... ], ], 'bytes' => <string || resource || Psr\Http\Message\StreamInterface>, ], 'conflictException' => [ 'message' => '<string>', ], 'dependencyFailedException' => [ 'message' => '<string>', 'resourceName' => '<string>', ], 'files' => [ 'files' => [ [ 'bytes' => <string || resource || Psr\Http\Message\StreamInterface>, 'name' => '<string>', 'type' => '<string>', ], // ... ], ], 'internalServerException' => [ 'message' => '<string>', ], 'resourceNotFoundException' => [ 'message' => '<string>', ], 'returnControl' => [ 'invocationId' => '<string>', 'invocationInputs' => [ [ 'apiInvocationInput' => [ 'actionGroup' => '<string>', 'actionInvocationType' => 'RESULT|USER_CONFIRMATION|USER_CONFIRMATION_AND_RESULT', 'apiPath' => '<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', 'function' => '<string>', 'parameters' => [ [ 'name' => '<string>', 'type' => '<string>', 'value' => '<string>', ], // ... ], ], ], // ... ], ], 'serviceQuotaExceededException' => [ 'message' => '<string>', ], 'throttlingException' => [ 'message' => '<string>', ], 'trace' => [ 'agentAliasId' => '<string>', 'agentId' => '<string>', 'agentVersion' => '<string>', 'sessionId' => '<string>', 'trace' => [ 'failureTrace' => [ 'failureReason' => '<string>', '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', ], // ... ], ], ], // ... ], '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>', ], 'codeInterpreterInvocationInput' => [ 'code' => '<string>', 'files' => ['<string>', ...], ], 'invocationType' => 'ACTION_GROUP|KNOWLEDGE_BASE|FINISH|ACTION_GROUP_CODE_INTERPRETER', 'knowledgeBaseLookupInput' => [ 'knowledgeBaseId' => '<string>', 'text' => '<string>', ], 'traceId' => '<string>', ], 'modelInvocationInput' => [ 'inferenceConfiguration' => [ 'maximumLength' => <integer>, 'stopSequences' => ['<string>', ...], 'temperature' => <float>, 'topK' => <integer>, 'topP' => <float>, ], 'overrideLambda' => '<string>', 'parserMode' => 'DEFAULT|OVERRIDDEN', 'promptCreationMode' => 'DEFAULT|OVERRIDDEN', 'text' => '<string>', 'traceId' => '<string>', 'type' => 'PRE_PROCESSING|ORCHESTRATION|KNOWLEDGE_BASE_RESPONSE_GENERATION|POST_PROCESSING', ], 'modelInvocationOutput' => [ 'metadata' => [ 'usage' => [ 'inputTokens' => <integer>, 'outputTokens' => <integer>, ], ], 'rawResponse' => [ 'content' => '<string>', ], 'traceId' => '<string>', ], 'observation' => [ 'actionGroupInvocationOutput' => [ 'text' => '<string>', ], 'codeInterpreterInvocationOutput' => [ 'executionError' => '<string>', 'executionOutput' => '<string>', 'executionTimeout' => true || false, 'files' => ['<string>', ...], ], 'finalResponse' => [ 'text' => '<string>', ], 'knowledgeBaseLookupOutput' => [ 'retrievedReferences' => [ [ 'content' => [ 'text' => '<string>', ], 'location' => [ 'confluenceLocation' => [ 'url' => '<string>', ], 's3Location' => [ 'uri' => '<string>', ], 'salesforceLocation' => [ 'url' => '<string>', ], 'sharePointLocation' => [ 'url' => '<string>', ], 'type' => 'S3|WEB|CONFLUENCE|SALESFORCE|SHAREPOINT', 'webLocation' => [ 'url' => '<string>', ], ], 'metadata' => [ '<RetrievalResultMetadataKey>' => [ ], // ... ], ], // ... ], ], 'repromptResponse' => [ 'source' => 'ACTION_GROUP|KNOWLEDGE_BASE|PARSER', 'text' => '<string>', ], 'traceId' => '<string>', 'type' => 'ACTION_GROUP|KNOWLEDGE_BASE|FINISH|ASK_USER|REPROMPT', ], 'rationale' => [ 'text' => '<string>', 'traceId' => '<string>', ], ], 'postProcessingTrace' => [ 'modelInvocationInput' => [ 'inferenceConfiguration' => [ 'maximumLength' => <integer>, 'stopSequences' => ['<string>', ...], 'temperature' => <float>, 'topK' => <integer>, 'topP' => <float>, ], 'overrideLambda' => '<string>', 'parserMode' => 'DEFAULT|OVERRIDDEN', 'promptCreationMode' => 'DEFAULT|OVERRIDDEN', 'text' => '<string>', 'traceId' => '<string>', 'type' => 'PRE_PROCESSING|ORCHESTRATION|KNOWLEDGE_BASE_RESPONSE_GENERATION|POST_PROCESSING', ], 'modelInvocationOutput' => [ 'metadata' => [ 'usage' => [ 'inputTokens' => <integer>, 'outputTokens' => <integer>, ], ], 'parsedResponse' => [ 'text' => '<string>', ], 'rawResponse' => [ 'content' => '<string>', ], 'traceId' => '<string>', ], ], 'preProcessingTrace' => [ 'modelInvocationInput' => [ 'inferenceConfiguration' => [ 'maximumLength' => <integer>, 'stopSequences' => ['<string>', ...], 'temperature' => <float>, 'topK' => <integer>, 'topP' => <float>, ], 'overrideLambda' => '<string>', 'parserMode' => 'DEFAULT|OVERRIDDEN', 'promptCreationMode' => 'DEFAULT|OVERRIDDEN', 'text' => '<string>', 'traceId' => '<string>', 'type' => 'PRE_PROCESSING|ORCHESTRATION|KNOWLEDGE_BASE_RESPONSE_GENERATION|POST_PROCESSING', ], 'modelInvocationOutput' => [ 'metadata' => [ 'usage' => [ 'inputTokens' => <integer>, 'outputTokens' => <integer>, ], ], 'parsedResponse' => [ 'isValid' => true || false, 'rationale' => '<string>', ], 'rawResponse' => [ 'content' => '<string>', ], 'traceId' => '<string>', ], ], ], ], 'validationException' => [ 'message' => '<string>', ], ], 'contentType' => '<string>', 'memoryId' => '<string>', 'sessionId' => '<string>', ]
Result Details
Members
- completion
-
- Required: Yes
- Type: EventParsingIterator supplying the following structures: AccessDeniedException, BadGatewayException, PayloadPart, ConflictException, DependencyFailedException, FilePart, InternalServerException, ResourceNotFoundException, ReturnControlPayload, ServiceQuotaExceededException, ThrottlingException, TracePart, ValidationException
The agent's response to the user prompt.
- contentType
-
- Required: Yes
- Type: string
The MIME type of the input data in the request. The default value is
application/json
. - memoryId
-
- Type: string
The unique identifier of the agent memory.
- sessionId
-
- Required: Yes
- Type: string
The unique identifier of the session with the agent.
Using an EventParsingIterator
To use an EventParsingIterator, you will need to loop over the events it will generate and check the top-level field to determine which type of event it is.
foreach($result['completion'] as $event) { if (isset($event['accessDeniedException'])) { // Handle the 'accessDeniedException' event. } else if (isset($event['badGatewayException'])) { // Handle the 'badGatewayException' event. } else if (isset($event['chunk'])) { // Handle the 'chunk' event. } else if (isset($event['conflictException'])) { // Handle the 'conflictException' event. } else if (isset($event['dependencyFailedException'])) { // Handle the 'dependencyFailedException' event. } else if (isset($event['files'])) { // Handle the 'files' event. } else if (isset($event['internalServerException'])) { // Handle the 'internalServerException' event. } else if (isset($event['resourceNotFoundException'])) { // Handle the 'resourceNotFoundException' event. } else if (isset($event['returnControl'])) { // Handle the 'returnControl' event. } else if (isset($event['serviceQuotaExceededException'])) { // Handle the 'serviceQuotaExceededException' event. } else if (isset($event['throttlingException'])) { // Handle the 'throttlingException' event. } else if (isset($event['trace'])) { // Handle the 'trace' event. } else if (isset($event['validationException'])) { // Handle the 'validationException' event. } }
Errors
- ConflictException:
There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException:
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException:
Input validation failed. Check your request parameters and retry the request.
- InternalServerException:
An internal server error occurred. Retry your request.
- DependencyFailedException:
There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException:
There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException:
The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException:
The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException:
The number of requests exceeds the service quota. Resubmit your request later.
InvokeFlow
$result = $client->invokeFlow
([/* ... */]); $promise = $client->invokeFlowAsync
([/* ... */]);
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.
The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeFlow
.
Parameter Syntax
$result = $client->invokeFlow([ 'flowAliasIdentifier' => '<string>', // REQUIRED 'flowIdentifier' => '<string>', // REQUIRED 'inputs' => [ // REQUIRED [ 'content' => [ // REQUIRED 'document' => [ ], ], 'nodeName' => '<string>', // REQUIRED 'nodeOutputName' => '<string>', // REQUIRED ], // ... ], ]);
Parameter Details
Members
- flowAliasIdentifier
-
- Required: Yes
- Type: string
The unique identifier of the flow alias.
- flowIdentifier
-
- Required: Yes
- Type: string
The unique identifier of the flow.
- inputs
-
- Required: Yes
- Type: Array of FlowInput structures
A list of objects, each containing information about an input into the flow.
Result Syntax
[ 'responseStream' => [ // EventParsingIterator 'accessDeniedException' => [ 'message' => '<string>', ], 'badGatewayException' => [ 'message' => '<string>', 'resourceName' => '<string>', ], 'conflictException' => [ 'message' => '<string>', ], 'dependencyFailedException' => [ 'message' => '<string>', 'resourceName' => '<string>', ], 'flowCompletionEvent' => [ 'completionReason' => 'SUCCESS', ], 'flowOutputEvent' => [ 'content' => [ 'document' => [ ], ], 'nodeName' => '<string>', 'nodeType' => 'FlowInputNode|FlowOutputNode|LambdaFunctionNode|KnowledgeBaseNode|PromptNode|ConditionNode|LexNode', ], 'internalServerException' => [ 'message' => '<string>', ], 'resourceNotFoundException' => [ 'message' => '<string>', ], 'serviceQuotaExceededException' => [ 'message' => '<string>', ], 'throttlingException' => [ 'message' => '<string>', ], 'validationException' => [ 'message' => '<string>', ], ], ]
Result Details
Members
- responseStream
-
- Required: Yes
- Type: EventParsingIterator supplying the following structures: AccessDeniedException, BadGatewayException, ConflictException, DependencyFailedException, FlowCompletionEvent, FlowOutputEvent, InternalServerException, ResourceNotFoundException, ServiceQuotaExceededException, ThrottlingException, ValidationException
The output of the flow, returned as a stream. If there's an error, the error is returned.
Using an EventParsingIterator
To use an EventParsingIterator, you will need to loop over the events it will generate and check the top-level field to determine which type of event it is.
foreach($result['responseStream'] as $event) { if (isset($event['accessDeniedException'])) { // Handle the 'accessDeniedException' event. } else if (isset($event['badGatewayException'])) { // Handle the 'badGatewayException' event. } else if (isset($event['conflictException'])) { // Handle the 'conflictException' event. } else if (isset($event['dependencyFailedException'])) { // Handle the 'dependencyFailedException' event. } else if (isset($event['flowCompletionEvent'])) { // Handle the 'flowCompletionEvent' event. } else if (isset($event['flowOutputEvent'])) { // Handle the 'flowOutputEvent' event. } else if (isset($event['internalServerException'])) { // Handle the 'internalServerException' event. } else if (isset($event['resourceNotFoundException'])) { // Handle the 'resourceNotFoundException' event. } else if (isset($event['serviceQuotaExceededException'])) { // Handle the 'serviceQuotaExceededException' event. } else if (isset($event['throttlingException'])) { // Handle the 'throttlingException' event. } else if (isset($event['validationException'])) { // Handle the 'validationException' event. } }
Errors
- ConflictException:
There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException:
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException:
Input validation failed. Check your request parameters and retry the request.
- InternalServerException:
An internal server error occurred. Retry your request.
- DependencyFailedException:
There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException:
There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException:
The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException:
The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException:
The number of requests exceeds the service quota. Resubmit your request later.
Retrieve
$result = $client->retrieve
([/* ... */]); $promise = $client->retrieveAsync
([/* ... */]);
Queries a knowledge base and retrieves information from it.
Parameter Syntax
$result = $client->retrieve([ 'knowledgeBaseId' => '<string>', // REQUIRED 'nextToken' => '<string>', 'retrievalConfiguration' => [ 'vectorSearchConfiguration' => [ // REQUIRED 'filter' => [ 'andAll' => [ [...], // RECURSIVE // ... ], 'equals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'greaterThan' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'greaterThanOrEquals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'in' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'lessThan' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'lessThanOrEquals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'listContains' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'notEquals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'notIn' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'orAll' => [ [...], // RECURSIVE // ... ], 'startsWith' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'stringContains' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], ], 'numberOfResults' => <integer>, 'overrideSearchType' => 'HYBRID|SEMANTIC', ], ], 'retrievalQuery' => [ // REQUIRED 'text' => '<string>', // REQUIRED ], ]);
Parameter Details
Members
- knowledgeBaseId
-
- Required: Yes
- Type: string
The unique identifier of the knowledge base to query.
- nextToken
-
- Type: string
If there are more results than can fit in the response, the response returns a
nextToken
. Use this token in thenextToken
field of another request to retrieve the next batch of results. - retrievalConfiguration
-
- Type: KnowledgeBaseRetrievalConfiguration structure
Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.
- retrievalQuery
-
- Required: Yes
- Type: KnowledgeBaseQuery structure
Contains the query to send the knowledge base.
Result Syntax
[ 'nextToken' => '<string>', 'retrievalResults' => [ [ 'content' => [ 'text' => '<string>', ], 'location' => [ 'confluenceLocation' => [ 'url' => '<string>', ], 's3Location' => [ 'uri' => '<string>', ], 'salesforceLocation' => [ 'url' => '<string>', ], 'sharePointLocation' => [ 'url' => '<string>', ], 'type' => 'S3|WEB|CONFLUENCE|SALESFORCE|SHAREPOINT', 'webLocation' => [ 'url' => '<string>', ], ], 'metadata' => [ '<RetrievalResultMetadataKey>' => [ ], // ... ], 'score' => <float>, ], // ... ], ]
Result Details
Members
- nextToken
-
- Type: string
If there are more results than can fit in the response, the response returns a
nextToken
. Use this token in thenextToken
field of another request to retrieve the next batch of results. - retrievalResults
-
- Required: Yes
- Type: Array of KnowledgeBaseRetrievalResult structures
A list of results from querying the knowledge base.
Errors
- ConflictException:
There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException:
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException:
Input validation failed. Check your request parameters and retry the request.
- InternalServerException:
An internal server error occurred. Retry your request.
- DependencyFailedException:
There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException:
There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException:
The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException:
The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException:
The number of requests exceeds the service quota. Resubmit your request later.
RetrieveAndGenerate
$result = $client->retrieveAndGenerate
([/* ... */]); $promise = $client->retrieveAndGenerateAsync
([/* ... */]);
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.
Parameter Syntax
$result = $client->retrieveAndGenerate([ 'input' => [ // REQUIRED 'text' => '<string>', // REQUIRED ], 'retrieveAndGenerateConfiguration' => [ 'externalSourcesConfiguration' => [ 'generationConfiguration' => [ 'additionalModelRequestFields' => [ '<AdditionalModelRequestFieldsKey>' => [ ], // ... ], 'guardrailConfiguration' => [ 'guardrailId' => '<string>', // REQUIRED 'guardrailVersion' => '<string>', // REQUIRED ], 'inferenceConfig' => [ 'textInferenceConfig' => [ 'maxTokens' => <integer>, 'stopSequences' => ['<string>', ...], 'temperature' => <float>, 'topP' => <float>, ], ], 'promptTemplate' => [ 'textPromptTemplate' => '<string>', ], ], 'modelArn' => '<string>', // REQUIRED 'sources' => [ // REQUIRED [ 'byteContent' => [ 'contentType' => '<string>', // REQUIRED 'data' => <string || resource || Psr\Http\Message\StreamInterface>, // REQUIRED 'identifier' => '<string>', // REQUIRED ], 's3Location' => [ 'uri' => '<string>', // REQUIRED ], 'sourceType' => 'S3|BYTE_CONTENT', // REQUIRED ], // ... ], ], 'knowledgeBaseConfiguration' => [ 'generationConfiguration' => [ 'additionalModelRequestFields' => [ '<AdditionalModelRequestFieldsKey>' => [ ], // ... ], 'guardrailConfiguration' => [ 'guardrailId' => '<string>', // REQUIRED 'guardrailVersion' => '<string>', // REQUIRED ], 'inferenceConfig' => [ 'textInferenceConfig' => [ 'maxTokens' => <integer>, 'stopSequences' => ['<string>', ...], 'temperature' => <float>, 'topP' => <float>, ], ], 'promptTemplate' => [ 'textPromptTemplate' => '<string>', ], ], 'knowledgeBaseId' => '<string>', // REQUIRED 'modelArn' => '<string>', // REQUIRED 'orchestrationConfiguration' => [ 'queryTransformationConfiguration' => [ // REQUIRED 'type' => 'QUERY_DECOMPOSITION', // REQUIRED ], ], 'retrievalConfiguration' => [ 'vectorSearchConfiguration' => [ // REQUIRED 'filter' => [ 'andAll' => [ [...], // RECURSIVE // ... ], 'equals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'greaterThan' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'greaterThanOrEquals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'in' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'lessThan' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'lessThanOrEquals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'listContains' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'notEquals' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'notIn' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'orAll' => [ [...], // RECURSIVE // ... ], 'startsWith' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], 'stringContains' => [ 'key' => '<string>', // REQUIRED 'value' => [ // REQUIRED ], ], ], 'numberOfResults' => <integer>, 'overrideSearchType' => 'HYBRID|SEMANTIC', ], ], ], 'type' => 'KNOWLEDGE_BASE|EXTERNAL_SOURCES', // REQUIRED ], 'sessionConfiguration' => [ 'kmsKeyArn' => '<string>', // REQUIRED ], 'sessionId' => '<string>', ]);
Parameter Details
Members
- input
-
- Required: Yes
- Type: RetrieveAndGenerateInput structure
Contains the query to be made to the knowledge base.
- retrieveAndGenerateConfiguration
-
- Type: RetrieveAndGenerateConfiguration structure
Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.
- sessionConfiguration
-
- Type: RetrieveAndGenerateSessionConfiguration structure
Contains details about the session with the knowledge base.
- sessionId
-
- Type: 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 thesessionId
yourself.
Result Syntax
[ 'citations' => [ [ 'generatedResponsePart' => [ 'textResponsePart' => [ 'span' => [ 'end' => <integer>, 'start' => <integer>, ], 'text' => '<string>', ], ], 'retrievedReferences' => [ [ 'content' => [ 'text' => '<string>', ], 'location' => [ 'confluenceLocation' => [ 'url' => '<string>', ], 's3Location' => [ 'uri' => '<string>', ], 'salesforceLocation' => [ 'url' => '<string>', ], 'sharePointLocation' => [ 'url' => '<string>', ], 'type' => 'S3|WEB|CONFLUENCE|SALESFORCE|SHAREPOINT', 'webLocation' => [ 'url' => '<string>', ], ], 'metadata' => [ '<RetrievalResultMetadataKey>' => [ ], // ... ], ], // ... ], ], // ... ], 'guardrailAction' => 'INTERVENED|NONE', 'output' => [ 'text' => '<string>', ], 'sessionId' => '<string>', ]
Result Details
Members
- citations
-
- Type: Array of Citation structures
A list of segments of the generated response that are based on sources in the knowledge base, alongside information about the sources.
- guardrailAction
-
- Type: string
Specifies if there is a guardrail intervention in the response.
- output
-
- Required: Yes
- Type: RetrieveAndGenerateOutput structure
Contains the response generated from querying the knowledge base.
- sessionId
-
- Required: Yes
- Type: 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 thesessionId
yourself.
Errors
- ConflictException:
There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException:
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException:
Input validation failed. Check your request parameters and retry the request.
- InternalServerException:
An internal server error occurred. Retry your request.
- DependencyFailedException:
There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException:
There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException:
The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException:
The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException:
The number of requests exceeds the service quota. Resubmit your request later.
Shapes
AccessDeniedException
Description
The request is denied because of missing access permissions. Check your permissions and retry your request.
Members
- message
-
- Type: string
ActionGroupInvocationInput
Description
Contains information about the action group being invoked. For more information about the possible structures, see the InvocationInput tab in OrchestrationTrace in the Amazon Bedrock User Guide.
Members
- actionGroupName
-
- Type: string
The name of the action group.
- apiPath
-
- Type: string
The path to the API to call, based off the action group.
- executionType
-
- Type: string
How fulfillment of the action is handled. For more information, see Handling fulfillment of the action.
- function
-
- Type: string
The function in the action group to call.
- invocationId
-
- Type: string
The unique identifier of the invocation. Only returned if the
executionType
isRETURN_CONTROL
. - parameters
-
- Type: Array of Parameter structures
The parameters in the Lambda input event.
- requestBody
-
- Type: RequestBody structure
The parameters in the request body for the Lambda input event.
- verb
-
- Type: string
The API method being used, based off the action group.
ActionGroupInvocationOutput
Description
Contains the JSON-formatted string returned by the API invoked by the action group.
Members
- text
-
- Type: string
The JSON-formatted string returned by the API invoked by the action group.
AdditionalModelRequestFieldsValue
Members
ApiInvocationInput
Description
Contains information about the API operation that the agent predicts should be called.
This data type is used in the following API operations:
-
In the
returnControl
field of the InvokeAgent response
Members
- actionGroup
-
- Required: Yes
- Type: string
The action group that the API operation belongs to.
- actionInvocationType
-
- Type: string
Contains information about the API operation to invoke.
- apiPath
-
- Type: string
The path to the API operation.
- httpMethod
-
- Type: string
The HTTP method of the API operation.
- parameters
-
- Type: Array of ApiParameter structures
The parameters to provide for the API request, as the agent elicited from the user.
- requestBody
-
- Type: ApiRequestBody structure
The request body to provide for the API request, as the agent elicited from the user.
ApiParameter
Description
Information about a parameter to provide to the API request.
This data type is used in the following API operations:
Members
- name
-
- Type: string
The name of the parameter.
- type
-
- Type: string
The data type for the parameter.
- value
-
- Type: string
The value of the parameter.
ApiRequestBody
Description
The request body to provide for the API request, as the agent elicited from the user.
This data type is used in the following API operations:
Members
- content
-
- Type: Associative array of custom strings keys (String) to PropertyParameters structures
The content of the request body. The key of the object in this field is a media type defining the format of the request body.
ApiResult
Description
Contains information about the API operation that was called from the action group and the response body that was returned.
This data type is used in the following API operations:
-
In the
returnControlInvocationResults
of the InvokeAgent request
Members
- actionGroup
-
- Required: Yes
- Type: string
The action group that the API operation belongs to.
- apiPath
-
- Type: string
The path to the API operation.
- confirmationState
-
- Type: string
Controls the API operations or functions to invoke based on the user confirmation.
- httpMethod
-
- Type: string
The HTTP method for the API operation.
- httpStatusCode
-
- Type: int
http status code from API execution response (for example: 200, 400, 500).
- responseBody
-
- Type: Associative array of custom strings keys (String) to ContentBody structures
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. - responseState
-
- Type: 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
Attribution
Description
Contains citations for a part of an agent response.
Members
- citations
-
- Type: Array of Citation structures
A list of citations and related information for a part of an agent response.
BadGatewayException
Description
There was an issue with a dependency due to a server issue. Retry your request.
Members
- message
-
- Type: string
- resourceName
-
- Type: string
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS.
ByteContentDoc
Description
This property contains the document to chat with, along with its attributes.
Members
- contentType
-
- Required: Yes
- Type: string
The MIME type of the document contained in the wrapper object.
- data
-
- Required: Yes
- Type: blob (string|resource|Psr\Http\Message\StreamInterface)
The byte value of the file to upload, encoded as a Base-64 string.
- identifier
-
- Required: Yes
- Type: string
The file name of the document contained in the wrapper object.
ByteContentFile
Description
The property contains the file to chat with, along with its attributes.
Members
- data
-
- Required: Yes
- Type: blob (string|resource|Psr\Http\Message\StreamInterface)
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
-
- Required: Yes
- Type: string
The MIME type of data contained in the file used for chat.
Citation
Description
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
Members
- generatedResponsePart
-
- Type: GeneratedResponsePart structure
Contains the generated response and metadata
- retrievedReferences
-
- Type: Array of RetrievedReference structures
Contains metadata about the sources cited for the generated response.
CodeInterpreterInvocationInput
Description
Contains information about the code interpreter being invoked.
Members
- code
-
- Type: string
The code for the code interpreter to use.
- files
-
- Type: Array of strings
Files that are uploaded for code interpreter to use.
CodeInterpreterInvocationOutput
Description
Contains the JSON-formatted string returned by the API invoked by the code interpreter.
Members
- executionError
-
- Type: string
Contains the error returned from code execution.
- executionOutput
-
- Type: string
Contains the successful output returned from code execution
- executionTimeout
-
- Type: boolean
Indicates if the execution of the code timed out.
- files
-
- Type: Array of strings
Contains output files, if generated by code execution.
ConflictException
Description
There was a conflict performing an operation. Resolve the conflict and retry your request.
Members
- message
-
- Type: string
ContentBody
Description
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
Members
- body
-
- Type: string
The body of the API response.
DependencyFailedException
Description
There was an issue with a dependency. Check the resource configurations and retry the request.
Members
- message
-
- Type: string
- resourceName
-
- Type: string
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS.
Document
Members
ExternalSource
Description
The unique external source of the content contained in the wrapper object.
Members
- byteContent
-
- Type: ByteContentDoc structure
The identifier, contentType, and data of the external source wrapper object.
- s3Location
-
- Type: S3ObjectDoc structure
The S3 location of the external source wrapper object.
- sourceType
-
- Required: Yes
- Type: string
The source type of the external source wrapper object.
ExternalSourcesGenerationConfiguration
Description
Contains the generation configuration of the external source wrapper object.
Members
- additionalModelRequestFields
-
- Type: Associative array of custom strings keys (AdditionalModelRequestFieldsKey) to document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documentss
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.
- guardrailConfiguration
-
- Type: GuardrailConfiguration structure
The configuration details for the guardrail.
- inferenceConfig
-
- Type: InferenceConfig structure
Configuration settings for inference when using RetrieveAndGenerate to generate responses while using an external source.
- promptTemplate
-
- Type: PromptTemplate structure
Contain the textPromptTemplate string for the external source wrapper object.
ExternalSourcesRetrieveAndGenerateConfiguration
Description
The configurations of the external source wrapper object in the retrieveAndGenerate
function.
Members
- generationConfiguration
-
- Type: ExternalSourcesGenerationConfiguration structure
The prompt used with the external source wrapper object with the
retrieveAndGenerate
function. - modelArn
-
- Required: Yes
- Type: string
The model Amazon Resource Name (ARN) for the external source wrapper object in the
retrieveAndGenerate
function. - sources
-
- Required: Yes
- Type: Array of ExternalSource structures
The document for the external source wrapper object in the
retrieveAndGenerate
function.
FailureTrace
Description
Contains information about the failure of the interaction.
Members
- failureReason
-
- Type: string
The reason the interaction failed.
- traceId
-
- Type: string
The unique identifier of the trace.
FilePart
Description
Contains intermediate response for code interpreter if any files have been generated.
Members
- files
-
- Type: Array of OutputFile structures
Files containing intermediate response for the user.
FileSource
Description
The source file of the content contained in the wrapper object.
Members
- byteContent
-
- Type: ByteContentFile structure
The data and the text of the attached files.
- s3Location
-
- Type: S3ObjectFile structure
The s3 location of the files to attach.
- sourceType
-
- Required: Yes
- Type: string
The source type of the files to attach.
FilterAttribute
Description
Specifies the name that the metadata attribute must match and the value to which to compare the value of the metadata attribute. For more information, see Query configurations.
This data type is used in the following API operations:
Members
- key
-
- Required: Yes
- Type: string
The name that the metadata attribute must match.
- value
-
- Required: Yes
- Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents
The value to whcih to compare the value of the metadata attribute.
FilterValue
Members
FinalResponse
Description
Contains details about the response to the user.
Members
- text
-
- Type: string
The text in the response to the user.
FlowCompletionEvent
Description
Contains information about why a flow completed.
This data type is used in the following API operations:
Members
- completionReason
-
- Required: Yes
- Type: string
The reason that the flow completed.
FlowInput
Description
Contains information about an input into the prompt flow and where to send it.
This data type is used in the following API operations:
Members
- content
-
- Required: Yes
- Type: FlowInputContent structure
Contains information about an input into the prompt flow.
- nodeName
-
- Required: Yes
- Type: string
The name of the flow input node that begins the prompt flow.
- nodeOutputName
-
- Required: Yes
- Type: string
The name of the output from the flow input node that begins the prompt flow.
FlowInputContent
Description
Contains information about an input into the flow.
This data type is used in the following API operations:
Members
- document
-
- Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents
The input to send to the prompt flow input node.
FlowOutputContent
Description
Contains information about the content in an output from prompt flow invocation.
This data type is used in the following API operations:
Members
- document
-
- Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents
The content in the output.
FlowOutputEvent
Description
Contains information about an output from prompt flow invoction.
This data type is used in the following API operations:
Members
- content
-
- Required: Yes
- Type: FlowOutputContent structure
The content in the output.
- nodeName
-
- Required: Yes
- Type: string
The name of the flow output node that the output is from.
- nodeType
-
- Required: Yes
- Type: string
The type of the node that the output is from.
FlowResponseStream
Description
Members
- accessDeniedException
-
- Type: AccessDeniedException structure
The request is denied because of missing access permissions. Check your permissions and retry your request.
- badGatewayException
-
- Type: BadGatewayException structure
There was an issue with a dependency due to a server issue. Retry your request.
- conflictException
-
- Type: ConflictException structure
There was a conflict performing an operation. Resolve the conflict and retry your request.
- dependencyFailedException
-
- Type: DependencyFailedException structure
There was an issue with a dependency. Check the resource configurations and retry the request.
- flowCompletionEvent
-
- Type: FlowCompletionEvent structure
Contains information about why the flow completed.
- flowOutputEvent
-
- Type: FlowOutputEvent structure
Contains information about an output from flow invocation.
- internalServerException
-
- Type: InternalServerException structure
An internal server error occurred. Retry your request.
- resourceNotFoundException
-
- Type: ResourceNotFoundException structure
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- serviceQuotaExceededException
-
- Type: ServiceQuotaExceededException structure
The number of requests exceeds the service quota. Resubmit your request later.
- throttlingException
-
- Type: ThrottlingException structure
The number of requests exceeds the limit. Resubmit your request later.
- validationException
-
- Type: ValidationException structure
Input validation failed. Check your request parameters and retry the request.
FunctionInvocationInput
Description
Contains information about the function that the agent predicts should be called.
This data type is used in the following API operations:
-
In the
returnControl
field of the InvokeAgent response
Members
- actionGroup
-
- Required: Yes
- Type: string
The action group that the function belongs to.
- actionInvocationType
-
- Type: string
Contains information about the function to invoke,
- function
-
- Type: string
The name of the function.
- parameters
-
- Type: Array of FunctionParameter structures
A list of parameters of the function.
FunctionParameter
Description
Contains information about a parameter of the function.
This data type is used in the following API operations:
-
In the
returnControl
field of the InvokeAgent response
Members
- name
-
- Type: string
The name of the parameter.
- type
-
- Type: string
The data type of the parameter.
- value
-
- Type: string
The value of the parameter.
FunctionResult
Description
Contains information about the function that was called from the action group and the response that was returned.
This data type is used in the following API operations:
-
In the
returnControlInvocationResults
of the InvokeAgent request
Members
- actionGroup
-
- Required: Yes
- Type: string
The action group that the function belongs to.
- confirmationState
-
- Type: string
Contains the user confirmation information about the function that was called.
- function
-
- Type: string
The name of the function that was called.
- responseBody
-
- Type: Associative array of custom strings keys (String) to ContentBody structures
The response from the function call using the parameters. 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. - responseState
-
- Type: 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
GeneratedResponsePart
Description
Contains metadata about a part of the generated response that is accompanied by a citation.
This data type is used in the following API operations:
-
InvokeAgent response – in the
generatedResponsePart
field -
RetrieveAndGenerate response – in the
generatedResponsePart
field
Members
- textResponsePart
-
- Type: TextResponsePart structure
Contains metadata about a textual part of the generated response that is accompanied by a citation.
GenerationConfiguration
Description
Contains configurations for response generation based on the knowledge base query results.
This data type is used in the following API operations:
Members
- additionalModelRequestFields
-
- Type: Associative array of custom strings keys (AdditionalModelRequestFieldsKey) to document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documentss
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.
- guardrailConfiguration
-
- Type: GuardrailConfiguration structure
The configuration details for the guardrail.
- inferenceConfig
-
- Type: InferenceConfig structure
Configuration settings for inference when using RetrieveAndGenerate to generate responses while using a knowledge base as a source.
- promptTemplate
-
- Type: PromptTemplate structure
Contains the template for the prompt that's sent to the model for response generation.
GuardrailAssessment
Description
Assessment details of the content analyzed by Guardrails.
Members
- contentPolicy
-
- Type: GuardrailContentPolicyAssessment structure
Content policy details of the Guardrail.
- sensitiveInformationPolicy
-
- Type: GuardrailSensitiveInformationPolicyAssessment structure
Sensitive Information policy details of Guardrail.
- topicPolicy
-
- Type: GuardrailTopicPolicyAssessment structure
Topic policy details of the Guardrail.
- wordPolicy
-
- Type: GuardrailWordPolicyAssessment structure
Word policy details of the Guardrail.
GuardrailConfiguration
Description
The configuration details for the guardrail.
Members
- guardrailId
-
- Required: Yes
- Type: string
The unique identifier for the guardrail.
- guardrailVersion
-
- Required: Yes
- Type: string
The version of the guardrail.
GuardrailContentFilter
Description
Details of the content filter used in the Guardrail.
Members
- action
-
- Type: string
The action placed on the content by the Guardrail filter.
- confidence
-
- Type: string
The confidence level regarding the content detected in the filter by the Guardrail.
- type
-
- Type: string
The type of content detected in the filter by the Guardrail.
GuardrailContentPolicyAssessment
Description
The details of the policy assessment in the Guardrails filter.
Members
- filters
-
- Type: Array of GuardrailContentFilter structures
The filter details of the policy assessment used in the Guardrails filter.
GuardrailCustomWord
Description
The custom word details for the filter in the Guardrail.
Members
- action
-
- Type: string
The action details for the custom word filter in the Guardrail.
- match
-
- Type: string
The match details for the custom word filter in the Guardrail.
GuardrailManagedWord
Description
The managed word details for the filter in the Guardrail.
Members
- action
-
- Type: string
The action details for the managed word filter in the Guardrail.
- match
-
- Type: string
The match details for the managed word filter in the Guardrail.
- type
-
- Type: string
The type details for the managed word filter in the Guardrail.
GuardrailPiiEntityFilter
Description
The Guardrail filter to identify and remove personally identifiable information (PII).
Members
- action
-
- Type: string
The action of the Guardrail filter to identify and remove PII.
- match
-
- Type: string
The match to settings in the Guardrail filter to identify and remove PII.
- type
-
- Type: string
The type of PII the Guardrail filter has identified and removed.
GuardrailRegexFilter
Description
The details for the regex filter used in the Guardrail.
Members
- action
-
- Type: string
The action details for the regex filter used in the Guardrail.
- match
-
- Type: string
The match details for the regex filter used in the Guardrail.
- name
-
- Type: string
The name details for the regex filter used in the Guardrail.
- regex
-
- Type: string
The regex details for the regex filter used in the Guardrail.
GuardrailSensitiveInformationPolicyAssessment
Description
The details of the sensitive policy assessment used in the Guardrail.
Members
- piiEntities
-
- Type: Array of GuardrailPiiEntityFilter structures
The details of the PII entities used in the sensitive policy assessment for the Guardrail.
- regexes
-
- Type: Array of GuardrailRegexFilter structures
The details of the regexes used in the sensitive policy assessment for the Guardrail.
GuardrailTopic
Description
The details for a specific topic defined in the Guardrail.
Members
- action
-
- Type: string
The action details on a specific topic in the Guardrail.
- name
-
- Type: string
The name details on a specific topic in the Guardrail.
- type
-
- Type: string
The type details on a specific topic in the Guardrail.
GuardrailTopicPolicyAssessment
Description
The details of the policy assessment used in the Guardrail.
Members
- topics
-
- Type: Array of GuardrailTopic structures
The topic details of the policy assessment used in the Guardrail.
GuardrailTrace
Description
The trace details used in the Guardrail.
Members
- action
-
- Type: string
The trace action details used with the Guardrail.
- inputAssessments
-
- Type: Array of GuardrailAssessment structures
The details of the input assessments used in the Guardrail Trace.
- outputAssessments
-
- Type: Array of GuardrailAssessment structures
The details of the output assessments used in the Guardrail Trace.
- traceId
-
- Type: string
The details of the trace Id used in the Guardrail Trace.
GuardrailWordPolicyAssessment
Description
The assessment details for words defined in the Guardrail filter.
Members
- customWords
-
- Type: Array of GuardrailCustomWord structures
The custom word details for words defined in the Guardrail filter.
- managedWordLists
-
- Type: Array of GuardrailManagedWord structures
The managed word lists for words defined in the Guardrail filter.
InferenceConfig
Description
The configuration for inference settings when generating responses using RetrieveAndGenerate.
Members
- textInferenceConfig
-
- Type: TextInferenceConfig structure
Configuration settings specific to text generation while generating responses using RetrieveAndGenerate.
InferenceConfiguration
Description
Specifications about the inference parameters that were provided alongside the prompt. These are specified in the PromptOverrideConfiguration object that was set when the agent was created or updated. For more information, see Inference parameters for foundation models.
Members
- maximumLength
-
- Type: int
The maximum number of tokens allowed in the generated response.
- stopSequences
-
- Type: Array of strings
A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.
- temperature
-
- Type: 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
-
- Type: int
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 settopK
to 50, the model selects the next token from among the top 50 most likely choices. - topP
-
- Type: 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 settopP
to 0.8, the model only selects the next token from the top 80% of the probability distribution of next tokens.
InputFile
Description
Contains details of the source files.
Members
- name
-
- Required: Yes
- Type: string
The name of the source file.
- source
-
- Required: Yes
- Type: FileSource structure
Specifies where the files are located.
- useCase
-
- Required: Yes
- Type: string
Specifies how the source files will be used by the code interpreter.
InternalServerException
Description
An internal server error occurred. Retry your request.
Members
- message
-
- Type: string
InvocationInput
Description
Contains information pertaining to the action group or knowledge base that is being invoked.
Members
- actionGroupInvocationInput
-
- Type: ActionGroupInvocationInput structure
Contains information about the action group to be invoked.
- codeInterpreterInvocationInput
-
- Type: CodeInterpreterInvocationInput structure
Contains information about the code interpreter to be invoked.
- invocationType
-
- Type: string
Specifies whether the agent is invoking an action group or a knowledge base.
- knowledgeBaseLookupInput
-
- Type: KnowledgeBaseLookupInput structure
Contains details about the knowledge base to look up and the query to be made.
- traceId
-
- Type: string
The unique identifier of the trace.
InvocationInputMember
Description
Contains details about the API operation or function that the agent predicts should be called.
This data type is used in the following API operations:
-
In the
returnControl
field of the InvokeAgent response
Members
- apiInvocationInput
-
- Type: ApiInvocationInput structure
Contains information about the API operation that the agent predicts should be called.
- functionInvocationInput
-
- Type: FunctionInvocationInput structure
Contains information about the function that the agent predicts should be called.
InvocationResultMember
Description
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:
Members
- apiResult
-
- Type: ApiResult structure
The result from the API response from the action group invocation.
- functionResult
-
- Type: FunctionResult structure
The result from the function from the action group invocation.
KnowledgeBaseConfiguration
Description
Configurations to apply to a knowledge base attached to the agent during query. For more information, see Knowledge base retrieval configurations.
Members
- knowledgeBaseId
-
- Required: Yes
- Type: string
The unique identifier for a knowledge base attached to the agent.
- retrievalConfiguration
-
- Required: Yes
- Type: KnowledgeBaseRetrievalConfiguration structure
The configurations to apply to the knowledge base during query. For more information, see Query configurations.
KnowledgeBaseLookupInput
Description
Contains details about the knowledge base to look up and the query to be made.
Members
- knowledgeBaseId
-
- Type: string
The unique identifier of the knowledge base to look up.
- text
-
- Type: string
The query made to the knowledge base.
KnowledgeBaseLookupOutput
Description
Contains details about the results from looking up the knowledge base.
Members
- retrievedReferences
-
- Type: Array of RetrievedReference structures
Contains metadata about the sources cited for the generated response.
KnowledgeBaseQuery
Description
Contains the query made to the knowledge base.
This data type is used in the following API operations:
-
Retrieve request – in the
retrievalQuery
field
Members
- text
-
- Required: Yes
- Type: string
The text of the query made to the knowledge base.
KnowledgeBaseRetrievalConfiguration
Description
Contains configurations for knowledge base query. For more information, see Query configurations.
This data type is used in the following API operations:
-
Retrieve request – in the
retrievalConfiguration
field -
RetrieveAndGenerate request – in the
retrievalConfiguration
field
Members
- vectorSearchConfiguration
-
- Required: Yes
- Type: KnowledgeBaseVectorSearchConfiguration structure
Contains details about how the results from the vector search should be returned. For more information, see Query configurations.
KnowledgeBaseRetrievalResult
Description
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
Members
- content
-
- Required: Yes
- Type: RetrievalResultContent structure
Contains a chunk of text from a data source in the knowledge base.
- location
-
- Type: RetrievalResultLocation structure
Contains information about the location of the data source.
- metadata
-
- Type: Associative array of custom strings keys (RetrievalResultMetadataKey) to document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documentss
Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering.
- score
-
- Type: double
The level of relevance of the result to the query.
KnowledgeBaseRetrieveAndGenerateConfiguration
Description
Contains details about the resource being queried.
This data type is used in the following API operations:
-
Retrieve request – in the
knowledgeBaseConfiguration
field -
RetrieveAndGenerate request – in the
knowledgeBaseConfiguration
field
Members
- generationConfiguration
-
- Type: GenerationConfiguration structure
Contains configurations for response generation based on the knowledge base query results.
- knowledgeBaseId
-
- Required: Yes
- Type: string
The unique identifier of the knowledge base that is queried.
- modelArn
-
- Required: Yes
- Type: string
The ARN of the foundation model or inference profile used to generate a response.
- orchestrationConfiguration
-
- Type: OrchestrationConfiguration structure
Settings for how the model processes the prompt prior to retrieval and generation.
- retrievalConfiguration
-
- Type: KnowledgeBaseRetrievalConfiguration structure
Contains configurations for how to retrieve and return the knowledge base query.
KnowledgeBaseVectorSearchConfiguration
Description
Configurations for how to perform the search query and return results. For more information, see Query configurations.
This data type is used in the following API operations:
-
Retrieve request – in the
vectorSearchConfiguration
field -
RetrieveAndGenerate request – in the
vectorSearchConfiguration
field
Members
- filter
-
- Type: RetrievalFilter structure
Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see Query configurations.
- numberOfResults
-
- Type: int
The number of source chunks to retrieve.
- overrideSearchType
-
- Type: 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, orSEMANTIC
search using only vector embeddings. For other vector store configurations, onlySEMANTIC
search is available. For more information, see Test a knowledge base.
Memory
Description
Contains sessions summaries.
Members
- sessionSummary
-
- Type: MemorySessionSummary structure
Contains summary of a session.
MemorySessionSummary
Description
Contains details of a session summary.
Members
- memoryId
-
- Type: string
The unique identifier of the memory where the session summary is stored.
- sessionExpiryTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The time when the memory duration for the session is set to end.
- sessionId
-
- Type: string
The identifier for this session.
- sessionStartTime
-
- Type: timestamp (string|DateTime or anything parsable by strtotime)
The start time for this session.
- summaryText
-
- Type: string
The summarized text for this session.
Metadata
Description
Provides details of the foundation model.
Members
- usage
-
- Type: Usage structure
Contains details of the foundation model usage.
ModelInvocationInput
Description
The input for the pre-processing step.
-
The
type
matches the agent step. -
The
text
contains the prompt. -
The
inferenceConfiguration
,parserMode
, andoverrideLambda
values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.
Members
- inferenceConfiguration
-
- Type: InferenceConfiguration structure
Specifications about the inference parameters that were provided alongside the prompt. These are specified in the PromptOverrideConfiguration object that was set when the agent was created or updated. For more information, see Inference parameters for foundation models.
- overrideLambda
-
- Type: string
The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
- parserMode
-
- Type: 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
. - promptCreationMode
-
- Type: string
Specifies whether the default prompt template was
OVERRIDDEN
. If it was, thebasePromptTemplate
that was set in the PromptOverrideConfiguration object when the agent was created or updated is used instead. - text
-
- Type: string
The text that prompted the agent at this step.
- traceId
-
- Type: string
The unique identifier of the trace.
- type
-
- Type: string
The step in the agent sequence.
Observation
Description
Contains the result or output of an action group or knowledge base, or the response to the user.
Members
- actionGroupInvocationOutput
-
- Type: ActionGroupInvocationOutput structure
Contains the JSON-formatted string returned by the API invoked by the action group.
- codeInterpreterInvocationOutput
-
- Type: CodeInterpreterInvocationOutput structure
Contains the JSON-formatted string returned by the API invoked by the code interpreter.
- finalResponse
-
- Type: FinalResponse structure
Contains details about the response to the user.
- knowledgeBaseLookupOutput
-
- Type: KnowledgeBaseLookupOutput structure
Contains details about the results from looking up the knowledge base.
- repromptResponse
-
- Type: RepromptResponse structure
Contains details about the response to reprompt the input.
- traceId
-
- Type: string
The unique identifier of the trace.
- type
-
- Type: string
Specifies what kind of information the agent returns in the observation. The following values are possible.
-
ACTION_GROUP
– The agent returns the result of an action group. -
KNOWLEDGE_BASE
– The agent returns information from a knowledge base. -
FINISH
– The agent returns a final response to the user with no follow-up. -
ASK_USER
– The agent asks the user a question. -
REPROMPT
– The agent prompts the user again for the same information.
OrchestrationConfiguration
Description
Settings for how the model processes the prompt prior to retrieval and generation.
Members
- queryTransformationConfiguration
-
- Required: Yes
- Type: QueryTransformationConfiguration structure
To split up the prompt and retrieve multiple sources, set the transformation type to
QUERY_DECOMPOSITION
.
OrchestrationModelInvocationOutput
Description
The foundation model output from the orchestration step.
Members
- metadata
-
- Type: Metadata structure
Contains information about the foundation model output.
- rawResponse
-
- Type: RawResponse structure
Contains details of the raw response from the foundation model output.
- traceId
-
- Type: string
The unique identifier of the trace.
OrchestrationTrace
Description
Details about the orchestration step, in which the agent determines the order in which actions are executed and which knowledge bases are retrieved.
Members
- invocationInput
-
- Type: InvocationInput structure
Contains information pertaining to the action group or knowledge base that is being invoked.
- modelInvocationInput
-
- Type: ModelInvocationInput structure
The input for the orchestration step.
-
The
type
isORCHESTRATION
. -
The
text
contains the prompt. -
The
inferenceConfiguration
,parserMode
, andoverrideLambda
values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.
- modelInvocationOutput
-
- Type: OrchestrationModelInvocationOutput structure
Contains information pertaining to the output from the foundation model that is being invoked.
- observation
-
- Type: Observation structure
Details about the observation (the output of the action group Lambda or knowledge base) made by the agent.
- rationale
-
- Type: Rationale structure
Details about the reasoning, based on the input, that the agent uses to justify carrying out an action group or getting information from a knowledge base.
OutputFile
Description
Contains details of the response from code interpreter.
Members
- bytes
-
- Type: blob (string|resource|Psr\Http\Message\StreamInterface)
The byte count of files that contains response from code interpreter.
- name
-
- Type: string
The name of the file containing response from code interpreter.
- type
-
- Type: string
The type of file that contains response from the code interpreter.
Parameter
Description
A parameter for the API request or function.
Members
- name
-
- Type: string
The name of the parameter.
- type
-
- Type: string
The type of the parameter.
- value
-
- Type: string
The value of the parameter.
PayloadPart
Description
Contains a part of an agent response and citations for it.
Members
- attribution
-
- Type: Attribution structure
Contains citations for a part of an agent response.
- bytes
-
- Type: blob (string|resource|Psr\Http\Message\StreamInterface)
A part of the agent response in bytes.
PostProcessingModelInvocationOutput
Description
The foundation model output from the post-processing step.
Members
- metadata
-
- Type: Metadata structure
Provides details of the foundation model.
- parsedResponse
-
- Type: PostProcessingParsedResponse structure
Details about the response from the Lambda parsing of the output of the post-processing step.
- rawResponse
-
- Type: RawResponse structure
Contains the raw output from the foundation model.
- traceId
-
- Type: string
The unique identifier of the trace.
PostProcessingParsedResponse
Description
Details about the response from the Lambda parsing of the output from the post-processing step.
Members
- text
-
- Type: string
The text returned by the parser.
PostProcessingTrace
Description
Details about the post-processing step, in which the agent shapes the response.
Members
- modelInvocationInput
-
- Type: ModelInvocationInput structure
The input for the post-processing step.
-
The
type
isPOST_PROCESSING
. -
The
text
contains the prompt. -
The
inferenceConfiguration
,parserMode
, andoverrideLambda
values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.
- modelInvocationOutput
-
- Type: PostProcessingModelInvocationOutput structure
The foundation model output from the post-processing step.
PreProcessingModelInvocationOutput
Description
The foundation model output from the pre-processing step.
Members
- metadata
-
- Type: Metadata structure
Provides details of the foundation model.
- parsedResponse
-
- Type: PreProcessingParsedResponse structure
Details about the response from the Lambda parsing of the output of the pre-processing step.
- rawResponse
-
- Type: RawResponse structure
Contains the raw output from the foundation model.
- traceId
-
- Type: string
The unique identifier of the trace.
PreProcessingParsedResponse
Description
Details about the response from the Lambda parsing of the output from the pre-processing step.
Members
- isValid
-
- Type: boolean
Whether the user input is valid or not. If
false
, the agent doesn't proceed to orchestration. - rationale
-
- Type: string
The text returned by the parsing of the pre-processing step, explaining the steps that the agent plans to take in orchestration, if the user input is valid.
PreProcessingTrace
Description
Details about the pre-processing step, in which the agent contextualizes and categorizes user inputs.
Members
- modelInvocationInput
-
- Type: ModelInvocationInput structure
The input for the pre-processing step.
-
The
type
isPRE_PROCESSING
. -
The
text
contains the prompt. -
The
inferenceConfiguration
,parserMode
, andoverrideLambda
values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.
- modelInvocationOutput
-
- Type: PreProcessingModelInvocationOutput structure
The foundation model output from the pre-processing step.
PromptTemplate
Description
Contains the template for the prompt that's sent to the model for response generation. For more information, see Knowledge base prompt templates.
This data type is used in the following API operations:
-
RetrieveAndGenerate request – in the
filter
field
Members
- textPromptTemplate
-
- Type: 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:
PropertyParameters
Description
Contains the parameters in the request body.
Members
- properties
-
- Type: Array of Parameter structures
A list of parameters in the request body.
QueryTransformationConfiguration
Description
To split up the prompt and retrieve multiple sources, set the transformation type to QUERY_DECOMPOSITION
.
Members
- type
-
- Required: Yes
- Type: string
The type of transformation to apply to the prompt.
Rationale
Description
Contains the reasoning, based on the input, that the agent uses to justify carrying out an action group or getting information from a knowledge base.
Members
- text
-
- Type: string
The reasoning or thought process of the agent, based on the input.
- traceId
-
- Type: string
The unique identifier of the trace step.
RawResponse
Description
Contains the raw output from the foundation model.
Members
- content
-
- Type: string
The foundation model's raw output content.
RepromptResponse
Description
Contains details about the agent's response to reprompt the input.
Members
- source
-
- Type: string
Specifies what output is prompting the agent to reprompt the input.
- text
-
- Type: string
The text reprompting the input.
RequestBody
Description
The parameters in the API request body.
Members
- content
-
- Type: Associative array of custom strings keys (String) to Parameter structuress
The content in the request body.
ResourceNotFoundException
Description
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
Members
- message
-
- Type: string
ResponseStream
Description
The response from invoking the agent and associated citations and trace information.
Members
- accessDeniedException
-
- Type: AccessDeniedException structure
The request is denied because of missing access permissions. Check your permissions and retry your request.
- badGatewayException
-
- Type: BadGatewayException structure
There was an issue with a dependency due to a server issue. Retry your request.
- chunk
-
- Type: PayloadPart structure
Contains a part of an agent response and citations for it.
- conflictException
-
- Type: ConflictException structure
There was a conflict performing an operation. Resolve the conflict and retry your request.
- dependencyFailedException
-
- Type: DependencyFailedException structure
There was an issue with a dependency. Check the resource configurations and retry the request.
- files
-
- Type: FilePart structure
Contains intermediate response for code interpreter if any files have been generated.
- internalServerException
-
- Type: InternalServerException structure
An internal server error occurred. Retry your request.
- resourceNotFoundException
-
- Type: ResourceNotFoundException structure
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- returnControl
-
- Type: ReturnControlPayload structure
Contains the parameters and information that the agent elicited from the customer to carry out an action. This information is returned to the system and can be used in your own setup for fulfilling the action.
- serviceQuotaExceededException
-
- Type: ServiceQuotaExceededException structure
The number of requests exceeds the service quota. Resubmit your request later.
- throttlingException
-
- Type: ThrottlingException structure
The number of requests exceeds the limit. Resubmit your request later.
- trace
-
- Type: TracePart structure
Contains information about the agent and session, alongside the agent's reasoning process and results from calling actions and querying knowledge bases and metadata about the trace. You can use the trace to understand how the agent arrived at the response it provided the customer. For more information, see Trace events.
- validationException
-
- Type: ValidationException structure
Input validation failed. Check your request parameters and retry the request.
RetrievalFilter
Description
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
Members
- andAll
-
- Type: Array of RetrievalFilter structures
Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list.
- equals
-
- Type: FilterAttribute structure
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value matches thevalue
in this object.The following example would return data sources with an
animal
attribute whose value iscat
:"equals": { "key": "animal", "value": "cat" }
- greaterThan
-
- Type: FilterAttribute structure
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value is greater than thevalue
in this object.The following example would return data sources with an
year
attribute whose value is greater than1989
:"greaterThan": { "key": "year", "value": 1989 }
- greaterThanOrEquals
-
- Type: FilterAttribute structure
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 thevalue
in this object.The following example would return data sources with an
year
attribute whose value is greater than or equal to1989
:"greaterThanOrEquals": { "key": "year", "value": 1989 }
- in
-
- Type: FilterAttribute structure
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 thevalue
in this object.The following example would return data sources with an
animal
attribute that is eithercat
ordog
:"in": { "key": "animal", "value": ["cat", "dog"] }
- lessThan
-
- Type: FilterAttribute structure
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value is less than thevalue
in this object.The following example would return data sources with an
year
attribute whose value is less than to1989
."lessThan": { "key": "year", "value": 1989 }
- lessThanOrEquals
-
- Type: FilterAttribute structure
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 thevalue
in this object.The following example would return data sources with an
year
attribute whose value is less than or equal to1989
."lessThanOrEquals": { "key": "year", "value": 1989 }
- listContains
-
- Type: FilterAttribute structure
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 thevalue
as one of its members.The following example would return data sources with an
animals
attribute that is a list containing acat
member (for example["dog", "cat"]
)."listContains": { "key": "animals", "value": "cat" }
- notEquals
-
- Type: FilterAttribute structure
Knowledge base data sources that contain a metadata attribute whose name matches the
key
and whose value doesn't match thevalue
in this object are returned.The following example would return data sources that don't contain an
animal
attribute whose value iscat
."notEquals": { "key": "animal", "value": "cat" }
- notIn
-
- Type: FilterAttribute structure
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 thevalue
in this object.The following example would return data sources whose
animal
attribute is neithercat
nordog
."notIn": { "key": "animal", "value": ["cat", "dog"] }
- orAll
-
- Type: Array of RetrievalFilter structures
Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list.
- startsWith
-
- Type: FilterAttribute structure
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value starts with thevalue
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 withca
(for example,cat
orcamel
)."startsWith": { "key": "animal", "value": "ca" }
- stringContains
-
- Type: FilterAttribute structure
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 ananimal
attribute that contains the substringat
(for examplecat
)."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 ananimals
attribute that is a list containing a member that contains the substringat
(for example["dog", "cat"]
)."stringContains": { "key": "animals", "value": "at" }
RetrievalResultConfluenceLocation
Description
The Confluence data source location.
Members
- url
-
- Type: string
The Confluence host URL for the data source location.
RetrievalResultContent
Description
Contains the cited text from the data source.
This data type is used in the following API operations:
-
Retrieve response – in the
content
field -
RetrieveAndGenerate response – in the
content
field -
InvokeAgent response – in the
content
field
Members
- text
-
- Required: Yes
- Type: string
The cited text from the data source.
RetrievalResultLocation
Description
Contains information about the data source location.
This data type is used in the following API operations:
-
Retrieve response – in the
location
field -
RetrieveAndGenerate response – in the
location
field -
InvokeAgent response – in the
locatino
field
Members
- confluenceLocation
-
- Type: RetrievalResultConfluenceLocation structure
The Confluence data source location.
- s3Location
-
- Type: RetrievalResultS3Location structure
The S3 data source location.
- salesforceLocation
-
- Type: RetrievalResultSalesforceLocation structure
The Salesforce data source location.
- sharePointLocation
-
- Type: RetrievalResultSharePointLocation structure
The SharePoint data source location.
- type
-
- Required: Yes
- Type: string
The type of data source location.
- webLocation
-
- Type: RetrievalResultWebLocation structure
The web URL/URLs data source location.
RetrievalResultMetadataValue
Members
RetrievalResultS3Location
Description
The S3 data source location.
This data type is used in the following API operations:
-
Retrieve response – in the
s3Location
field -
RetrieveAndGenerate response – in the
s3Location
field -
InvokeAgent response – in the
s3Location
field
Members
- uri
-
- Type: string
The S3 URI for the data source location.
RetrievalResultSalesforceLocation
Description
The Salesforce data source location.
Members
- url
-
- Type: string
The Salesforce host URL for the data source location.
RetrievalResultSharePointLocation
Description
The SharePoint data source location.
Members
- url
-
- Type: string
The SharePoint site URL for the data source location.
RetrievalResultWebLocation
Description
The web URL/URLs data source location.
Members
- url
-
- Type: string
The web URL/URLs for the data source location.
RetrieveAndGenerateConfiguration
Description
Contains details about the resource being queried.
This data type is used in the following API operations:
-
RetrieveAndGenerate request – in the
retrieveAndGenerateConfiguration
field
Members
- externalSourcesConfiguration
-
- Type: ExternalSourcesRetrieveAndGenerateConfiguration structure
The configuration for the external source wrapper object in the
retrieveAndGenerate
function. - knowledgeBaseConfiguration
-
- Type: KnowledgeBaseRetrieveAndGenerateConfiguration structure
Contains details about the knowledge base for retrieving information and generating responses.
- type
-
- Required: Yes
- Type: string
The type of resource that contains your data for retrieving information and generating responses.
If you choose ot use
EXTERNAL_SOURCES
, then currently only Claude 3 Sonnet models for knowledge bases are supported.
RetrieveAndGenerateInput
Description
Contains the query made to the knowledge base.
This data type is used in the following API operations:
-
RetrieveAndGenerate request – in the
input
field
Members
- text
-
- Required: Yes
- Type: string
The query made to the knowledge base.
RetrieveAndGenerateOutput
Description
Contains the response generated from querying the knowledge base.
This data type is used in the following API operations:
-
RetrieveAndGenerate response – in the
output
field
Members
- text
-
- Required: Yes
- Type: string
The response generated from querying the knowledge base.
RetrieveAndGenerateSessionConfiguration
Description
Contains configuration about the session with the knowledge base.
This data type is used in the following API operations:
-
RetrieveAndGenerate request – in the
sessionConfiguration
field
Members
- kmsKeyArn
-
- Required: Yes
- Type: string
The ARN of the KMS key encrypting the session.
RetrievedReference
Description
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
Members
- content
-
- Type: RetrievalResultContent structure
Contains the cited text from the data source.
- location
-
- Type: RetrievalResultLocation structure
Contains information about the location of the data source.
- metadata
-
- Type: Associative array of custom strings keys (RetrievalResultMetadataKey) to document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documentss
Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering.
ReturnControlPayload
Description
Contains information to return from the action group that the agent has predicted to invoke.
This data type is used in the following API operations:
Members
- invocationId
-
- Type: string
The identifier of the action group invocation.
- invocationInputs
-
- Type: Array of InvocationInputMember structures
A list of objects that contain information about the parameters and inputs that need to be sent into the API operation or function, based on what the agent determines from its session with the user.
S3ObjectDoc
Description
The unique wrapper object of the document from the S3 location.
Members
- uri
-
- Required: Yes
- Type: string
The file location of the S3 wrapper object.
S3ObjectFile
Description
Contains details of the s3 object where the source file is located.
Members
- uri
-
- Required: Yes
- Type: string
The uri of the s3 object.
ServiceQuotaExceededException
Description
The number of requests exceeds the service quota. Resubmit your request later.
Members
- message
-
- Type: string
SessionState
Description
Contains parameters that specify various attributes that persist across a session or prompt. You can define session state attributes as key-value pairs when writing a Lambda function for an action group or pass them when making an InvokeAgent request. Use session state attributes to control and provide conversational context for your agent and to help customize your agent's behavior. For more information, see Control session context.
Members
- files
-
- Type: Array of InputFile structures
Contains information about the files used by code interpreter.
- invocationId
-
- Type: string
The identifier of the invocation of an action. This value must match the
invocationId
returned in theInvokeAgent
response for the action whose results are provided in thereturnControlInvocationResults
field. For more information, see Return control to the agent developer and Control session context. - knowledgeBaseConfigurations
-
- Type: Array of KnowledgeBaseConfiguration structures
An array of configurations, each of which applies to a knowledge base attached to the agent.
- promptSessionAttributes
-
- Type: Associative array of custom strings keys (String) to strings
Contains attributes that persist across a prompt and the values of those attributes. These attributes replace the $prompt_session_attributes$ placeholder variable in the orchestration prompt template. For more information, see Prompt template placeholder variables.
- returnControlInvocationResults
-
- Type: Array of InvocationResultMember structures
Contains information about the results from the action group invocation. For more information, see Return control to the agent developer and Control session context.
If you include this field, the
inputText
field will be ignored. - sessionAttributes
-
- Type: Associative array of custom strings keys (String) to strings
Contains attributes that persist across a session and the values of those attributes.
Span
Description
Contains information about where the text with a citation begins and ends in the generated output.
This data type is used in the following API operations:
-
RetrieveAndGenerate response – in the
span
field -
InvokeAgent response – in the
span
field
Members
- end
-
- Type: int
Where the text with a citation ends in the generated output.
- start
-
- Type: int
Where the text with a citation starts in the generated output.
TextInferenceConfig
Description
Configuration settings for text generation using a language model via the RetrieveAndGenerate operation. Includes parameters like temperature, top-p, maximum token count, and stop sequences.
The valid range of maxTokens
depends on the accepted values for your chosen model's inference parameters. To see the inference parameters for your model, see Inference parameters for foundation models.
Members
- maxTokens
-
- Type: int
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
-
- Type: Array of strings
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.
- temperature
-
- Type: 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
-
- Type: 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.
TextResponsePart
Description
Contains the part of the generated text that contains a citation, alongside where it begins and ends.
This data type is used in the following API operations:
-
RetrieveAndGenerate response – in the
textResponsePart
field -
InvokeAgent response – in the
textResponsePart
field
Members
- span
-
- Type: Span structure
Contains information about where the text with a citation begins and ends in the generated output.
- text
-
- Type: string
The part of the generated text that contains a citation.
ThrottlingException
Description
The number of requests exceeds the limit. Resubmit your request later.
Members
- message
-
- Type: string
Trace
Description
Contains one part of the agent's reasoning process and results from calling API actions and querying knowledge bases. You can use the trace to understand how the agent arrived at the response it provided the customer. For more information, see Trace enablement.
Members
- failureTrace
-
- Type: FailureTrace structure
Contains information about the failure of the interaction.
- guardrailTrace
-
- Type: GuardrailTrace structure
The trace details for a trace defined in the Guardrail filter.
- orchestrationTrace
-
- Type: OrchestrationTrace structure
Details about the orchestration step, in which the agent determines the order in which actions are executed and which knowledge bases are retrieved.
- postProcessingTrace
-
- Type: PostProcessingTrace structure
Details about the post-processing step, in which the agent shapes the response..
- preProcessingTrace
-
- Type: PreProcessingTrace structure
Details about the pre-processing step, in which the agent contextualizes and categorizes user inputs.
TracePart
Description
Contains information about the agent and session, alongside the agent's reasoning process and results from calling API actions and querying knowledge bases and metadata about the trace. You can use the trace to understand how the agent arrived at the response it provided the customer. For more information, see Trace enablement.
Members
- agentAliasId
-
- Type: string
The unique identifier of the alias of the agent.
- agentId
-
- Type: string
The unique identifier of the agent.
- agentVersion
-
- Type: string
The version of the agent.
- sessionId
-
- Type: string
The unique identifier of the session with the agent.
- trace
-
- Type: Trace structure
Contains one part of the agent's reasoning process and results from calling API actions and querying knowledge bases. You can use the trace to understand how the agent arrived at the response it provided the customer. For more information, see Trace enablement.
Usage
Description
Contains information of the usage of the foundation model.
Members
- inputTokens
-
- Type: int
Contains information about the input tokens from the foundation model usage.
- outputTokens
-
- Type: int
Contains information about the output tokens from the foundation model usage.
ValidationException
Description
Input validation failed. Check your request parameters and retry the request.
Members
- message
-
- Type: string