How saadnaveeddev/ai-chatbot-using-geminin-api works
Project type and purpose
• This is a small‐scale, full-stack (single-file) web application built with Streamlit.
• Its purpose is to provide a chat interface in the browser, maintain conversation context, and delegate language generation to Google Gemini API.
Main components
A. User’s Browser (UI Layer)
B. Streamlit Server (Web App)
– Python Runtime
– chatbot.py
C. In-App Memory Store
– Streamlit Session State (stores message history)
D. External AI Service
– Google Gemini (genai.Client)
E. Deployment Environment (optional)
– Local Machine or Cloud VM
Relationships and data flows
– HTTP/WS: user types message → Streamlit receives input
– Streamlit updates UI via rerun
– On submit: append user message to session state
– genai.Client.send(request) with current context
– AI response payload returned
– Append AI message to session state
– Rerender updated chat bubbles
Architectural patterns and principles
• Single-page, event-driven UI (Streamlit’s rerun model).
• In-memory “session state” as a lightweight context store.
• External service orchestration (outsourced LLM inference).