A RAG-powered chatbot that answers questions about Twenty One Pilots. Built with Pydantic AI, ChromaDB, and Streamlit, the app features "Ned" — an enthusiastic superfan persona that retrieves information from a knowledge base and responds in the voice of a true member of the Clique.
- Knowledge base loading — On startup, the app reads
top_kb.txt, splits it into overlapping text chunks, and embeds them using theall-MiniLM-L6-v2sentence transformer model. - Vector storage — Chunk embeddings are stored in an in-memory ChromaDB collection for similarity search.
- Query handling — When a user asks a question, the Pydantic AI agent embeds the query, retrieves the most relevant chunks from ChromaDB, and passes them as context to Claude (claude-sonnet-4-5) to generate an answer.
- Structured output — Responses are returned as structured
RAGResponseobjects containing the answer, source snippet, and source chunk ID.
├── top_kb.txt # Knowledge base text about Twenty One Pilots
├── requirements.txt # Python dependencies
└── src/
├── main.py # Streamlit UI and app entry point
├── agent.py # Pydantic AI agent with Ned's personality and RAG tool
├── chunker.py # Text chunking with configurable size and overlap
├── embeddings.py # Sentence transformer embedding functions
├── vectorstore.py # ChromaDB collection management and similarity queries
├── models.py # Pydantic models (RAGResponse)
└── images/ # Avatar and page icon assets
├── ned.png
├── fren.jpg
└── pagelogo.jpeg
- Python 3.12+
- An Anthropic API key set as the
ANTHROPIC_API_KEYenvironment variable
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtexport ANTHROPIC_API_KEY="your-key-here"
streamlit run src/main.py- pydantic / pydantic-ai — Agent framework with structured output and tool use
- sentence-transformers (via pydantic-ai-slim) — Local text embeddings
- chromadb — In-memory vector store for similarity search
- streamlit — Chat UI