Skip to content

kshitijkutumbe/multimodal-chatbot-chainlit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multimodal chatbot using Chainlit and OpenAI

Overview

This is a robust application that leverages OpenAI's powerful models for processing images and audio, and generating responses via a chat interface. This project is designed to be modular, production-friendly, and deployable using Docker.

Table of Contents

  1. Features
  2. Installation
  3. Usage
  4. Configuration
  5. Project Structure
  6. Logging
  7. Docker Deployment
  8. Contributing
  9. License

Features

  • Image Processing: Converts images to base64 and uses them as inputs for generating responses.
  • Audio Processing: Transcribes audio files using OpenAI's Whisper model.
  • Chat Interface: Interactive chat interface built with Chainlit.
  • Modular Design: Easy to maintain and extend.
  • Production Ready: Includes logging, error handling, and Docker deployment.

Installation

Prerequisites

  • Python 3.9+
  • Docker (for deployment)

Step-by-Step Guide

  1. Clone the repository:

    git clone https://github.com/your-username/my_project.git
    cd my_project
  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 dependencies:

    pip install -r requirements.txt
  4. Set your OpenAI API Key:

    export OPENAI_API_KEY='your_openai_api_key'  # On Windows use `set OPENAI_API_KEY=your_openai_api_key`

Usage

Running the Application

  1. Run the application:

    python app/main.py
  2. Interacting with the Chat Interface:

    • Upload images or audio files.
    • Type your query and get responses generated by OpenAI's models.

Configuration

The configuration settings for this project are managed using a dataclass in the config.py file.

Project Structure

The project is structured as follows:

  • app/: Contains the main application code.
    • __init__.py
    • main.py: Contains the main application logic.
    • api.py: Handles interactions with the OpenAI API.
    • utils.py: Includes utility functions.
    • config.py: Manages configuration settings.
    • logger.py: Configures logging settings.
  • Dockerfile: Defines the Docker image configuration.
  • requirements.txt: Lists the Python dependencies.
  • template.py: Script to create the project structure.

Logging

Logging is configured using the logger.py module. Logs are written to the console with an INFO level.

Docker Deployment

To deploy the application using Docker, use the following steps:

   docker build -t my_project .
   docker run -p 8000:8000 my_project

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Multimodal chatbot using chainlit and openai

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published