Skip to content

Repository files navigation

Python RAG App Code Example

This project has the purpose of showing how to use the RAG model to generate answers for questions based on a given OpenTelemetryTraces.

The chatbot was inspired by Streamlit Chatbot example.

Setting up the project

First of all, you need to have an OpenAI API Key to use the project, you can get one here.

Then, just create a .env file in the root of the project with the following content:

# add openai api keyecho"OPENAI_API_KEY={your-open-ai-api-key}">> .env

Also, I'm considering that you have Python 3.12 and uv installed in your machine. Otherwise, you can download it here:

Creating a virtual env and downloading the dependencies

You will create a virtual env to have a clean environment to run the project, by executing the following commands:

# create venv and install dependencies
uv sync
# activate venvsource .venv/bin/activate

Running the use cases

To create the VectorStore and run the chatbot you can use the following commands:

# create vector store
python ./app/create_vector_store.py --trace-file=$PWD/data/trace.json --preprocessed-trace-file=$PWD/data/trace-description.txt
# run chatbot
streamlit run ./app/streamlit_app.py

About

This project has the purpose of showing how to use the RAG model to generate answers for questions based on a given OpenTelemetry Trace.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Used by

Contributors

Languages