Skip to content

Bedrock Agent Runtime  >  Operations  >  retrieve

retrieve

Operation

retrieve async

retrieve(input: RetrieveInput, plugins: list[Plugin] | None = None) -> RetrieveOutput

Queries a knowledge base and retrieves information from it.

Parameters:

Name Type Description Default
input RetrieveInput

An instance of RetrieveInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
RetrieveOutput

An instance of RetrieveOutput.

Input

RetrieveInput dataclass

Dataclass for RetrieveInput structure.

Attributes

guardrail_configuration class-attribute instance-attribute
guardrail_configuration: GuardrailConfiguration | None = None

Guardrail settings.

knowledge_base_id class-attribute instance-attribute
knowledge_base_id: str | None = None

The unique identifier of the knowledge base to query.

next_token class-attribute instance-attribute
next_token: str | None = None

If there are more results than can fit in the response, the response returns a nextToken. Use this token in the nextToken field of another request to retrieve the next batch of results.

retrieval_configuration class-attribute instance-attribute
retrieval_configuration: KnowledgeBaseRetrievalConfiguration | None = None

Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.

retrieval_query class-attribute instance-attribute
retrieval_query: KnowledgeBaseQuery | None = field(repr=False, default=None)

Contains the query to send the knowledge base.

user_context class-attribute instance-attribute
user_context: UserContext | None = field(repr=False, default=None)

Contains information about the user making the request. Use this to pass user identity information for access control filtering, so that retrieval results only include documents the user is authorized to access.

Output

RetrieveOutput dataclass

Dataclass for RetrieveOutput structure.

Attributes

guardrail_action class-attribute instance-attribute
guardrail_action: GuadrailAction | None = None

Specifies if there is a guardrail intervention in the response.

next_token class-attribute instance-attribute
next_token: str | None = None

If there are more results than can fit in the response, the response returns a nextToken. Use this token in the nextToken field of another request to retrieve the next batch of results.

retrieval_results class-attribute instance-attribute
retrieval_results: list[KnowledgeBaseRetrievalResult] = field(repr=False)

A list of results from querying the knowledge base.