Skip to content

SQLiteVecDocStore - EARS

Parent LLD: ./LLD.md

Construction and storage

  • [x] DOC-SQLITE-001: The system shall construct SQLiteVecDocStore with a required table_name, optional storage_path defaulting to ~/.llamabot/sqlite_vec, and optional embedding_model defaulting to minishlab/potion-base-8M.
  • [x] DOC-SQLITE-002: The system shall persist the store to a single {slugified table_name}.db file under storage_path.
  • [x] DOC-SQLITE-003: When sentence-transformers or sqlite-vec is missing, the system shall raise ImportError naming pip install llamabot[sqlite-vec].

Extension loading

  • [x] DOC-SQLITE-010: Where stdlib sqlite3 exposes enable_load_extension and 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 ImportError that names sqlean.py and llamabot[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, and reset.
  • [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, retrieve shall return an empty list.
  • [x] DOC-SQLITE-023: After reset, retrieve shall return no previously stored documents.
  • [x] DOC-SQLITE-024: After close and reopen on the same storage_path and table_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, retrieve shall return both documents.
  • [x] DOC-SQLITE-032: When a query contains quotes or punctuation, FTS5 retrieve shall still match the remaining alphanumeric tokens.