CoolFace
Apppublic

satyamxpatil/SchemeFinder-AI

sourceHugging Facemitupdated 7mo agoView on Hugging Face
0likes
App README

SchemeFinder AI ๐Ÿ›๏ธ

A government-grade, AI-assisted platform ensuring zero-hallucination scheme discovery and deterministic eligibility verification for Indian Citizens. Built for the AI for Bharat Hackathon.

Version Next.js TypeScript Gemini AI

๐Ÿ“Œ Problem Statement

Many citizens struggle to find government schemes they are eligible for. Existing AI solutions often "hallucinate" eligibility, giving citizens false hope or incorrect information. SchemeFinder AI solves this by separating AI Discovery from Deterministic Mathematical Verification.

โœจ Key Features

  • โ€”Zero Hallucination Hybrid Architecture: Uses Google Gemini to discover relevant schemes, but strictly evaluates eligibility mathematically via a custom TypeScript Engine.
  • โ€”Navira AI Chatbot: Real-time conversational assistant for government scheme inquiries.
  • โ€”Premium UI: Government-grade, accessible interface built with Vanilla CSS modules (No Tailwind bloat).
  • โ€”Upcoming Scheme Flags: Distinct visual indicators for schemes that are still in parliamentary discussion.
  • โ€”Data Privacy First: Zero databases attached to the frontend. All inputs are evaluated in-memory and instantly discarded.

๐Ÿš€ How to Run Locally

Prerequisites

Installation Steps

  1. 1.Clone the repository
bash
   git clone https://github.com/Patilsatyam83/schemefinder-ai.git
  1. 1.Navigate into the project folder
bash
   cd scheme-finder
โš ๏ธ Important: The project folder is called scheme-finder, NOT schemefinder-ai. Running npm commands outside this folder will cause a package.json not found error.
  1. 1.Install dependencies
bash
   npm install
  1. 1.Create the environment file

In the scheme-finder folder, create a new file named exactly .env.local and add:

env
   GEMINI_API_KEY=your_actual_api_key_here

Replace your_actual_api_key_here with your real Gemini API key from Google AI Studio.

๐Ÿ’ก Windows users: Use VS Code to create .env.local โ€” Windows Explorer may block filenames that start with a dot.
  1. 1.Start the development server
bash
   npm run dev
  1. 1.Open in browser

Navigate to http://localhost:3000


โ“ Troubleshooting

ErrorFix
Cannot find package.jsonMake sure you are inside the scheme-finder folder, not the root or schemefinder-ai
GEMINI_API_KEY is not definedEnsure .env.local exists in the scheme-finder folder with your key
Port 3000 in useRun npm run dev -- -p 3001 to use a different port

๐Ÿ—๏ธ Architecture & Code Overview (For Judges)

1. src/data/schemes.json (The Database)

This acts as our massive ingested government database (simulating data.gov.in). It stores rigid criteria for active schemes (like PM-Kisan) and upcoming schemes (like Universal Basic Youth Income).

2. src/lib/eligibilityEngine.ts (The Brains - Zero Hallucination)

This is the core innovation. It is a strictly deterministic TypeScript function. It takes the user's profile and compares it against the JSON criteria. Why it matters: It uses standard if/else mathematical checks (user.income <= rule.maxIncome). AI is never allowed to dictate if someone is eligible.

3. src/app/api/schemes/route.ts (The Hybrid Discovery Pipeline)

When a user clicks "Search", this API route triggers:

  1. 1.It sends the profile to Google Gemini asking it to discover potentially relevant schemes.
  2. 2.It takes those AI-suggested schemes and merges them with our local schemes.json.
  3. 3.It takes the combined list and safely passes it through the eligibilityEngine.ts.
  4. 4.The frontend only renders schemes that mathematically survived step 3.

4. src/components/Chatbot.tsx & api/chat/route.ts (The Assistant)

A custom-built React component that maintains conversation history and streams responses from Gemini 2.5 Flash, strictly instructed via system prompts to act as a government guide.


๐Ÿ”’ Privacy & Security

  • โ€”In-Memory Processing: The Next.js API routes process the JSON payload instantly without saving state to an external SQL/NoSQL database.

๐Ÿ‘จโ€๐Ÿ’ป Developed By

Satyam Patil - Project Lead, Navira AI