This is a RAG (Retrieval-Augmented Generation) example using Node.js with markdown files. To run the project locally, follow the steps below:
- Node.js v22 and Express.js.
Ollamawith the following models:nomic-embed-textfor text embedding during ingestionTinyLlamafor generating responses
qDrantfor vector storage and search
First, make sure you have the following requirements installed:
- Node.js v22 or higher
- NPM (Node.js package manager)
- Docker installed
- At least 4GB of RAM available
- Clone the repository:
git clone git@github.com:odanieldcs/rag-nodejs.git
cd rag-nodejs- Install the project dependencies:
npm install-
Configure Docker to have at least 4GB of RAM available. You can do this by editing the Docker Desktop settings or using the command:
-
Start the
OllamaandqDrantservices using Docker Compose:
docker-compose up -d- Install the Ollama models:
docker exec -it ollama ollama pull nomic-embed-text
docker exec -it ollama ollama pull TinyLlama- Start the application:
npm start-
Add some markdown files to the
sourcefolder. You can use the provided example files or create your own. -
Execute the ingestion script.
npm run ingest- Now you can test the application by sending a POST request to the
/chatendpoint with a JSON body containing your question:
curl -X POST http://localhost:3000/chat -H "Content-Type: application/json" -d '{"question": "What is RAG?"}'