Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Support Agent with RAG Tooling for Documentation Support

Simple Support agent primarily using RAG with Vector DB consisting of a companies documention with a fallback to OpenAI GPT-3.5-Turbo for general question handling.

To enable Retrieval-Augmented Generation (RAG) we do the following:

  • Convert Q&A documents into embeddings using OpenAI’s text-embedding-ada-002 model.
  • Store them in a Chroma vector store.
  • At runtime, retrieve the most semantically similar Q&A using vector similarity search.
  • If a strong match is found, use it directly. Otherwise, fall back to querying the OpenAI API.

This approach enables flexible, robust answers even for paraphrased questions.

Support Agent


Project Overview

This project allows you to:

  • Load Q&A JSON documents from the docs/ folder
  • Embed and index them using Chroma and OpenAI
  • Run a Streamlit app that answers questions using vector search and LLM fallback

1. Prepare JSON Q&A Files

Create a docs/ directory and add .json files structured like this:

[
  {
    "question": "What is AI?",
    "answer": "Artificial Intelligence is the simulation of human intelligence."
  },
  {
    "question": "What is Python?",
    "answer": "A programming language."
  }
]

2. Index the Documents

Run the document loader to embed and store the data:

poetry run python -m support_agent.scripts.docs_loader

This will:

  • Read all .json files from docs/
  • Create Q:/A: pairs
  • Embed them using OpenAI
  • Save them to a persistent Chroma vector store in vectorstore/

3. Run the Application

Launch the Streamlit interface with:

poetry run streamlit run src/support_agent/agent.py

Then open the app in your browser to begin asking questions.

4. Test Coverage

The application has ben tested with 100% code coverage

Unit Test Coverage

You can run all tests and view coverage:

poetry run pytest --cov=support_agent --cov-report=term-missing

Project Structure

support_agent/
├── agent.py                  # Main agent routing logic
├── fallback.py               # Fallback logic using OpenAI API
├── tools/
│   └── retriever.py          # Chroma-based vector search
├── scripts/
│   └── docs_loader.py        # JSON to vectorstore loader
├── assets/
tests/
├── test_agent.py
├── test_fallback.py
└── test_retriever.py
docs/                         # Your source Q&A JSON documents
vectorstore/                  # Persisted vector index

Environment Setup

Make sure to set your OpenAI key:

export OPENAI_API_KEY=your-key-here

Or add it to a .env file in the project root:

OPENAI_API_KEY=your-key-here

License

MIT

About

Simple Support agent primarily using RAG with Vector DB consisting of a companies documention with a fallback to OpenAI GPT-3.5-Turbo for general question handling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages