rag-api-node-1 / DEPLOYMENT_FIXES.md
Peterase's picture
fix: Improve DuckDuckGo error handling + deployment tools
80bda3b
|
Raw
History Blame
3.42 kB

Deployment Fixes for RAG API v2.4

Issues Fixed

1. βœ… Qdrant order_by Error (FIXED IN CODE)

  • Status: Fixed in commit 7110008
  • Action: Already deployed, no action needed

2. βœ… DuckDuckGo Decode Error (FIXED IN CODE)

  • Status: Fixed with better error handling
  • Action: Deploy latest code
  • Details: System now gracefully handles decode errors and falls back to database

3. ⚠️ Reranker Tokenizer Error (NEEDS DEPLOYMENT)

  • Status: Fix ready, needs dependency upgrade
  • Action: Run upgrade script (see below)

Deployment Steps

Option A: Automatic Upgrade (Recommended)

cd services/apis/rag-api
chmod +x upgrade_dependencies.sh
./upgrade_dependencies.sh

Option B: Manual Upgrade

pip install --upgrade FlagEmbedding>=1.2.11
pip install --upgrade transformers>=4.45.0

Option C: Fresh Install

cd services/apis/rag-api
pip install -r requirements.txt --upgrade

Verification

After deployment, check logs for:

βœ… Success Indicators:

# No more Qdrant errors
βœ“ No "order_by not supported" warnings

# No more reranker errors  
βœ“ No "XLMRobertaTokenizer has no attribute prepare_for_model" errors

# DuckDuckGo graceful handling
βœ“ "DuckDuckGo decode error (likely rate limit)" β†’ Falls back to DB
βœ“ System continues working with database results

❌ If Still Broken:

# Check installed versions
pip show FlagEmbedding transformers

# Should show:
# FlagEmbedding: 1.2.11 or higher
# transformers: 4.45.0 or higher

# If not, force reinstall:
pip uninstall FlagEmbedding transformers -y
pip install FlagEmbedding==1.2.11 transformers==4.45.0

Testing

Test 1: Check Reranker

# Query the API and check logs
curl -X POST http://localhost:7860/api/v1/rag/chat/stream \
  -H "Content-Type: application/json" \
  -d '{"query": "Ethiopia news today"}'

# Check logs - should NOT see:
# ❌ "Reranker scoring failed"

# Should see:
# βœ… "DEBUG: After hybrid ranking: 15 results"

Test 2: Check DuckDuckGo

# Query with temporal intent
curl -X POST http://localhost:7860/api/v1/rag/chat/stream \
  -H "Content-Type: application/json" \
  -d '{"query": "breaking news today"}'

# Check logs:
# βœ… "DEBUG: Hybrid search returned X DB + Y live results"
# If Y=0, check for:
# βœ… "DuckDuckGo decode error (likely rate limit)" β†’ Graceful fallback

Test 3: Check News Endpoint

# Test browse endpoint
curl http://localhost:7860/api/v1/news/latest?limit=10

# Should return:
# βœ… 200 OK with recent articles
# βœ… No 400 errors in logs

Rollback Plan

If issues occur after deployment:

# Rollback to previous versions
pip install FlagEmbedding==1.2.5 transformers==4.40.0

# Or rollback code
git revert 7110008
git push

Support

If issues persist:

  1. Check logs for specific error messages
  2. Verify Python version (should be 3.10+)
  3. Check if running in virtual environment
  4. Try fresh install in clean environment

Version History

  • v2.4 (2026-05-04): Fixed Qdrant order_by, DuckDuckGo errors, upgraded reranker
  • v2.3 (2026-05-04): Interactive thinking indicator with Lucide icons
  • v2.2 (2026-05-03): Time-based filtering for news endpoint
  • v2.1 (2026-05-03): Query enhancements and flexible prompting
  • v2.0 (2026-05-02): Hybrid RAG with live search