This is a minimal Retrieval-Augmented Generation (RAG) backend that supports document ingestion and hybrid (semantic + keyword) search using Node.js and a local embedding model.
- Local embeddings with
sentence-transformers(MiniLM) - Hybrid search using:
- BM25-style keyword frequency
- Cosine similarity with embedding vectors
- Simple JSON-based document storage
- Clean, minimal Express API
Ingest a document (a text) into the knowledge base.
Request:
{
"text": "Node.js is a JavaScript runtime built on Chrome's V8 engine."
}Search in document (text)
{
"query": "What is Node.js?"
}
- Go to
embedding serverdirecotry
- Install dependencies
pip install Flask sentence-transformers
- Run the project
python embeddingServer.py
- In other terminal, inside main direcotry
- Install dependencies
npm install
- Run project
node app.js