Skip to content

odanieldcs/rag-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAG with Node.js

This is a RAG (Retrieval-Augmented Generation) example using Node.js with markdown files. To run the project locally, follow the steps below:

Stack in this project

  • Node.js v22 and Express.js.
  • Ollama with the following models:
    • nomic-embed-text for text embedding during ingestion
    • TinyLlama for generating responses
  • qDrant for vector storage and search

Requirements

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

Installation

  1. Clone the repository:
git clone git@github.com:odanieldcs/rag-nodejs.git
cd rag-nodejs
  1. Install the project dependencies:
npm install
  1. Configure Docker to have at least 4GB of RAM available. You can do this by editing the Docker Desktop settings or using the command:

  2. Start the Ollama and qDrant services using Docker Compose:

docker-compose up -d
  1. Install the Ollama models:
docker exec -it ollama ollama pull nomic-embed-text
docker exec -it ollama ollama pull TinyLlama
  1. Start the application:
npm start
  1. Add some markdown files to the source folder. You can use the provided example files or create your own.

  2. Execute the ingestion script.

npm run ingest
  1. Now you can test the application by sending a POST request to the /chat endpoint with a JSON body containing your question:
curl -X POST http://localhost:3000/chat -H "Content-Type: application/json" -d '{"question": "What is RAG?"}'

About

A basic project for RAG with Node.js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors