Skip to content
Shravan4598Public

Latest commit

Β 

History

50 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Production AI ChatBot

A production-level AI Assistant built using LangGraph, LangChain, Google Gemini, RAG, and Agentic AI architecture.

This chatbot intelligently decides the best way to answer user queries using:

  • 🧠 Gemini LLM
  • πŸ“š Retrieval Augmented Generation (RAG)
  • 🌀 Real-time Weather Tool
  • πŸ“ˆ Stock Market Tool
  • πŸ”Ž DuckDuckGo Web Search
  • ▢️ YouTube Video Summarization

The project follows a modular production architecture using Services, Graph Workflow, Tools, RAG Pipeline, and Streamlit UI.


πŸš€ Features

🧠 Intelligent AI Router (LangGraph)

The chatbot uses an LLM-powered router to decide which component should handle the user query.

Example:

User:
"What is the weather in Delhi?"

Router:
β†’ Weather Tool
User:
"Explain this PDF"

Router:
β†’ RAG Pipeline
User:
"Summarize this YouTube video"

Router:
β†’ YouTube Tool

✨ Main Features

1. Gemini AI Chat

Powered by:

  • Google Gemini API
  • LangChain ChatGoogleGenerativeAI

Capabilities:

  • General conversation
  • Coding assistance
  • Explanation
  • Reasoning
  • Content generation

2. πŸ“š RAG Document Question Answering

Users can upload documents and ask questions.

Supported formats:

  • PDF
  • DOCX
  • TXT

RAG Pipeline:

Document Upload

        ↓

Document Loader

        ↓

Text Splitter

        ↓

Embedding Generation

        ↓

Vector Database

        ↓

Retriever

        ↓

Gemini LLM

        ↓

Final Answer

Technologies:

  • LangChain
  • ChromaDB
  • FAISS
  • HuggingFace Embeddings
  • Gemini

3. 🌀 Weather Tool

Provides real-time weather information:

  • Temperature
  • Weather condition
  • Humidity
  • Wind speed
  • Forecast

Example:

"What is today's weather in Mumbai?"

4. πŸ“ˆ Stock Market Tool

Provides financial information:

Supported:

  • NSE
  • BSE
  • NASDAQ

Example:

"What is the current price of Tesla?"

5. πŸ”Ž DuckDuckGo Search Tool

Used for:

  • Latest news
  • Current events
  • Real-time information
  • Web search

Example:

"Latest AI news"

6. ▢️ YouTube Summarizer

Features:

  • Extract YouTube transcript
  • Summarize videos
  • Generate key points
  • Answer questions from videos

Example:

"Summarize this YouTube video"

πŸ—οΈ System Architecture

                 User

                  |

                  |

            Streamlit UI

                  |

                  |

            Chat Service

                  |

                  |

          LangGraph Workflow

                  |

                  |

            AI Router Agent

                  |

 ------------------------------------------------

 |              |              |                |

Chat           RAG          Tools          Search

 |              |              |

Gemini     Vector DB      APIs

                  |

                  |

          Final Response

                  |

                  |

        SQLite Conversation Memory


πŸ“‚ Project Structure

ChatBot/

β”‚
β”œβ”€β”€ app.py

β”œβ”€β”€ README.md

β”œβ”€β”€ requirements.txt

β”œβ”€β”€ setup.py

β”œβ”€β”€ Dockerfile


β”‚
β”œβ”€β”€ config/

β”‚   β”œβ”€β”€ config.py

β”‚   └── constants.py


β”‚
β”œβ”€β”€ core/

β”‚   β”œβ”€β”€ logger.py

β”‚   └── exception.py


β”‚
β”œβ”€β”€ graph/

β”‚   β”œβ”€β”€ state.py

β”‚   β”œβ”€β”€ router.py

β”‚   β”œβ”€β”€ nodes.py

β”‚   └── workflow.py


β”‚
β”œβ”€β”€ rag/

β”‚   β”œβ”€β”€ rag_service.py

β”‚   β”œβ”€β”€ loader_factory.py

β”‚   β”œβ”€β”€ retriever_service.py

β”‚   └── document_splitter.py


β”‚
β”œβ”€β”€ services/

β”‚   β”œβ”€β”€ llm_service.py

β”‚   β”œβ”€β”€ chat_service.py

β”‚   β”œβ”€β”€ document_service.py

β”‚   β”œβ”€β”€ conversation_service.py

β”‚   └── checkpoint_service.py


β”‚
β”œβ”€β”€ tools/

β”‚   β”œβ”€β”€ weather_tool.py

β”‚   β”œβ”€β”€ stock_tool.py

β”‚   β”œβ”€β”€ duckduckgo_tool.py

β”‚   └── youtube_tool.py


β”‚
└── ui/

    β”œβ”€β”€ styles.py

    β”œβ”€β”€ sidebar.py

    β”œβ”€β”€ chat.py

    β”œβ”€β”€ components.py

    └── utils.py


πŸ› οΈ Tech Stack

Programming Language

  • Python 3.11+

Generative AI

  • Google Gemini
  • LangChain
  • LangGraph

RAG

  • ChromaDB
  • FAISS
  • HuggingFace Embeddings

Frontend

  • Streamlit

Database

  • SQLite

Monitoring

  • LangSmith

Deployment

  • Docker
  • HuggingFace Spaces
  • Cloud Platforms

βš™οΈ Installation

Clone Repository

git clone https://github.com/yourusername/ChatBot.git

cd ChatBot

Create Virtual Environment

python -m venv venv

Activate environment:

Windows:

venv\Scripts\activate

Linux/Mac:

source venv/bin/activate

Install Dependencies

pip install -r requirements.txt

πŸ”‘ Environment Variables

Create a file:

.env

Add:

GOOGLE_API_KEY="your_gemini_api_key"


LANGSMITH_TRACING_V2=true

LANGSMITH_API_KEY="your_langsmith_api_key"

LANGSMITH_PROJECT="ChatBot"

▢️ Run Application

Start Streamlit:

streamlit run app.py

Open:

http://localhost:8501

🐳 Docker Deployment

Build image:

docker build -t ai-chatbot .

Run container:

docker run \
-p 8501:8501 \
--env-file .env \
ai-chatbot

πŸ§ͺ Example Queries

General AI Chat

Explain Transformers in simple words

Document Question Answering

Upload PDF:

Summarize this document
What are the important points?

Weather

Weather in Delhi today

Stock

Tesla stock price

Web Search

Latest AI trends

YouTube

Summarize this video:
https://youtube.com/...

πŸ“Š LangSmith Monitoring

LangSmith tracks:

  • LLM calls
  • LangGraph workflow
  • Tool execution
  • RAG retrieval

Flow:

User Query

      ↓

Router

      ↓

Tool Selection

      ↓

Execution

      ↓

Gemini Response

      ↓

LangSmith Trace


πŸ” Security Features

Implemented:

  • Environment based API keys
  • File validation
  • Exception handling
  • Logging system
  • Thread isolation
  • Modular architecture

πŸš€ Future Improvements

  • Authentication
  • User dashboard
  • PostgreSQL integration
  • Redis caching
  • Multi-agent architecture
  • Voice assistant
  • Image understanding
  • Kubernetes deployment

πŸ‘¨β€πŸ’» Author

Shravan Kumar Pandey

B.Tech Computer Science Engineering (Data Science)

Interested in:

  • Data Science
  • Machine Learning
  • Generative AI
  • LangChain
  • LangGraph
  • RAG Systems

⭐ Support

If you like this project, give it a ⭐ on GitHub.

Releases

Packages

Contributors

Languages