A minimal example of RAG, based on DSPy.
To set up the environment:
git clone https://github.com/DerwenAI/min_rag.git
cd min_rag
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -U pip wheel
python3 -m pip install -r requirements.txtIf you want to use ChatGPT instead of a locally hosted LLM:
- set the
OPENAI_API_KEYenvironment variable to your OpenAI API key - set the
run_local = Falseflag in "demo.py"
Otherwise this uses ollama to download and
orchestrate a local LLM.
The oss-gpt:20b model
is set by default, and to have it running locally:
ollama pull oss-gpt:20bOr change the "rag.lm_name" configuration setting to a different model which you have downloaded and run locally.
To load the vector database from markdown files, then run a question/answer chat bot based on RAG:
python3 demo.pyThen ask questions.
Change the markdown files in data/talks to add new content, or point
to a different directory.
"For those we hold close, and for those we never meet."