1. What it is
Bring Your Own Graph (BYOG) lets you attach agraph_payload - your own entities and relations - to a source (a document, an app_knowledge source, or a memory) on POST /context/ingest. For that source, HydraDB uses your graph instead of running LLM extraction.
Your graph is stored in exactly the same shape extraction produces (source → relation → target triplets), so it answers queries identically - it shows up in the graph_context slice and its relations point back at the source’s chunks. No query-side changes are needed.
2. When to use it
Use BYOG when you already know the relationships and want them used verbatim:- You maintain a curated knowledge graph, an ontology, or a database export and want those exact facts in HydraDB.
- You need deterministic, reproducible relations rather than model-extracted ones.
- You want faster ingestion - a BYOG document skips the extraction LLM call entirely.
3. The graph_payload shape
graph_payload is a JSON string: a map keyed by source id - a document’s document_metadata id, an app_knowledge item’s id, or a memory’s id - where each value is that source’s graph (an entities map + a relations list). Attach graphs to several sources in one request by adding more keys.
- Top-level key - the id of the source this graph belongs to (a document’s
document_metadataid, anapp_knowledgeitem’sid, or a memory’sid). A key matching no source in the request is rejected with400. entities- a map keyed by a caller-local id. Each entity has aname(required),type,namespace, and optionalidentifier(an external id - display-only). The entity key is just a handle for relations to reference; it is not stored.relations- a list of edges.sourceandtargetare entity-map keys;predicateis any plain string;contextandtemporal_detailsare optional per relation.- No
chunk_id- you never supply or see chunk ids; HydraDB resolves them server-side when it links your relations to the source’s chunks. - Entity names are normalized (lowercased) so they match at query time, just like extracted entities. Entities that no relation references are dropped.
4. How it behaves
- Replace mode. A BYOG document’s graph is your
graph_payload; LLM extraction is skipped for it. The document is still chunked and embedded, so it stays fully vector-searchable. - Chunk linking. Each relation is linked to the source’s most relevant chunk(s), so
graph_contextresults hydrate the right passages. Linking is permissive (see Limitations). - Queryable like any graph. Your relations appear in the
/querygraph_contextslice (taggedorigin: "byog"in metadata) and traverse exactly like extracted ones - see Context Graphs. - Durable across re-ingest. Your graph is persisted server-side, so it outlives a single upload. Re-ingesting the same source without a
graph_payload- a connector re-sync, or just iterating on the document’s content - re-applies your stored graph: HydraDB does not fall back to LLM extraction and does not error. Your facts are never silently lost. To change the graph, re-ingest with a newgraph_payload; it replaces the stored copy (replace mode).
5. Limits
graph_payload is validated up front; oversized payloads are rejected with 400.
graph_payload is per-source: each top-level key must match the id of a source in the same request - a document’s document_metadata id, an app_knowledge item’s id, or (when type=memory) a memory’s id. Attach graphs to multiple sources at once. A source must carry an explicit id to be targeted (that id is the map key). Works for both type=knowledge and type=memory - a single request is one or the other, so its graph_payload keys target only that type’s sources.6. Example: multiple sources in one request
graph_payload is a map, so one request can carry graphs for several sources at once - here two documents and one app_knowledge source, each keyed by its own id. Then query, and each source’s triples surface.
graph_context: true:
cURL
graph_context and traverses just like an extracted one - the origin: "byog" tag on the relation marks it as yours:
7. Memories
Memories accept agraph_payload too - send type=memory, give each memory an id, and key the graph by that id. The graph shape is identical; relations link to the memory’s chunks and surface in /query with type=memory and graph_context: true.
cURL
id to receive a graph (an id-less memory gets a server-generated id and can’t be targeted). The memories form field stays plural even though type is the singular memory.
8. Limitations
- Replace, not augment. A BYOG source has no LLM-extracted facts - only the graph you supply (plus normal chunk search). Augment mode is a future enhancement.
- Permissive linking → possible false positives. Every relation links to its best-matching chunk even if the match is weak; there is no reject floor yet. A linked relation is sourced (similar to a chunk), not necessarily supported (stated by the source).
- Bulk, one-shot. You supply the whole graph with the source. Per-triple add/update/delete is not yet available.
Related
- Context Graphs - the auto-extracted graph BYOG replaces; HydraDB builds it for you, BYOG lets you supply it
- Knowledge - documents, and forceful relations between sources
- Ingest Context - the
graph_payloadform field reference - Query - how chunks and graph context are retrieved together