Skip to main content

GraphRAG

Vector search finds things that read like your query. It can't answer "who does Alice work with, and what do they know?" — that needs a graph. ZeroDB maintains both, and lets you search across both at once.

Store relationships: relate()

Subject / predicate / object triples with a confidence score.

curl -X POST https://api.ainative.studio/api/v1/public/memory/v2/relate \
  -H "X-API-Key: <your_api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "subject": "alice",
    "predicate": "works_at",
    "object": "ainative",
    "confidence": 0.9
  }'

Each entity string is hashed to a deterministic id, so the same subject/object strings always resolve to the same graph node across calls.

Query the graph: graph(entity_id)

Returns every relationship touching an entity, ranked by confidence — the raw edges a graph UI or an agent can walk:

curl https://api.ainative.studio/api/v1/public/memory/v2/graph/alice \
  -H "X-API-Key: <your_api_key>"

Hybrid retrieval: use_graph on recall

The same /recall endpoint used for plain vector memory search takes a use_graph flag that augments vector similarity with graph traversal — a single call instead of separately querying a vector index and a graph store and merging results yourself:

curl -X POST https://api.ainative.studio/api/v1/public/memory/v2/recall \
  -H "X-API-Key: <your_api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "who does alice work with?",
    "use_graph": true
  }'

Entities, and a dashboard to see them

Entities are auto-extracted from stored memories, not just manually related, and listed via GET /v1/public/memory/v2/entities. The same entity/relationship data is visualized in the Knowledge Graph dashboard once you're signed in.

What was verified, and how

  • relate(), graph(), and the use_graph flag on recall are real methods/fields read directly from app/services/memory/zeromemory.py and its FastAPI request models in this session.
  • Every endpoint path above (/relate, /graph/{entity_id}, /entities, /recall) was confirmed live by direct request against api.ainative.studio: each returns 401 (route exists, auth required), while a made-up path on the same prefix returns 404 as a control.
  • These graph endpoints are not listed in the public /openapi.json schema — they were found in the frontend's own API-client source and confirmed live by direct curl, not by reading published API docs.
ZeroDB — part of AINative Studio