Skip to content

[Database] Implement FAISS vector store wrapper + hybrid metadata retrieval #23

Open

Description

@saviornt

Description

Create a clean, persistent FAISS vector store abstraction that links vectors to SQLite metadata (incidents / model versions) for efficient RAG-style retrieval in the Assistant (and limited edge use).

Type

  • Task

Focus Area (pick one)

  • Shared Utils & Models

Priority

  • Medium

Acceptance Criteria

  • File: shared/src/database/faiss.py — low-level wrapper
  • File: shared/src/database/faiss_service.py — higher-level service
  • Supports:
    • add_vectors(vectors: np.ndarray, metadata: list[dict]) → list[int]
    • search(query_vector: np.ndarray, k: int = 5) → list[dict] (with score + metadata)
  • Default index: IndexFlatL2 (MVP); future path for IndexIVFFlat
  • Persistent save/load via faiss.write_index / faiss.read_index
  • Index path from Pydantic Settings
  • Metadata rows inserted into faiss_vectors_metadata table (vector_id FK)
  • Async-friendly (run FAISS sync calls in thread if needed)
  • Health check: index size, dimension consistency
  • Unit tests: mock vectors, search recall, persistence round-trip
  • Google-style docstrings + full type hints

Blocker / Dependencies

  • [Database] Define Pydantic v2 models and initial relational schema
  • [Database] Implement robust async SQLite session factory + connection pooling

Notes / Links

  • Related files: shared/src/database/schemas.py, shared/src/core/settings.py
  • Reference: FAISS wiki + Python bindings documentation

Activity

  1. self-assigned this
    on Mar 19, 2026
  2. added
    task
    needs-triage
    on Mar 19, 2026
  3. moved this from To Do to In Progress in Network-Chan Project Developmenton Mar 19, 2026
  4. moved this from In Progress to Manual QA Testing in Network-Chan Project Developmenton Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

databaseneeds-triagetask

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions