Full name: projects.locations.reasoningEngines.memories.retrieve
Retrieve memories.
Endpoint
posthttps://{service-endpoint}/v1beta1/{parent}/memories:retrieve
Where {service-endpoint} is one of the supported service endpoints.
Path parameters
parentstring
Required. The resource name of the ReasoningEngine to retrieve memories from. Format: projects/{project}/locations/{location}/reasoningEngines/{reasoningEngine}
Request body
The request body contains data with the following structure:
scopemap (key: string, value: string)
Required. The scope of the memories to retrieve. A memory must have exactly the same scope (Memory.scope) as the scope provided here to be retrieved (same keys and values). Order does not matter, but it is case-sensitive.
retrieval_paramsUnion type
retrieval_params can be only one of the following:Parameters for semantic similarity search based retrieval.
Parameters for simple (non-similarity search) retrieval.
Response body
Response message for MemoryBankService.RetrieveMemories.
If successful, the response body contains data with the following structure:
The retrieved memories.
nextPageTokenstring
A token that can be sent as pageToken to retrieve the next page. If this field is omitted, there are no subsequent pages. This token is not set if similarity search was used for retrieval.
| JSON representation |
|---|
{
"retrievedMemories": [
{
object ( |
SimilaritySearchParams
Parameters for semantic similarity search based retrieval.
searchQuerystring
Required. Query to use for similarity search retrieval. If provided, then the parent ReasoningEngine must have ReasoningEngineContextSpec.MemoryBankConfig.SimilaritySearchConfig set.
topKinteger
Optional. The maximum number of memories to return. The service may return fewer than this value. If unspecified, at most 3 memories will be returned. The maximum value is 100; values above 100 will be coerced to 100.
| JSON representation |
|---|
{ "searchQuery": string, "topK": integer } |
SimpleRetrievalParams
Parameters for simple (non-similarity search) retrieval.
pageSizeinteger
Optional. The maximum number of memories to return. The service may return fewer than this value. If unspecified, at most 3 memories will be returned. The maximum value is 100; values above 100 will be coerced to 100.
pageTokenstring
Optional. A page token, received from a previous memories.retrieve call. Provide this to retrieve the subsequent page.
| JSON representation |
|---|
{ "pageSize": integer, "pageToken": string } |
RetrievedMemory
A retrieved memory.
The retrieved Memory.
distancenumber
The distance between the query and the retrieved Memory. Smaller values indicate more similar memories. This is only set if similarity search was used for retrieval.
| JSON representation |
|---|
{
"memory": {
object ( |