Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

176 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yantr — AI Lab Assistant

Yantr is an AI-powered study assistant built for engineering students. It combines a RAG (Retrieval Augmented Generation) pipeline with an organized library of study materials, enabling precise, context-aware answers sourced directly from indexed course documents.


Features

Feature Description
RAG Chatbot Streams GPT-4o-mini responses grounded in your indexed PDFs via Pinecone
Study Library Organized browser for PDFs — Physics, Chemistry, C Programming, CPS, Statistics, FCPS
Vision Support Upload images alongside questions for multimodal AI assistance
Contribution Pipeline Students submit PDFs via UI → GitHub PR auto-created → Admin merges to publish
Auth & Quotas Clerk authentication + Upstash Redis rate limiting (10 messages/day)
Streaming Responses Real-time streamed AI output using Vercel AI SDK

Tech Stack

Layer Technology
Frontend Next.js 16, React 19, TypeScript
Styling Tailwind CSS v4, Framer Motion
AI / LLM OpenAI GPT-4o-mini (@ai-sdk/openai)
Vector DB Pinecone (text-embedding-3-small)
Auth Clerk
Rate Limiting Upstash Redis
Contribution API Octokit (@octokit/rest) → GitHub REST API
Deployment Vercel
Python Backend pdfplumber, langchain, openai (for RAG indexing)

Repository Structure

Yantr-chatbot/
├── frontend/                    # Next.js application
│   ├── src/
│   │   ├── app/
│   │   │   ├── api/
│   │   │   │   ├── chat/        # Streaming RAG chat endpoint
│   │   │   │   ├── contribute/  # GitHub PR creation endpoint
│   │   │   │   ├── history/     # Chat history (Upstash Redis)
│   │   │   │   ├── quota/       # Daily message quota API
│   │   │   │   └── theory/      # Study material file server
│   │   │   ├── contribute/      # User contribution form page
│   │   │   ├── resources/       # Study materials browser page
│   │   │   └── page.tsx         # Home / Chat interface
│   │   ├── components/          # Reusable React components
│   │   └── lib/                 # Pinecone, Upstash, Clerk helpers
│   ├── public/
│   │   └── manuals/             # PDFs served to users
│   └── package.json
│
└── backend/                     # Python data processing
    ├── scripts/
    │   ├── upload_vectors.py    # Indexes PDFs into Pinecone
    │   └── generate-theory-index.js
    └── data/
        └── knowledge_base/      # Source documents (FCPS, Stats, CPS...)

Getting Started

Prerequisites

  • Node.js 18+
  • Python 3.9+ (for indexing only)

1. Clone & Install

git clone https://github.com/aryawadhwa/Yantr-chatbot.git
cd Yantr-chatbot/frontend
npm install

2. Environment Variables

Create frontend/.env.local:

# AI
OPENAI_API_KEY=sk-...

# Vector DB
PINECONE_API_KEY=...
PINECONE_INDEX_NAME=yantr-knowledge-base

# Auth
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_...
CLERK_SECRET_KEY=sk_...

# Rate Limiting
UPSTASH_REDIS_REST_URL=https://...
UPSTASH_REDIS_REST_TOKEN=...

# Contribution Pipeline (GitHub Fine-grained PAT)
# Scopes required: Contents (read/write), Pull Requests (read/write)
GITHUB_PAT=github_pat_...

3. Run Development Server

cd frontend
npm run dev

Open http://localhost:3000.


RAG Indexing (One-Time Setup)

To embed course documents into Pinecone:

# Setup Python environment
cd backend
python -m venv venv
source venv/bin/activate  # macOS/Linux
pip install pdfplumber langchain-text-splitters openai pinecone python-dotenv

# Add PDFs to backend/data/knowledge_base/
# Then run the indexer
python scripts/upload_vectors.py

Contribution Pipeline

Students can submit study materials directly from the web UI:

  1. Navigate to /contribute on the site.
  2. Select a course, enter a filename, and upload a PDF.
  3. The server calls the GitHub API to create a new branch and PR with the file placed in both public/manuals/ and data/knowledge_base/.
  4. An admin reviews and merges the PR on GitHub — Vercel auto-deploys the update.

Deployment (Vercel)

  1. Push code to GitHub.
  2. Import the repository on vercel.com.
  3. Set Root Directory to frontend.
  4. Add all environment variables from .env.local in Project Settings.
  5. Click Deploy.

Team

Name Role
Arya Wadhwa CEO & Co-Founder
Dilraj Singh CTO & Co-Founder
Aadarsh KR Co-Founder
Harsha S Co-Founder

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages