https://github.com/devdoshi19/chatbot_using_basic_langchain
A professional AI Chatbot built with LangChain and Google Gemini, featuring a custom UI using Streamlit.
https://github.com/devdoshi19/chatbot_using_basic_langchain
chat-application chatbot gemini-api generative-ai langchain python python3 streamlit
Last synced: about 2 months ago
JSON representation
A professional AI Chatbot built with LangChain and Google Gemini, featuring a custom UI using Streamlit.
- Host: GitHub
- URL: https://github.com/devdoshi19/chatbot_using_basic_langchain
- Owner: DevDoshi19
- Created: 2025-12-23T10:42:39.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-12-23T11:56:44.000Z (6 months ago)
- Last Synced: 2025-12-25T01:00:20.358Z (6 months ago)
- Topics: chat-application, chatbot, gemini-api, generative-ai, langchain, python, python3, streamlit
- Language: Python
- Homepage:
- Size: 6.12 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
π€ Gemini-Powered Chatbot (LangChain + Streamlit)
###
π§ A basic AI chatbot built using LangChain and Google Gemini
β‘ Features real-time streaming responses and session-based memory
π§© Clean separation between UI and LLM logic
###
---
## π Project Structure
```
.
βββ app.py # Streamlit UI
βββ chatbot_stremlit.py # LangChain + Gemini logic
βββ requirements.txt
βββ .gitignore
βββ README.md
βββ .env # API keys (created by user)
````
---
## π Key Features
- π§ **Session-based Conversational Memory**
Maintains chat history using `st.session_state`
- β‘ **Streaming Responses**
Uses LangChain `.stream()` for live output
- π§© **Clean Architecture**
- `chatbot_stremlit.py` β AI logic
- `app.py` β UI and interaction
- π **Secure API Management**
Uses `.env` file with `python-dotenv`
---
---
## π οΈ Tech Stack
- **Language:** Python 3.10+
- **LLM:** Google Gemini (`gemini-2.5-flash-lite`)
- **Frameworks:** LangChain (LCEL), Streamlit
- **Utilities:** python-dotenv
---
## π Complete Setup Guide
### 1οΈβ£ Clone the Repository
```bash
git clone https://github.com/DevDoshi19/ChatBot_using_Basic_LangChain.git
````
---
### 2οΈβ£ (Optional) Create Virtual Environment
```bash
python -m venv venv
source venv/bin/activate # macOS / Linux
venv\Scripts\activate # Windows
```
---
### 3οΈβ£ Install Dependencies
```bash
pip install -r requirements.txt
```
---
### 4οΈβ£ Create `.env` File
Create a file named **`.env`** in the root directory.
```env
GOOGLE_API_KEY=your_google_gemini_api_key_here
```
β οΈ Never commit `.env` to GitHub.
---
### 5οΈβ£ Run the App
```bash
streamlit run app.py
```
The chatbot will open in your browser.
---
## π§ How It Works (High-Level)
```
User β Streamlit UI β LangChain Prompt
β Gemini Model β Streamed Response
```
* Chat history is injected using `MessagesPlaceholder`
* Responses stream live using `st.write_stream`
* Memory persists within the session
---
## π¦ requirements.txt (Example)
```txt
streamlit
langchain
langchain-google-genai
python-dotenv
```
---
## π§ What I Learned
* Using **LangChain Expression Language (LCEL)**
* Handling Streamlit reruns via **Session State**
* Implementing **real-time LLM streaming**
* Structuring AI apps cleanly and scalably
---
## π¨βπ» Author
**Dev Doshi**
B.Tech | AI / ML | LangChain | Streamlit | Generative AI
---
## π Letβs Connect
---
## π Demo
https://github.com/user-attachments/assets/6d8c7f3a-f731-4fb2-8406-1e566a351270
---
β If you found this useful, consider starring the repository.
```
Thank you for reading
```