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.
- 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
- Clone the repository:
git clone [email protected]:buycycle/chatanalysis.git
- Navigate to the project directory:
cd chatanalysis
- Ensure you have Python 3.11 installed. You can check your Python version with:
If Python 3.11 is not installed, you can download it from the official Python website.
python3 --version
- Create a virtual environment named
chatanalysis
using Python 3.11:python3.11 -m venv chatanalysis
- Activate the virtual environment:
- On Windows:
chatanalysis\Scripts\activate
- On macOS and Linux:
source chatanalysis/bin/activate
- On Windows:
- Install dependencies:
pip install -r requirements.txt
- Secrets: Store your API keys and other sensitive information in
config/config.ini
. - Prompt: Define the prompt for ChatGPT in
prompt.txt
.
- Ensure your Sendbird chat logs are accessible.
- Define the timeframe for analysis.
- Define a prompt in
prompt.txt
. - Define a summary prompt in
prompt_summary.txt
. - Run the script to the logs and query ChatGPT:
Example for a specific week and a sensible ChatGPT limit of 140,000 characters:
python main.py --start-date YYYY-MM-DD --end-date YYYY-MM-DD --char-limit int
python main.py --start-date 2024-10-21 --end-date 2024-10-27 --char-limit 140000
- The conversations will be saved in
conversations
, the responses inresponses
, and the summary in thesummary
log files.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.