🚨 Improve Red Flags Detection with Enhanced LLM Prompt#4
Open
pranaya-mathur wants to merge 4 commits into
Open
🚨 Improve Red Flags Detection with Enhanced LLM Prompt#4pranaya-mathur wants to merge 4 commits into
pranaya-mathur wants to merge 4 commits into
Conversation
- Removed .env file containing exposed GROQ_API_KEY - Added .env.example template - Created comprehensive .gitignore to prevent future credential leaks
…lity - Increased ThreadPoolExecutor workers from 2 to 10 - Added rate limiting (slowapi): 60/min for evaluate, 20/min for batch - Implemented proper LLM timeout enforcement using signal module - Added batch size validation (max 100 claims) - Converted file writes to async to avoid blocking - Pinned all dependency versions - Improved error handling and logging - API version bumped to 0.2
- Added docker-compose.yml with API + Prometheus stack - Improved Dockerfile with health checks and layer caching - Created requirements-dev.txt with testing and dev tools - Added .pre-commit-config.yaml for automated code quality - Created .dockerignore to optimize Docker builds - Added Makefile with common development commands - Complete local development environment ready
pranaya-mathur
added a commit
that referenced
this pull request
Dec 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
LLM was not consistently detecting and listing red flags in suspicious claims. Even when identifying issues in fraud_explanation, the
red_flagsarray remained empty.Solution
Enhanced LLM Prompt
Added explicit red flag checklist with clear examples:
Key Improvements:
Updated Fallback Heuristic:
Also improved
local_fallback()function to detect Hindi patterns:Testing Required:
Test Case 1 - Delayed Report (Hindi):
{ "narrative": "Kal raat accident hua. FIR abhi tak nahi karwayi. Baad mein file kar dunga." }Expected:
red_flags: ["delayed-report", "no-police-report"]fraud_risk: >= 0.4Test Case 2 - Vague + Short:
{ "narrative": "Accident. Will file later." }Expected:
red_flags: ["short-narrative", "delayed-report", "vague-details"]fraud_risk: >= 0.5Test Case 3 - Legitimate Claim:
{ "narrative": "Car accident on highway. Police report filed immediately with FIR number 123. Full damage documentation attached." }Expected:
red_flags: []fraud_risk: < 0.2Impact:
Ready for testing - merge after validation!