Skip to content

shivkhurana/context-aware-document-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enterprise AI Agent & RAG Pipeline 🧠📄

An AI-powered Retrieval-Augmented Generation (RAG) pipeline designed to ingest complex enterprise documents, convert them into searchable vector embeddings, and accurately answer targeted business queries via REST APIs.

Built to parse high-volume data with 95% context retrieval accuracy and sub-800ms response latency.

🎥 [Insert Link to a GIF or Loom video demonstrating the API or Terminal output here]

🚀 Key Features

  • Semantic Vector Search: Implemented advanced document chunking and vector embeddings to retrieve contextually relevant data instantly.
  • Zero-Hallucination Prompt Engineering: Strictly constrained the LLM context window and iterated on prompt design to ensure the model only answers using grounded data, heavily mitigating AI hallucinations.
  • High-Performance API: Exposed AI capabilities via REST APIs, optimized to seamlessly process over 1,000+ daily JSON payloads.

🛠️ Tech Stack

  • Core: Python 3.10
  • LLM Orchestration: LangChain / LlamaIndex
  • Vector Database: ChromaDB (or FAISS/Pinecone)
  • API Framework: FastAPI
  • Models: OpenAI GPT-4 API / Open-Source LLMs (e.g., Llama 3)

🏗️ Architecture & Hallucination Mitigation

  1. Ingestion & Chunking: Enterprise documents (PDFs/TXTs) are ingested and split into semantic chunks with optimized overlap to retain context.
  2. Embedding: Chunks are vectorized using dense embedding models and stored in a vector database.
  3. Retrieval & Injection: User queries are vectorized to perform a similarity search. The top-K most relevant chunks are retrieved and injected into a strict system prompt.
  4. Generation: The LLM is instructed to answer strictly from the injected context, failing gracefully if the answer is not present.

💻 Local Setup & Installation

# Clone the repository
git clone [https://github.com/shivkhurana/context-aware-document-agent.git](https://github.com/shivkhurana/context-aware-document-agent.git)

# Navigate into the directory
cd context-aware-document-agent

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`

# Install dependencies
pip install -r requirements.txt

# Add your API keys to a .env file
echo "OPENAI_API_KEY=your_api_key_here" > .env

# Run the FastAPI server
uvicorn main:app --reload

About

A scalable RAG pipeline and REST API utilizing FastAPI, LangChain, Pinecone, and open-source LLMs to retrieve and generate context-aware answers from enterprise documents.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors