Skip to content

A multi-agent, retrieval-augmented system for asking questions about uploaded documents and getting grounded, cited answers.

Notifications You must be signed in to change notification settings

mrkeshi/KeshroAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

91 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  AI Document QA System

Python LLM Vector DB License

A productionโ€‘style Document Intelligence and Questionโ€‘Answering system that ingests files, builds embeddings, performs hybrid retrieval, and answers questions using LLM reasoning pipelines.


๐Ÿ“š Table of Contents

  • Overview
  • Architecture
  • Features
  • Project Structure
  • AI Pipeline
  • Notebooks (Start Here)
  • Installation
  • Running the Project
  • Configuration
  • Future Improvements

๐Ÿš€ Overview

This project implements a modular AI retrieval architecture designed to bridge research workflows and production systems.

Key capabilities:

โ€ข Document ingestion (PDF, DOCX, text, images)
โ€ข Intelligent chunking pipeline
โ€ข Embedding generation
โ€ข Vector search with Chroma
โ€ข Keyword search with BM25 (SQLite FTS5)
โ€ข LangGraph QA reasoning pipeline
โ€ข Configโ€‘driven prompts and models

The system follows clean architecture + adapter pattern to make AI components swappable and testable.


๐Ÿงฉ Architecture

                        +-------------------+
                        |       Client      |
                        |  API / Notebook   |
                        +---------+---------+
                                  |
                                  v
                        +-------------------+
                        |    Backend Layer  |
                        |  Request Control  |
                        +---------+---------+
                                  |
                                  v
                      +-----------------------+
                      |      AI Core Layer    |
                      |-----------------------|
                      | Document Parsers      |
                      | Chunking Pipeline     |
                      | Embedding Service     |
                      | Vector Store          |
                      | Keyword Search (BM25) |
                      | QA LangGraph Workflow |
                      +-----------+-----------+
                                  |
                                  v
                           +-------------+
                           |     LLM     |
                           +-------------+

โœจ Features

Intelligent Document Processing

Supports multiple document types via adapters.

  • PDF
  • DOCX
  • Plain text
  • Images

Hybrid Retrieval

Combines:

โ€ข Dense vector search
โ€ข Sparse keyword search

Result โ†’ better recall and accuracy.

LangGraph QA Workflows

Advanced reasoning pipeline capable of:

  • Context retrieval
  • Multiโ€‘step reasoning
  • Structured responses
  • Tool orchestration

Modular Adapter Architecture

Adapters isolate external systems:

LLM
Vector Database
Embedding Model
File Parsers
Search Engines

Making the system easy to extend.


๐Ÿ“‚ Project Structure

.
โ”œโ”€โ”€ notebooks/                 # ๐Ÿ”ฅ Start here
โ”‚
โ”œโ”€โ”€ configs/
โ”‚   โ”œโ”€โ”€ configs.yaml
โ”‚   โ””โ”€โ”€ prompts.yml
โ”‚
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ adapters/
โ”‚   โ”‚   โ”œโ”€โ”€ chunking/
โ”‚   โ”‚   โ”œโ”€โ”€ embedding/
โ”‚   โ”‚   โ”œโ”€โ”€ keyword_search/
โ”‚   โ”‚   โ”œโ”€โ”€ llm/
โ”‚   โ”‚   โ””โ”€โ”€ vectorstore/
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ langgraph/
โ”‚
โ””โ”€โ”€ docker/

The architecture follows a ports & adapters design to separate business logic from infrastructure.


๐Ÿง  AI Pipeline

1๏ธโƒฃ Document Loading

Files are parsed and normalized using parser adapters.

2๏ธโƒฃ Chunking

Documents are split into semantic segments using configurable strategies.

3๏ธโƒฃ Embedding Generation

Each chunk is converted into vectors via HuggingFace embedding models.

4๏ธโƒฃ Storage

Vectors are stored in ChromaDB.

5๏ธโƒฃ Retrieval

Two systems run in parallel:

โ€ข Vector similarity search
โ€ข BM25 keyword search

6๏ธโƒฃ Reasoning

LangGraph orchestrates:

  • Retrieval
  • Context filtering
  • LLM generation
  • Response formatting

๐Ÿ““ Notebooks (Start Here)

The entry point of the project is inside the notebooks directory.

Run the notebooks in order:

notebooks/
โ”‚
โ”œโ”€โ”€ 01_Setup_Notebook.ipynb
โ”œโ”€โ”€ 02_AI_Technical_Notebook.ipynb
โ”œโ”€โ”€ 03_File_Chunk_Embedding_Search.ipynb
โ””โ”€โ”€ 04_QA_Pipeline_LangGraph.ipynb

These notebooks demonstrate the entire AI pipeline stepโ€‘byโ€‘step.

They serve as:

โ€ข tutorials
โ€ข experiments
โ€ข debugging tools
โ€ข documentation


โš™๏ธ Installation

git clone <repo>

cd project

pip install -r requirements.txt

โ–ถ๏ธ Running

Run notebooks

cd notebooks
jupyter notebook

Start services with Docker

docker compose up --build

๐Ÿ”ง Configuration

Main configuration files:

configs/configs.yaml
configs/prompts.yml

You can configure:

  • LLM provider
  • Embedding models
  • Retrieval parameters
  • Prompt templates
  • Chunking strategies

๐Ÿงช Design Principles

โ€ข Research friendly
โ€ข Production oriented
โ€ข Highly modular
โ€ข Replaceable AI components
โ€ข Configโ€‘driven experimentation


๐Ÿ”ฎ Future Improvements

  • Evaluation pipelines
  • Observability
  • Hybrid ranking
  • Streaming responses
  • UI interface
  • Multiโ€‘document reasoning

๐Ÿค Contributing

  1. Start experimentation in notebooks
  2. Move stable logic to core/
  3. Add adapters if integrating new systems
  4. Expose via backend services

โญ If this project helped you

Consider giving it a star.

About

A multi-agent, retrieval-augmented system for asking questions about uploaded documents and getting grounded, cited answers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors