SQLiteVecDocStore - EARS
Parent LLD: ./LLD.md
Construction and storage
- [x] DOC-SQLITE-001: The system shall construct
SQLiteVecDocStorewith a requiredtable_name, optionalstorage_pathdefaulting to~/.llamabot/sqlite_vec, and optionalembedding_modeldefaulting tominishlab/potion-base-8M. - [x] DOC-SQLITE-002: The system shall persist the store to a single
{slugified table_name}.dbfile understorage_path. - [x] DOC-SQLITE-003: When sentence-transformers or sqlite-vec is missing, the system shall raise
ImportErrornamingpip install llamabot[sqlite-vec].
Extension loading
- [x] DOC-SQLITE-010: Where stdlib sqlite3 exposes
enable_load_extensionand loading sqlite-vec succeeds, the system shall use that connection. - [x] DOC-SQLITE-011: If stdlib sqlite3 cannot load extensions, the system shall use
sqlean.py(import sqlean). - [x] DOC-SQLITE-012: If neither sqlite3 nor sqlean.py can load sqlite-vec, the system shall raise
ImportErrorthat names sqlean.py andllamabot[sqlite-vec]and does not tell the user to install system SQLite or Homebrew packages.
Document store API
- [x] DOC-SQLITE-020: The system shall implement
append,extend,retrieve, andreset. - [x] DOC-SQLITE-021: When a document is already stored, the system shall skip appending it again.
- [x] DOC-SQLITE-022: When the store is empty,
retrieveshall return an empty list. - [x] DOC-SQLITE-023: After
reset,retrieveshall return no previously stored documents. - [x] DOC-SQLITE-024: After close and reopen on the same
storage_pathandtable_name, the system shall retrieve previously stored documents.
Hybrid retrieval
- [x] DOC-SQLITE-030: The system shall rank documents with SQLite FTS5 BM25 and sqlite-vec
vec0, then fuse the rankings with reciprocal rank fusion. - [x] DOC-SQLITE-031: When a query matches a rare keyword in one document and a semantic paraphrase in another,
retrieveshall return both documents. - [x] DOC-SQLITE-032: When a query contains quotes or punctuation, FTS5 retrieve shall still match the remaining alphanumeric tokens.