This repo serves to help you get started with the EmbedJS library (@llm-tools/embedjs
) for implementing RAG in your own Node.js applications.
- "Applied AI Software Engineering: RAG" on The Pragmatic Engineer: a solid primer if you're looking a high-level explantion of RAG for app developers
- "RAG in Node.js with EmbedJS": an article I wrote that discusses this repo in a bit more depth
- llm-tools/embedJs on GitHub: the library this RAG example uses
- Node.js 20+
- npm 10+
- An OpenAI API key
Install the repo and its dependencies like this:
git clone REPO_URL
cd embedjs-rag
npm install
Create a new file called .env
:
touch .env
In your new .env
file, add a variable for your OpenAI API key and add your key:
OPENAI_API_KEY=your_key_here
You can run the script with or without prompt as a command line argument:
npm start # No prompt (the script has a default)
npm start "What does Ash write about?"
The output will print in your terminal.