yamraj047/api-problem-fix
0
๐ณ๐ต LexNepal AI API
Advanced Legal Intelligence API for Nepal Legal Code using Retrieval-Augmented Generation (RAG).
๐ Features
- Hybrid Retrieval: Dense vector search + keyword matching
- Cross-Encoder Reranking: Precise relevance scoring
- Zero-Hallucination: Answers only from verified legal texts
- Fast & Free: Optimized for CPU inference
๐๏ธ Architecture
- Embedding Model: all-mpnet-base-v2 (768D)
- Reranking: MS-MARCO Cross-Encoder
- LLM: Llama 3.3 70B (via Groq)
- Vector DB: FAISS (L2 Index)
๐ก API Endpoints
GET /- Interactive API documentation (Swagger UI)GET /health- Health checkGET /stats- Database statisticsPOST /query- Process legal query
๐ป Usage Example
curl -X POST "https://YOUR_USERNAME-lexnepal-api.hf.space/query" \
-H "Content-Type: application/json" \
-d '{
"query": "What are the penalties for theft in Nepal?",
"max_sources": 10
}'๐ Environment Variables
Set GROQ_API_KEY in Space settings for custom API key.
๐ Dataset
- Total Provisions: 6000+
- Legal Documents: 7 Nepal laws
- Vector Dimensions: 768
๐ ๏ธ Tech Stack
- FastAPI
- Sentence Transformers
- FAISS
- Groq API
- Docker
Built with โค๏ธ for Nepal's legal community
