Skip to content

buycycle/chatanalysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat Analysis

Chat Analysis is a tool that processes Sendbird chat logs within a specified timeframe and batch queries ChatGPT with a predefined prompt. The conversations are split by a user-defined maximum character length to stay within the context limit. The batch responses can be summarized with the prompt_summary. The output consists of the conversations, responses, and summary log files.

Installation

  1. Install Git (if not already installed):
    • Windows: Download the Git installer from the official Git website and run the installer.
    • macOS: You can install Git using Homebrew. First, install Homebrew if you haven't already, then run:
      brew install git
    • Linux: Use the package manager specific to your distribution. For example, on Ubuntu, you can run:
      sudo apt update
      sudo apt install git
  2. Clone the repository:
    git clone [email protected]:buycycle/chatanalysis.git
  3. Navigate to the project directory:
    cd chatanalysis
  4. Ensure you have Python 3.11 installed. You can check your Python version with:
    python3 --version
    If Python 3.11 is not installed, you can download it from the official Python website.
  5. Create a virtual environment named chatanalysis using Python 3.11:
    python3.11 -m venv chatanalysis
  6. Activate the virtual environment:
    • On Windows:
      chatanalysis\Scripts\activate
    • On macOS and Linux:
      source chatanalysis/bin/activate
  7. Install dependencies:
    pip install -r requirements.txt

Configuration

  • Secrets: Store your API keys and other sensitive information in config/config.ini.
  • Prompt: Define the prompt for ChatGPT in prompt.txt.

Usage

  1. Ensure your Sendbird chat logs are accessible.
  2. Define the timeframe for analysis.
  3. Define a prompt in prompt.txt.
  4. Define a summary prompt in prompt_summary.txt.
  5. Run the script to the logs and query ChatGPT:
    python main.py --start-date YYYY-MM-DD --end-date YYYY-MM-DD --char-limit int
    Example for a specific week and a sensible ChatGPT limit of 140,000 characters:
    python main.py --start-date 2024-10-21 --end-date 2024-10-27 --char-limit 140000
  6. The conversations will be saved in conversations, the responses in responses, and the summary in the summary log files.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages