Search Memory
Search memories based on a user query.
Parameters
query (str, required) — Retrieval query string.
user_id (str, optional) — User identifier for the memory.
agent_id (str, optional) — Agent identifier for the memory.
scopes (set[MemoryScope], optional) — Specifies the target for memory management, either for a specific participant or for combined access (USER or ASSISTANT). Default is [USER].
USER: Writes and retrieves memories targeting messages from user.
ASSISTANT: Writes and retrieves memories targeting messages from assistant.
USER, ASSISTANT: Writes and retrieves memories targeting messages from both the user and assistant.
metadata (dict[str, str], optional) — Extra metadata linked to the memory, which can be used to store any supplementary details or context related to it. Default is None.
threshold (float, optional) — Minimum similarity threshold for results. Default is 0.3.
top_k (int, optional) — Maximum number of results to return. Default is 10.
Note: At least one of user_id or agent_id must be provided.
Returns
list[Chunk] — A list of retrieved memory chunks. Each Chunk follows the GL SDK format and includes an id, content, metadata, and score.
Example
Expected Output
Last updated