Spaces:
Sleeping
Sleeping
File size: 1,444 Bytes
abd28b7 48c70d8 d412fb2 abd28b7 d412fb2 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 abd28b7 48c70d8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
---
title: LexNepal AI API
emoji: ⚖️
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
license: apache-2.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 check
- `GET /stats` - Database statistics
- `POST /query` - Process legal query
## 💻 Usage Example
```bash
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 |