A modern document knowledge base with conversational AI capabilities, built using a Retrieval-Augmented Generation (RAG) architecture.
- 📄 Document ingestion (PDF)
- 🔍 Semantic search across all documents
- 💬 Conversational interface for natural queries
- 🧠 Context-aware responses with citations
- 🚀 FastAPI backend for high performance
- Backend: FastAPI, Python 3.11+
- RAG Framework: LangChain
- Vector Database: FAISS
- LLM Integration: OpenAI API (configurable for other providers)
- Frontend: Streamlit
- Deployment: Docker, optionally with docker-compose
-
Clone the repository
git clone https://github.com/gtraskas/knowledge-rag.git cd knowledge-rag -
Set up environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Set up environment variables
Create a
.envfile in the root directory and add the following variables:OPENAI_API_KEY=your_openai_api_key
-
Run the application
bash run.sh
The application supports the following file types for document ingestion:
- Navigate to the upload section of the application.
- Drag and drop your files or use the file picker to upload documents.
- The application will process and index the documents for semantic search.
- Use the conversational interface to ask natural language questions.
- Example queries:
- "What is the main topic of the document titled 'Project Plan'?"
- "Summarize the key points from the uploaded PDF."
- "Find all references to 'machine learning' in the documents."
- The application will provide context-aware responses with citations to the source documents.
knowledge-rag/
├── Dockerfile
├── frontend.py
├── index.html
├── LICENSE
├── main.py
├── README.md
├── requirements.txt
├── run.sh
├── TODO.md
├── static/
│ └── favicon.ico
└── uploaded_files/
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
To run the application using Docker:
-
Build and start the containers:
docker-compose up --build
-
Access the application:
- Backend: http://localhost:8000
- Frontend: http://localhost:8501
-
Stop the containers:
docker-compose down