Source, Extractor, GraphStore and Resolver. An Embedder and a Decider serve indexing and search. Each interface is a Protocol, so a test can pass a fake. The pages for each package list every class and function. This page shows the contracts.
Pipeline interfaces
Extractor, changed is the fingerprints of the passages to work on, and every other passage is left alone. context_only means the text did not change, so the extractor re-chooses contexts without re-extracting.
The embedder contract
- One vector per text, in order.
- Every vector has
dimensionsvalues and unit length, so cosine is a dot product. A text with no content may embed to the zero vector. kindis"document"for stored text (concepts and contexts) and"query"for a search question. Models with separate query and document prompts use it, and the others ignore it.embedding.check_vectorsverifies a batch against this contract.
The update stage
Update runs daily, and also at each document’s next validity boundary. It does three things:-
It compares
Source.manifest()withGraphStore.versions(), part by part. -
For each new or changed unit, it reads the document and decides what to run on and what to replace:
- New unit: every passage, and the whole unit is replaced.
- File or passages changed: the new or changed passages, replacing those plus any passages that disappeared.
- Metadata only: the passages whose pinned choice was made under other metadata, for context only, replacing those.
replacesdoes not match is an extractor bug and stops the update. -
For each unit that is no longer valid, it calls
drop_unit. Every created, merged, moved, deprecated or deleted concept gets an entry inlog.md.
The resolver
The resolver confirms evidence in three steps:- Hash the faithfully normalized passage at
start. - If that fails, slide across the passage looking for the fingerprint, and record the new
start. - If the fingerprint is found nowhere, mark the evidence stale.
The query
access_filter, and ladyGraph applies it without judging it. Concepts are filtered too, not only passages, because concept text is written from the sources.
Callers use the Python library directly.
What implements each interface
core
The records and the interfaces.
retrieval
Searcher and SearchConfig.