AgentsforBedrockRuntime / Client / retrieve_and_generate
retrieve_and_generate#
- AgentsforBedrockRuntime.Client.retrieve_and_generate(**kwargs)#
RetrieveAndGenerate API
See also: AWS API Documentation
Request Syntax
response = client.retrieve_and_generate( sessionId='string', input={ 'text': 'string' }, retrieveAndGenerateConfiguration={ 'type': 'KNOWLEDGE_BASE', 'knowledgeBaseConfiguration': { 'knowledgeBaseId': 'string', 'modelArn': 'string' } }, sessionConfiguration={ 'kmsKeyArn': 'string' } )
- Parameters:
sessionId (string) – Identifier of the session.
input (dict) –
[REQUIRED]
Customer input of the turn
text (string) – [REQUIRED]
Customer input of the turn in text
retrieveAndGenerateConfiguration (dict) –
Configures the retrieval and generation for the session.
type (string) – [REQUIRED]
The type of RetrieveAndGenerate.
knowledgeBaseConfiguration (dict) –
Configurations for retrieval and generation for knowledge base.
knowledgeBaseId (string) – [REQUIRED]
Identifier of the KnowledgeBase
modelArn (string) – [REQUIRED]
Arn of a Bedrock model.
sessionConfiguration (dict) –
Configures common parameters of the session.
kmsKeyArn (string) – [REQUIRED]
The KMS key arn to encrypt the customer data of the session.
- Return type:
dict
- Returns:
Response Syntax
{ 'sessionId': 'string', 'output': { 'text': 'string' }, 'citations': [ { 'generatedResponsePart': { 'textResponsePart': { 'text': 'string', 'span': { 'start': 123, 'end': 123 } } }, 'retrievedReferences': [ { 'content': { 'text': 'string' }, 'location': { 'type': 'S3', 's3Location': { 'uri': 'string' } } }, ] }, ] }
Response Structure
(dict) –
sessionId (string) –
Identifier of the session.
output (dict) –
Service response of the turn
text (string) –
Service response of the turn in text
citations (list) –
List of citations
(dict) –
Citation associated with the agent response
generatedResponsePart (dict) –
Generate response part
textResponsePart (dict) –
Text response part
text (string) –
Response part in text
span (dict) –
Span of text
start (integer) –
Start of span
end (integer) –
End of span
retrievedReferences (list) –
list of retrieved references
(dict) –
Retrieved reference
content (dict) –
Content of a retrieval result.
text (string) –
Content of a retrieval result in text
location (dict) –
The source location of a retrieval result.
type (string) –
The location type of a retrieval result.
s3Location (dict) –
The S3 location of a retrieval result.
uri (string) –
URI of S3 location
Exceptions
AgentsforBedrockRuntime.Client.exceptions.ConflictException
AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundException
AgentsforBedrockRuntime.Client.exceptions.ValidationException
AgentsforBedrockRuntime.Client.exceptions.InternalServerException
AgentsforBedrockRuntime.Client.exceptions.DependencyFailedException
AgentsforBedrockRuntime.Client.exceptions.BadGatewayException
AgentsforBedrockRuntime.Client.exceptions.ThrottlingException
AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException
AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededException