unclefomotw / llamaindex-try

random attempts in learning llamaindex
2 stars 1 forks source link

llamaindex-try

random attempts in learning llamaindex

Prerequisites

Python dependencies

  1. (Optional) set up virtual environment. There are many ways. Here's an example
    $ python -m venv venv
    $ source venv/bin/activate
  2. Install dependencies
    $ pip install -r requirements.txt

Install Qdrant database

  1. Install Docker
  2. Follow https://qdrant.tech/documentation/quick-start/ to install Qdrant

Environment variables

  1. Set up your OpenAI API key
$ export OPENAI_API_KEY="sk-..."
  1. Prepare your own dataset to be retrieved, and then set the environment variable pointing to the directory
$ export RAG_DATA_DIR="<path to data>"

My code assumes a bunch of .md files, but you can customize by messing around with SimpleDirectoryReader in the code

Execution

This repo is not a package. This repo contains separated codes, each of which representing a use case or a scenario.

To run it, simply run in the project directory and

$ PYTHONPATH=$(pwd) python src/<code.py>

Run Qdrant

Some codes require Qdrant. After you install Qdrant, you can use ./run-qdrant.sh to start it.

Run "rag_bot_1"

To run src/rag_bot_1, which runs a RAG Chat bot using streamlit, simple run ./run-rag_bot_1.sh


Try RAG