Skip to main content

POST /memory/search

Search memories based on a query using semantic similarity. Returns relevant memories with similarity scores. Optionally filter results by memory type.

Request Body

string
required
The search query. The API will find memories semantically similar to this query.
string
required
Unique identifier for the user whose memories to search.
integer
default:"10"
Maximum number of results to return. Defaults to 10.
string
Filter results by memory type. Accepts: LONG_TERM, SHORT_TERM, EPISODIC, SEMANTIC, or PROCEDURAL.

Response

boolean
Indicates whether the operation was successful.
array
Array of matching memories sorted by relevance.

Example Request

Example Response

Filtering by Memory Type

Search only for episodic memories (past events):

Search Short-Term Memories

Find what the user is currently working on:

Error Responses

string
Error message describing what went wrong.
500 Internal Server Error

Implementation Details

  • Source: backend/main.py:221
  • Search Method: Semantic similarity using vector embeddings
  • Index: Supabase HNSW index with cosine distance
  • Filtering: Supports metadata-based filtering for memory_type and custom fields