Deployment Ready: Fixed scam detection low confidence, added production audit report, optimized throttles
1838600 π HF Deployment Pre-Flight Checklist
Target: Hugging Face Spaces + GUVI Hackathon
β Required HF Secrets
Set these in HF Spaces β Settings β Secrets:
| Secret Name | Required | Description |
|---|---|---|
GROQ_API_KEY |
β YES | Groq API key for LLM calls |
GUVI_API_KEY |
β YES | GUVI hackathon auth key |
Optional (defaults work):
ENV=production(optional, defaults to production behavior)
β Pre-Deploy Verification Commands
Run these locally before pushing to HF:
# 1. All behavioral tests pass
py -m pytest scripts/fast_behavior_tests.py -v
# 2. Cache optimization tests pass
py -m pytest scripts/test_prompt_caching.py -v -s -k "not Live"
# 3. Main app imports cleanly
py -c "from app.main import app; print('β
OK')"
# 4. Quick smoke test (start server)
py -m uvicorn app.main:app --port 8000 --host 127.0.0.1
# Then test: curl http://localhost:8000/health
β Model Mapping (Cache-Optimized)
| Agent | Model | Cache Support |
|---|---|---|
| Persona Replies | llama-3.1-8b-instant |
β No |
| Intelligence Extraction | openai/gpt-oss-20b |
β Yes |
| Safety Guard | openai/gpt-oss-safeguard-20b |
β Yes |
| Smart Reasoning | moonshotai/kimi-k2-instruct-0905 |
β Yes |
Note: Fast chat uses uncached model for speed. Heavy tasks use cached models for cost savings.
β Config Sanity Checklist
| Check | Status |
|---|---|
DEBUG = False in config.py |
β |
| Mock callback URL commented out | β |
| No hardcoded API keys | β |
No blocking time.sleep() |
β |
| All retries capped at 2-5 | β |
β GUVI Callback Readiness
| Requirement | Status |
|---|---|
URL: https://hackathon.guvi.in/api/updateHoneyPotFinalResult |
β |
Auth: x-api-key header |
β |
| Retry: 5x exponential backoff | β |
Dedup: sys_callback_sent flag |
β |
Trigger: scamDetected=True AND should_finalize=True |
β |
β Budget Limits (Hardcoded)
| Limit | Value | Enforced |
|---|---|---|
| Max LLM calls per turn | 4 | β |
| Max LLM calls per session | 30 | β |
| Max cascade retries | 2 | β |
π§ͺ 1-Command HF Sanity Test
After deploying to HF, run this:
curl -X POST "https://YOUR-SPACE.hf.space/api/v1/guvi/challenge" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_GUVI_API_KEY" \
-d '{
"sessionId": "test-123",
"message": {"text": "Hello, your bank account is blocked", "sender": "scammer"}
}'
Expected Response:
{
"status": "success",
"reply": "..."
}
π Final Deployment Commands
# 1. Commit all changes
git add .
git commit -m "Production-ready for GUVI + HF"
# 2. Push to HF
git push hf main
Last Verified: 2026-02-03
Score: 53/53 (100%) Production Ready β All Critical Fixes Applied