|
| 1 | +# 🧠 Agentic RAG with GPT-5 |
| 2 | + |
| 3 | +An agentic RAG application built with the PraisonAI Agents framework, featuring GPT-5 and built-in vector search for efficient knowledge retrieval and question answering. |
| 4 | + |
| 5 | +## ✨ Features |
| 6 | + |
| 7 | +- **🤖 GPT-5**: Latest OpenAI model for intelligent responses |
| 8 | +- **🗄️ Built-in Vector Search**: ChromaDB integration for fast similarity search |
| 9 | +- **🔍 Agentic RAG**: Intelligent retrieval augmented generation |
| 10 | +- **📝 Markdown Formatting**: Beautiful, structured responses |
| 11 | +- **🌐 Dynamic Knowledge**: Add URLs to expand knowledge base |
| 12 | +- **⚡ Real-time Responses**: Fast answer generation- **🎯 Clean Interface**: Simplified UI without configuration complexity |
| 13 | + |
| 14 | +## 🚀 Quick Start |
| 15 | + |
| 16 | +### Prerequisites |
| 17 | + |
| 18 | +- Python 3.11+ |
| 19 | +- OpenAI API key with GPT-5 access |
| 20 | + |
| 21 | +### Installation |
| 22 | + |
| 23 | +1. **Clone and navigate to the project** |
| 24 | + ```bash |
| 25 | + cd rag_examples/agentic_rag_gpt5 |
| 26 | + ``` |
| 27 | + |
| 28 | +2. **Install dependencies** |
| 29 | + ```bash |
| 30 | + pip install -r requirements.txt |
| 31 | + ``` |
| 32 | + |
| 33 | +3. **Set up your OpenAI API key** |
| 34 | + ```bash |
| 35 | + export OPENAI_API_KEY="your-api-key-here" |
| 36 | + ``` |
| 37 | + Or create a `.env` file: |
| 38 | + ``` |
| 39 | + OPENAI_API_KEY=your-api-key-here |
| 40 | + ``` |
| 41 | + |
| 42 | +4. **Run the application** |
| 43 | + ```bash |
| 44 | + streamlit run agentic_rag_gpt5.py |
| 45 | + ``` |
| 46 | + |
| 47 | +## 🎯 How to Use |
| 48 | + |
| 49 | +1. **Enter your OpenAI API key** in the sidebar |
| 50 | +2. **Add knowledge sources** by entering URLs in the sidebar |
| 51 | +3. **Ask questions** using the text area or suggested prompts |
| 52 | +4. **Get answers** with markdown formatting |
| 53 | + |
| 54 | +### Suggested Questions |
| 55 | + |
| 56 | +- **"What is PraisonAI?"** - Learn about the PraisonAI Agents framework |
| 57 | +- **"Teams in PraisonAI"** - Understand how teams work in PraisonAI |
| 58 | +- **"Build RAG system"** - Get a step-by-step guide to building RAG systems |
| 59 | + |
| 60 | +## 🏗️ Architecture |
| 61 | + |
| 62 | +### Core Components |
| 63 | + |
| 64 | +- **`Agent`**: PraisonAI Agents framework for intelligent Q&A |
| 65 | +- **`knowledge`**: Built-in knowledge base that handles URLs and documents |
| 66 | +- **`llm`**: OpenAI GPT-5-nano for generating responses |
| 67 | +- **Built-in Vector Search**: Automatic similarity search without external setup |
| 68 | + |
| 69 | +### Data Flow |
| 70 | + |
| 71 | +1. **Knowledge Loading**: URLs are processed and stored in the built-in vector database |
| 72 | +2. **Vector Search**: OpenAI embeddings enable semantic search |
| 73 | +3. **Response Generation**: GPT-5-nano processes information and generates answers |
| 74 | +4. **Formatted Output**: Markdown-formatted responses |
| 75 | + |
| 76 | +## 🔧 Configuration |
| 77 | + |
| 78 | +### Database Settings |
| 79 | +- **Vector DB**: Built-in vector database with automatic indexing |
| 80 | +- **Storage**: Local storage managed by PraisonAI Agents |
| 81 | +- **Search**: Automatic similarity search |
| 82 | + |
| 83 | +### Model Configuration |
| 84 | +- **LLM**: OpenAI GPT-5-nano |
| 85 | +- **Embeddings**: Automatic handling by PraisonAI Agents |
| 86 | +- **Vector Store**: Built-in with automatic document processing |
| 87 | + |
| 88 | +## 📚 Knowledge Management |
| 89 | + |
| 90 | +### Adding Sources |
| 91 | +- Use the sidebar to add new URLs |
| 92 | +- Sources are automatically processed and indexed |
| 93 | +- Current sources are displayed as numbered list |
| 94 | + |
| 95 | +### Default Knowledge |
| 96 | +- Starts with PraisonAI documentation: `https://docs.praisonai.com/introduction/agents.md` |
| 97 | +- Expandable with any web-based documentation |
| 98 | + |
| 99 | +## 🎨 UI Features |
| 100 | + |
| 101 | +### Sidebar |
| 102 | +- **API Key Management**: Secure input for OpenAI credentials |
| 103 | +- **URL Addition**: Dynamic knowledge base expansion |
| 104 | +- **Current Sources**: Numbered list of loaded URLs |
| 105 | + |
| 106 | +### Main Interface |
| 107 | +- **Suggested Prompts**: Quick access to common questions |
| 108 | +- **Query Input**: Large text area for custom questions |
| 109 | +- **Fast Responses**: Quick answer generation |
| 110 | +- **Markdown Rendering**: Beautiful formatted responses |
| 111 | + |
| 112 | +## 🛠️ Technical Details |
| 113 | + |
| 114 | +### Dependencies |
| 115 | +``` |
| 116 | +streamlit>=1.28.0 |
| 117 | +praisonaiagents>=0.1.0 |
| 118 | +openai>=1.0.0 |
| 119 | +python-dotenv>=1.0.0 |
| 120 | +``` |
| 121 | + |
| 122 | +### Key Features |
| 123 | +- **Built-in Knowledge Base**: Automatic document processing and indexing |
| 124 | +- **Vector Search**: Efficient similarity search with built-in database |
| 125 | +- **Caching**: Efficient resource loading with Streamlit caching |
| 126 | +- **Error Handling**: Graceful handling of API and processing errors |
| 127 | + |
| 128 | +## 🔍 Troubleshooting |
| 129 | + |
| 130 | +### Common Issues |
| 131 | + |
| 132 | +**Knowledge base not loading** |
| 133 | +- Check OpenAI API key is valid |
| 134 | +- Ensure URLs are accessible |
| 135 | +- Verify internet connection |
| 136 | + |
| 137 | +**Agent initialization errors** |
| 138 | +- Check if PraisonAI Agents is properly installed |
| 139 | +- Verify OpenAI API key has sufficient credits |
| 140 | +- Ensure Python version is 3.11+ |
| 141 | + |
| 142 | +### Performance Tips |
| 143 | +- **Cache Resources**: Knowledge base and agent are cached for efficiency |
| 144 | +- **Built-in Vector Search**: Fast similarity search without external setup |
| 145 | +- **Local Storage**: Optimized local storage for optimal performance |
| 146 | + |
| 147 | +## 🎯 Use Cases |
| 148 | + |
| 149 | +- **Documentation Q&A**: Ask questions about technical documentation |
| 150 | +- **Research Assistant**: Get answers from multiple knowledge sources |
| 151 | +- **Learning Tool**: Interactive exploration of complex topics |
| 152 | +- **Content Discovery**: Find relevant information across multiple sources |
| 153 | + |
| 154 | +**Built with ❤️ using PraisonAI Agents and GPT-5** |
0 commit comments