c252fe5ef75624069be122db74af57834d3a5fc1
Agentic RAG Agent
Agentic RAG Agent is a chat application that combines models with retrieval-augmented generation. It allows users to ask questions based on custom knowledge bases, documents, and web data, retrieve context-aware answers, and maintain chat history across sessions.
Note: Fork and clone this repository if needed
1. Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate
2. Install dependencies
pip install -r cookbook/examples/apps/agentic_rag/requirements.txt
3. Configure API Keys
Required:
export OPENAI_API_KEY=your_openai_key_here
Optional (for additional models):
export ANTHROPIC_API_KEY=your_anthropic_key_here
export GOOGLE_API_KEY=your_google_key_here
export GROQ_API_KEY=your_groq_key_here
4. Run PgVector
Install docker desktop first.
- Run using a helper script
./cookbook/scripts/run_pgvector.sh
- OR run using the docker run command
docker run -d \
-e POSTGRES_DB=ai \
-e POSTGRES_USER=ai \
-e POSTGRES_PASSWORD=ai \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v pgvolume:/var/lib/postgresql/data \
-p 5532:5432 \
--name pgvector \
agnohq/pgvector:16
5. Run Agentic RAG App
streamlit run cookbook/examples/apps/agentic_rag/app.py
🔧 Customization
Model Selection
The application supports multiple model providers:
- OpenAI (o3-minrequirements.ini, gpt-4o)
- Anthropic (claude-3-5-sonnet)
- Google (gemini-2.0-flash-exp)
- Groq (llama-3.3-70b-versatile)
How to Use
- Open localhost:8501 in your browser.
- Upload documents or provide URLs (websites, csv, txt, and PDFs) to build a knowledge base.
- Enter questions in the chat interface and get context-aware answers.
- The app can also answer question using duckduckgo search without any external documents added.
Troubleshooting
- Docker Connection Refused: Ensure
pgvectorcontainers are running (docker ps). - OpenAI API Errors: Verify that the
OPENAI_API_KEYis set and valid.
📚 Documentation
For more detailed information:
🤝 Support
Need help? Join our Discord community
Description
Languages
Python
99.2%
Shell
0.8%