Domino675/Knowledge_AI_Base
0
AI Knowledge Base Assistant
This is a Gradio app that serves as an AI knowledge base assistant, focusing on PyTorch and LLMs. It uses Retrieval Augmented Generation (RAG) to provide accurate answers by referencing a knowledge base of documents.
Overview
This application:
- Loads documents from the knowledge base
- Splits them into smaller chunks
- Creates vector embeddings for each chunk
- Stores these in a Chroma vector database
- Retrieves relevant documents when questions are asked
- Uses an LLM to generate answers based on the retrieved documents
Technologies Used
- LangChain for document processing and RAG implementation
- Chroma for vector database storage
- HuggingFace Embeddings for creating embeddings
- OpenAI GPT-4o-mini for generating responses
- Gradio for the user interface
Setup
- Clone this repository
- Install the required packages with
pip install -r requirements.txt - Create a
.envfile with your OpenAI API key: OPENAIAPIKEY=your-api-key-here - Run the app with
python app.py
Usage
- Ask questions about PyTorch, LLMs, or general AI concepts in the textbox
- View the assistant's responses in the chat interface
- Click "Reset Conversation" to start a new conversation
- Click "Show Vector Embeddings" to visualize the knowledge base in 2D space
Knowledge Base Structure
The knowledge base is organized into folders:
pytorch/: Information about PyTorch frameworkllm/: Information about Large Language Models
Adding to the Knowledge Base
To add more documents:
- Create Markdown (.md) files with relevant information
- Place them in the appropriate folder under
knowledge-base/ - Restart the application to reindex the knowledge base
