Skip to main content

Crate gonzalo_knowledge

Crate gonzalo_knowledge 

Source
Expand description

Knowledge-store capability for gonzalo.

A single “what do we know about X” surface that composes the existing capability layers (ADR 0011): a [Store] for records, a [VectorIndex] for semantic retrieval, and an [Embedder] for turning text into vectors — all addressed by the shared RecordKey. Queries return first-class [Record]s as Hits, not bare ids.

Which record kinds are knowledge-bearing, and how their text is split into embeddable pieces, lives in chunk (with knowledge_text as the joined one-document view). Records are embedded at chunk granularity — a Session by turn, a long MemoryTier/Ticket by paragraph, a Topic by bullet — so a query matching one turn/section isn’t drowned out by a document average; KnowledgeStore::query de-dups chunk matches back to one hit per record. A graph-backed join ([KnowledgeStore::query_in_subgraph]) is a further refinement behind this same surface.

Structs§

ChunkHit
One chunk-granular search hit: the parent [Record], the matching chunk’s score, its ordinal within the record, and that chunk’s text. Unlike a Hit, chunk hits are not de-duped to one-per-record.
Hit
One search hit: a first-class record and its similarity score (higher is more similar).
KnowledgeStore
Composes a [Store], a [VectorIndex], and an [Embedder] into one retrieval surface keyed by RecordKey.

Functions§

chunk
Split a record into ordered chunk texts. Returns Ok(None) if the kind is definitionally not knowledge-bearing (Checkpoint/GraphManifest, ADR 0011), and Err if a knowledge-bearing body fails to parse — so a corrupt record is distinguishable from a genuinely non-indexable one (#139). Chunking is per-kind: a Session by turn, a long MemoryTier/Ticket by section/paragraph, a Topic by bullet. The kind’s title/name is folded into the first chunk so it stays searchable. A kind that yields a single piece is the one-document fallback — identical to phase-1 behavior. Extraction goes through the gonzalo-domain typed views.
knowledge_text
The embeddable text for a record, or None if its kind is not knowledge-bearing (ADR 0011). Kept as the one-document view: the chunks joined back into a single string.