Skip to content

Sathvik2954/EngiQuery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

EngiQuery

An AI agent for technical document analysis. Upload engineering manuals, datasheets, and compliance standards — then ask questions, compare specifications, detect contradictions, and run compliance checks across all documents simultaneously.

Unlike basic RAG applications, EngiQuery uses an agent loop where the LLM decides which tool to use based on your question. It also integrates with Gmail to automatically email analysis reports.


Features

  • Multi-document Q&A with source citations
  • Cross-document specification comparison
  • Contradiction detection across documents
  • Compliance gap checking against standards
  • Automatic email delivery of reports via Gmail
  • Conversation memory within sessions
  • Supports PDF, DOCX, and TXT files

Tech Stack

Layer Technology
Backend FastAPI, Python
LLM Groq API (Llama 3.3 70B) — free tier
Embeddings sentence-transformers (all-MiniLM-L6-v2) — local
Vector DB ChromaDB — local
PDF Parsing pdfplumber + PyMuPDF fallback
Email Gmail SMTP
Frontend HTML, CSS, JavaScript

Project Structure

engiquery/
├── backend/
│   ├── main.py          # FastAPI routes + email workflow
│   ├── database.py      # ChromaDB setup + document registry
│   ├── ingestion.py     # Parse, chunk, embed, store pipeline
│   ├── query.py         # Agent loop + conversation memory
│   ├── llm.py           # Groq client + prompt templates
│   ├── tools.py         # Agent tool definitions and executors
│   ├── utils.py         # File parsers (PDF, DOCX, TXT)
│   ├── .env             # API keys (not committed)
│   └── requirements.txt
└── frontend/
    ├── index.html       # Document upload page
    ├── chat.html        # Agent chat interface
    ├── analysis.html    # Contradiction and compliance tools
    ├── style.css
    └── app.js

Setup

1. Clone the repository

git clone https://github.com/yourusername/engiquery.git
cd engiquery

2. Create virtual environment and install dependencies

cd backend
python -m venv venv
venv\Scripts\activate        # Windows
pip install -r requirements.txt

3. Configure environment variables

Create a .env file inside the backend folder:

GROQ_API_KEY=your_groq_api_key_here
GMAIL_SENDER=youremail@gmail.com
GMAIL_APP_PASSWORD=your_gmail_app_password

Getting credentials:

  • Groq API key: console.groq.com (free)
  • Gmail App Password: myaccount.google.com/apppasswords (requires 2-step verification enabled)

4. Run the backend

cd backend
venv\Scripts\activate
uvicorn main:app

Backend runs at http://localhost:8000

5. Run the frontend

Open a second terminal:

cd frontend
python -m http.server 3000

Open http://localhost:3000 in your browser.


Usage

Uploading documents

Go to the Documents page and drag and drop any PDF, DOCX, or TXT file. The agent will parse, chunk, embed, and store it automatically.

Asking questions

Go to the Chat page and type any question. The agent automatically selects the right tool:

  • Factual questions trigger document search
  • Comparison questions trigger cross-document comparison
  • Questions about conflicts trigger contradiction detection
  • Questions about requirements trigger compliance checking

Emailing reports

Enter an email address in the Chat page and click Send + Email. The agent answers in chat and simultaneously sends the full report to the provided address.

Analysis tools

Go to the Analysis page for:

  • Contradiction detection across selected documents on a specific topic
  • Compliance gap checking between a design document and a standard

API Endpoints

Method Endpoint Description
GET /documents List uploaded documents
POST /documents/upload Upload a document
DELETE /documents/{doc_id} Delete a document
POST /query Ask the agent a question
POST /compliance Run a compliance check
POST /workflow/email Query and email the report
DELETE /memory/{session_id} Clear conversation memory
GET /health Health check

Environment Variables

Variable Description
GROQ_API_KEY Groq API key for LLM inference
GMAIL_SENDER Gmail address to send reports from
GMAIL_APP_PASSWORD Gmail app password (not your account password)

Notes

  • All embeddings and vector storage are local — no data leaves your machine except LLM inference calls to Groq and emails sent via Gmail.
  • ChromaDB stores data in a chroma_store folder inside the backend directory.
  • Document metadata is stored in doc_registry.json inside the backend directory.
  • Conversation memory is in-memory only and resets when the server restarts.

About

AI agent for querying engineering documents - upload PDFs, ask questions, detect contradictions, and run compliance checks across multiple files.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors