CoolFace
Apppublic

yamraj047/api-problem-fix

sourceHugging Faceapache-2.0updated 8mo agoView on Hugging Face
0likes
App README

๐Ÿ‡ณ๐Ÿ‡ต 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