🧠 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
.
├── app.py # Streamlit UI
├── chatbot_stremlit.py # LangChain + Gemini logic
├── requirements.txt
├── .gitignore
├── README.md
└── .env # API keys (created by user)
-
🧠 Session-based Conversational Memory
Maintains chat history usingst.session_state -
⚡ Streaming Responses
Uses LangChain.stream()for live output -
🧩 Clean Architecture
chatbot_stremlit.py→ AI logicapp.py→ UI and interaction
-
🔐 Secure API Management
Uses.envfile withpython-dotenv
- Language: Python 3.10+
- LLM: Google Gemini (
gemini-2.5-flash-lite) - Frameworks: LangChain (LCEL), Streamlit
- Utilities: python-dotenv
git clone https://github.com/DevDoshi19/ChatBot_using_Basic_LangChain.gitpython -m venv venv
source venv/bin/activate # macOS / Linux
venv\Scripts\activate # Windowspip install -r requirements.txtCreate a file named .env in the root directory.
GOOGLE_API_KEY=your_google_gemini_api_key_here.env to GitHub.
streamlit run app.pyThe chatbot will open in your browser.
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
streamlit
langchain
langchain-google-genai
python-dotenv- Using LangChain Expression Language (LCEL)
- Handling Streamlit reruns via Session State
- Implementing real-time LLM streaming
- Structuring AI apps cleanly and scalably
Dev Doshi B.Tech | AI / ML | LangChain | Streamlit | Generative AI
chatbot_langchain.-.Made.with.Clipchamp.mp4
⭐ If you found this useful, consider starring the repository.
Thank you for reading

