| # π Quick Start Guide - Agentic AI Backend | |
| ## Prerequisites | |
| ## Step 1: Verify Installation β | |
| Dependencies are already installed. Verify with: | |
| ```powershell | |
| python -c "import chromadb, sentence_transformers; print('β Vector Store packages installed')" | |
| ``` | |
| ## Step 2: Configure Environment π§ | |
| ### Option 1: GitHub Models (Recommended) β | |
| **Free, fast, and reliable!** | |
| 1. **Get a GitHub token:** https://github.com/settings/tokens | |
| 2. **Edit `.env`:** | |
| ```powershell | |
| Copy-Item .env.template .env | |
| notepad .env | |
| ``` | |
| 3. **Add your tokens:** | |
| ```bash | |
| GITHUB_TOKEN=ghp_your_github_token_here | |
| OPENWEATHERMAP_API_KEY=your_weather_api_key_here | |
| ``` | |
| **See detailed setup:** [GITHUB_MODELS_SETUP.md](GITHUB_MODELS_SETUP.md) | |
| ### Option 2: Local with Ollama | |
| If you prefer running locally: | |
| 1. **Install a capable Ollama model:** | |
| ```powershell | |
| ollama pull llama3.2 # Better than qwen3:0.6b | |
| ``` | |
| 2. **Configure `.env`:** | |
| ```bash | |
| OLLAMA_BASE_URL=http://localhost:11434 | |
| OLLAMA_MODEL=llama3.2 | |
| OPENWEATHERMAP_API_KEY=your_weather_api_key_here | |
| ``` | |
| **Note:** GitHub Models recommended for better reliability and tool calling. | |
| ## Step 3: Initialize Database πΎ | |
| ```powershell | |
| python seed_data.py | |
| ``` | |
| This creates: | |
| Expected output: | |
| ``` | |
| Database initialized | |
| Sample meetings created successfully | |
| ``` | |
| ## Step 4: Run Tests π§ͺ | |
| ```powershell | |
| python test_agents.py | |
| ``` | |
| This runs 6 comprehensive tests: | |
| 1. β Weather Agent - Current weather | |
| 2. β Meeting Agent - Weather-conditional scheduling | |
| 3. β SQL Agent - Database queries | |
| 4. β Document RAG - High confidence retrieval | |
| 5. β Web Fallback - Low confidence web search | |
| 6. β Specific Retrieval - Precise information extraction | |
| **First run will download the embedding model (~80MB) - this is normal!** | |
| ## Step 5: Start the API Server π | |
| ```powershell | |
| python main.py | |
| ``` | |
| Server starts at: **http://127.0.0.1:8000** | |
| API docs available at: **http://127.0.0.1:8000/docs** | |
| ## Step 6: Test API Endpoints π‘ | |
| ### Test 1: Weather Query | |
| ```powershell | |
| $body = @{ | |
| query = "What's the weather in Paris today?" | |
| } | ConvertTo-Json | |
| Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:8000/chat" ` | |
| -ContentType "application/json" -Body $body | |
| ``` | |
| ### Test 2: Upload Document | |
| ```powershell | |
| $filePath = "C:\path\to\your\document.pdf" | |
| curl -X POST "http://127.0.0.1:8000/upload" -F "file=@$filePath" | |
| ``` | |
| Response will include `file_path` - use it in the next request. | |
| ### Test 3: RAG Query | |
| ```powershell | |
| $body = @{ | |
| query = "What does the document say about remote work?" | |
| file_path = "D:\python_workspace\multi-agent\uploads\uuid.pdf" | |
| } | ConvertTo-Json | |
| Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:8000/chat" ` | |
| -ContentType "application/json" -Body $body | |
| ``` | |
| ### Test 4: Meeting Scheduling | |
| ```powershell | |
| $body = @{ | |
| query = "Schedule a team meeting tomorrow at 3 PM in London if weather is good. Include Alice and Bob." | |
| } | ConvertTo-Json | |
| Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:8000/chat" ` | |
| -ContentType "application/json" -Body $body | |
| ``` | |
| ### Test 5: SQL Query | |
| ```powershell | |
| $body = @{ | |
| query = "Show me all meetings scheduled for this week" | |
| } | ConvertTo-Json | |
| Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:8000/chat" ` | |
| -ContentType "application/json" -Body $body | |
| ``` | |
| ## Expected Behavior π― | |
| ### Weather Agent | |
| ### Document RAG Agent | |
| ### Meeting Agent | |
| ### SQL Agent | |
| ## Troubleshooting π§ | |
| ### Issue: "No valid LLM configured" | |
| **Solution:** Ensure Ollama is running at http://localhost:11434 | |
| ```powershell | |
| # Check if Ollama is running | |
| Invoke-WebRequest http://localhost:11434 | |
| ``` | |
| ### Issue: "Weather API key not configured" | |
| **Solution:** Add your API key to `.env`: | |
| ```bash | |
| OPENWEATHERMAP_API_KEY=your_key_here | |
| ``` | |
| ### Issue: "Document ingestion failed" | |
| **Solution:** Check file format (PDF/TXT/MD/DOCX) and size (<10MB) | |
| ### Issue: Slow first RAG query | |
| **Expected:** First run downloads sentence-transformers model (~80MB) | |
| Subsequent queries will be fast. | |
| ### Issue: Import errors in IDE | |
| **Normal:** VSCode may show import warnings until packages are fully indexed. Code will run fine. | |
| ## Understanding the RAG Workflow π | |
| ``` | |
| User uploads document.pdf | |
| β | |
| 1. Parse with Docling | |
| β | |
| 2. Chunk into 500-char pieces (50-char overlap) | |
| β | |
| 3. Generate embeddings with sentence-transformers | |
| β | |
| 4. Store in ChromaDB (./chroma_db/) | |
| β | |
| User asks: "What is the policy?" | |
| β | |
| 5. Search vector store for similar chunks | |
| β | |
| 6. Check similarity score | |
| β | |
| βββββββββββββββ¬βββββββββββββββ | |
| β Score β₯ 0.7 β Score < 0.7 β | |
| β (confident) β (uncertain) β | |
| βββββββββββββββ΄βββββββββββββββ | |
| β β | |
| β β | |
| Return doc Search web | |
| answer + combine | |
| results | |
| ``` | |
| ## File Structure π | |
| ``` | |
| multi-agent/ | |
| βββ main.py # FastAPI server | |
| βββ agents.py # LangGraph agents | |
| βββ tools.py # Agent tools | |
| βββ vector_store.py # ChromaDB manager (NEW) | |
| βββ database.py # SQLite config | |
| βββ models.py # SQLAlchemy models | |
| βββ test_agents.py # Test suite | |
| βββ seed_data.py # DB initialization | |
| βββ .env # Your configuration | |
| βββ .env.template # Configuration template | |
| βββ database.db # SQLite database | |
| βββ chroma_db/ # Vector store (auto-created) | |
| βββ uploads/ # Uploaded documents | |
| βββ IMPLEMENTATION_COMPLETE.md # Full documentation | |
| ``` | |
| ## Next Steps π― | |
| 1. **Explore the API:** Visit http://127.0.0.1:8000/docs | |
| 2. **Try different queries:** Test edge cases and complex scenarios | |
| 3. **Upload your documents:** Try PDFs, policies, resumes | |
| 4. **Check vector store:** Inspect `./chroma_db/` directory | |
| 5. **Review logs:** Monitor agent decisions and tool calls | |
| ## Performance Tips β‘ | |
| ## Support π | |
| **You're all set! π Start making requests to your AI backend!** | |