Repository navigation
feat(retrieval): vector-mode retrieve with brute-force cosine knn (T09) - #7
Merged
Merged
Conversation
prateekchaplot
force-pushed
the
arch/caliper/t09
branch
from
November 16, 2026 17:45
aaab92e to
379642b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task T09 from
docs/ARCHITECTURE.md§14 (retrieval core).Stacked on #8 (T05) — merge #8 first; this PR then shrinks to its own 2 commits (the extra commits are T05's, shown only because they're not yet on
main).What's inside
retrieve(question, conn, cfg, *, embeddings=None) -> list[Passage]— vector mode, brute-force vec0MATCH ... AND k = ?cosine KNN (no ANN), metadata viaget_chunks, deterministic (ties broken by ascendingchunk_id)Passagefrozen dataclass: the 6 §7.5 fields + defaultedstage="vector"(§9.3 requirement)RetrievalErrorfor hard failures only; fewer-rows / empty / missing index return fewer /[]— the caller refuses (§9.3, §11.5)Verification: combined stack —
uv run pytest— 166 passed (122 + 32 T05 + 12 T09);ruff check+ruff format --check+mypystrict clean.Notes: ambiguity resolutions recorded in
docs/TASKS.mdNotes (KNN query lives in-module sincedb.pyis T03-owned; no sentinel scores;vector_top_kis T10's hybrid candidate depth). Dependents: T10, T11, T18.