Memory

Recall facts by meaning

Changed on

Embed the query and return the closest facts in the scope, ranked by cosine similarity.

Scope goes in the body, like POST /v1/memory: scope plus the matching id.

Without minScore, a scope always answers with its limit closest facts however distant they are — a search that found nothing relevant is indistinguishable from one that found the right thing. Set minScore when your code branches on "did I know this?".

post/v1/memory/search

Request

  • Base URL
    https://api.zavu.dev
  • URL
    https://api.zavu.dev/v1/memory/search
  • Auth
    HTTP bearer

Request body

querystring required

What to recall. Max 8,192 bytes. Phrase it as the fact you hope to find, not as a keyword: the match is semantic.

scope'project' | 'contact' | 'conversation'

Which namespace a memory belongs to. Scopes are isolated: a search in one never returns a memory from another.

  • project: shared by the whole project. What the agent knows in general.
  • contact: what the agent knows about one person, across every conversation with them.
  • conversation: what the agent knows about one inbox thread.

Defaults to project everywhere. contact and conversation require the matching id.

contactIdstring

Required when scope is contact.

conversationIdstring

Required when scope is conversation.

limitinteger

Maximum hits to return, closest first.

minScorenumber

Drop hits below this similarity. Without it every scope returns its limit closest facts, however far away they are — an empty-handed search still answers with something. Set it (0.3 or above is a reasonable floor) when "nothing relevant" must be distinguishable from "the least irrelevant thing I hold".

Example request

{
  "query": "when is a good time to reach them"
}

Response

Matching facts, closest first. An empty items means nothing cleared minScore.

Example response

{
  "items": [
    {
      "score": 0.83
    }
  ]
}

Changes