Skip to content

Add lazy initialization and FAISS caching for vector store#69

Open
Sasyamerugu wants to merge 1 commit intosugarlabs:mainfrom
Sasyamerugu:lazy-vectorstore-loading
Open

Add lazy initialization and FAISS caching for vector store#69
Sasyamerugu wants to merge 1 commit intosugarlabs:mainfrom
Sasyamerugu:lazy-vectorstore-loading

Conversation

@Sasyamerugu
Copy link

This change improves the initialization of the RAG vector store by introducing
lazy loading and FAISS index caching.

Previously, the vector store was built during server startup, which caused
slower startup times and recomputation of embeddings on every restart.

Changes:

  • Initialize the retriever lazily when the /ask endpoint is first used
  • Persist the FAISS index locally
  • Load the existing index if available instead of rebuilding embeddings

Benefits:

  • Faster server startup
  • Avoids recomputing embeddings unnecessarily
  • Improves performance when working with larger document sets

Vector store initialization previously occurred during server startup,
which caused slower startup times and unnecessary recomputation of
embeddings on every restart.

This change initializes the retriever lazily when the /ask endpoint
is first called, and persists the FAISS index locally. If the index
already exists, it is loaded instead of rebuilding embeddings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant