Skip to content

A chatbot using Streamlit and Google Gemini 2 flash with chat sessions

Notifications You must be signed in to change notification settings

ssreeramj/chatbot-with-chat-sessions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Streamlit Gemini Chatbot with sessions

This project demonstrates how to build a chatbot using Streamlit and Google's Generative AI model. The chatbot can save and load past chat sessions, generate chat session names, and provide helpful responses to user inputs.

Chatbot Interface

Table of Contents

Installation

  1. Clone the repository:

    git clone https://github.com/ssreeramj/chatbot-with-chat-sessions.git
    cd chatbot-with-chat-sessions
  2. Create a virtual environment and activate it:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install the required dependencies:

    pip install -r requirements.txt
  4. Set up environment variables:

    Create a .env file in the root directory and add your Google API key:

    GOOGLE_API_KEY=<your_google_api_key>

Usage

  1. Run the Streamlit app:

    streamlit run app.py
  2. Interact with the chatbot:

    Open your browser and go to http://localhost:8501 to interact with the chatbot. You can start a new chat session, view past sessions, and get responses from the AI model.

Project Structure

chatbot-with-chat-sessions/
├── app.py
├── utils.py
├── requirements.txt
├── .env.example
├── README.md
└── chat-sessions/
  • app.py: Main application file that sets up the Streamlit interface and handles user interactions.
  • utils.py: Utility functions for managing chat sessions, formatting chat history, and generating chat session names.
  • requirements.txt: List of Python dependencies required for the project.
  • .env.example: Example environment file to set up your API keys.
  • README.md: This file.
  • chat-sessions/: Directory to store chat session data.

Features

  • Chatbot Interface: A user-friendly interface to interact with the chatbot.
  • Session Management: Save and load past chat sessions.
  • Dynamic Chat Titles: Generate unique chat session names based on user input.
  • Streaming Responses: Display AI responses in a streaming manner for a more interactive experience.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes. Ensure that your code follows the project's coding standards and includes appropriate tests.

About

A chatbot using Streamlit and Google Gemini 2 flash with chat sessions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages