A Retrieval-Augmented Generation (RAG) system that allows users to upload documents to a knowledge base, configure LLM settings, and query the knowledge base through a chatbot interface.
- Document Management: Upload and manage PDF, Word, Excel, and image files in your knowledge base
- LLM Configuration: Configure LLM details like model, API key, and parameters through the UI
- RAG Chatbot: Query your knowledge base using state-of-the-art language models
This system uses a modern architecture with the following components:
- Backend: FastAPI server with LangChain integration
- Frontend: HTML5, JavaScript, and CSS
- Vector Database: ChromaDB for efficient similarity search
- LLM Integration: Support for Llama3 and Gemini models
- Python 3.10+
- Tesseract OCR (for image processing)
-
Clone the repository:
git clone https://github.com/AkhileshMishra/SampleLLM.git cd SampleLLM -
Run the deployment script:
chmod +x scripts/deploy.sh ./scripts/deploy.shThis will:
- Create a virtual environment
- Install all required dependencies
- Set up necessary directories
- Start the backend server
-
In a separate terminal, start the frontend server:
chmod +x scripts/serve_frontend.sh ./scripts/serve_frontend.sh -
Access the application at http://localhost:8080
- Navigate to the "LLM Configuration" tab
- Select your preferred model (Llama3 or Gemini)
- Enter your API key and API URL
- Adjust parameters like temperature and max tokens
- Save your configuration
- Navigate to the "Knowledge Base" tab
- Use the file upload form to add documents to your knowledge base
- View and manage your uploaded documents in the table below
- Navigate to the "Chat" tab
- Type your question in the input field
- The system will retrieve relevant information from your documents and generate a response
POST /api/documents/upload- Upload document to knowledge baseGET /api/documents- List all documents in knowledge baseDELETE /api/documents/{document_id}- Remove document from knowledge baseGET /api/documents/stats- Get vector store statistics
POST /api/config/llm- Set LLM configurationGET /api/config/llm- Get current LLM configuration
POST /api/chat- Send query and get responseGET /api/chat/history- Get chat history
Run the test script to verify all components are working correctly:
chmod +x scripts/test.sh
./scripts/test.sh
SampleLLM/
├── backend/
│ ├── api/
│ │ ├── chat_routes.py
│ │ ├── config_routes.py
│ │ └── document_routes.py
│ ├── database/
│ │ └── vector_store_manager.py
│ ├── models/
│ │ ├── llm_service.py
│ │ └── rag_chatbot.py
│ ├── utils/
│ │ └── document_processor.py
│ └── app.py
├── frontend/
│ ├── css/
│ │ └── styles.css
│ ├── js/
│ │ └── main.js
│ └── index.html
├── scripts/
│ ├── deploy.sh
│ ├── serve_frontend.sh
│ └── test.sh
├── data/
│ ├── config/
│ ├── documents/
│ └── vector_store/
└── README.md
This project is open source and available under the MIT License.