
RAG

estib
This is a simple implementation of a CLI tool that consumes a specified Wikipedia article and answers questions about it using Retrieval Augmented Generation.
It pre-digests the chunks into one-sentence facts to be able to fit more of them into the context window plus adding some more diverse information into the vector database.
Github
https://github.com/estib-vega/gpt
This repository contains the code for the GPT project.
Description
This is an implementation of RAG using Ollama + Langchain and some custom heuristics implemented in Typescript. It's a CLI app that is built into a platform-specific binaries that can be run alongside Ollama independently.
Features
- Wiki Article RAG: Point the application to a Wikipedia article and this will download it, digest it and store it in a Vector DB.
Prerequisites
- Bun
This project uses Bun v1.1.7 as the TS runtime - Ollama
It connects to Ollama to access the LLMs. Ollama needs to be running in the background (http://127.0.0.1:11434) and have the following models installed:- llama3 (8B)
- nomic-embed-text
Installation
To use the GPT, follow these steps:
1. Install the required dependencies:
bun install
2. Build the binary:
macOS
bun build:mac
Linux
bun build:lin
Windows
bun build:win
3. Run it
macOS
./dist/mac/gpt
Linux
./dist/lin/gpt
macOS
./dist/win/gpt.exe
Commands
RAG
gpt rag -w <the Wikipedia article link> -q <the prompt to be answered about the article> -o <the output location of the vector database>
This will download and parse the article, which depending on the length might take up to 40 minutes. This will then be stored under the provided output location. If there is a matching vector database under the provided output location for the given Wikipedia article, that will be used directly.
In order to be able to view into the parsing and digestion process of the article, you can add the --verbose
flag.
You can get some more information about the command by executing:
gpt rag --help
Contributing
Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for more details.