This project is based on a Udemy course but has been enhanced with new features and a restructured architecture to create a LangChain documentation chatbot.
It implements a Retrieval-Augmented Generation (RAG) pipeline, using a Milvus vector database for efficient document retrieval.
It features:
- Document Ingestion: Embeds and stores documents in Milvus for retrieval
- Custom API Backend (FastAPI): Handles LLM context interaction and document retrieval
- Next.js + Assistant UI: A chat interface for user interaction, integrating real-time streaming responses from the LLM
Frontend
: Streamlit, Next.js (assistant-ui react library for AI chat)
Server Side
: LangChain, FastAPI
Vectorstore
: Milvus
To run this project, you will need to add the following environment variables to your .env file
URI
: URI for the Milvus vector store
COLLECTION
: collection to store and retrieve documents
OPENAI_API_KEY
Clone the project
git clone https://github.com/grilo13/rag-documentation-helper.git
Go to the project directory
cd documentation-helper
Download LangChain Documentation
cd backend
mkdir langchain-docs
wget -r -A.html -P langchain-docs https://api.python.langchain.com/en/latest
Install dependencies
poetry install
Insert the documents in the Milvus Vector Store
python ingestion.py
For simple chat retrieval example using Streamlit:
Start the flask (streamlit) server
streamlit run streamlit_app.py
For complex usage using Next.js + AssistantUI and FastAPI app:
Run API (on localhost:8000)
cd backend/app/
python main.py
Install Next.js dependencies
npm install
And run Next.js app (on localhost:3000)
cd frontend
npm run dev