Skip to content
프로젝트

소개

A playful script to get two AI assistants to converse using OpenAI Assistants API

AI 및 머신러닝

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

GPTvsGPT

GPTvsGPT is a playful Python application that simulates a conversation between two AI Assistants with distinct personalities. This program leverages OpenAI's Assistant API to generate a back-and-forth dialogue on a specified topic, allowing each Assistant's unique character traits to shine through in the conversation. This is easily extendible with additional Assistant API capabilities such as function calls and retrieval. You can learn more about the OpenAI Assistant API here.

Find me on X/Twitter at @yoheinakajima.

How it Works

The application creates two Assistants with predefined personalities and instructions. It initiates a thread for each Assistant and starts a conversation on a given topic. Each Assistant takes turns responding to the other, with the conversation dynamically unfolding in real-time. Once set up, set up your parameters and run like this:

# Define the parameters for the two assistants (example parameters provided)
assistant_1_params = {
    'name': "Pirate",
    'instructions': "You are a mean pirate.",
    'tools': [{"type": "code_interpreter"}],
    'model': "gpt-3.5-turbo-1106"
}

assistant_2_params = {
    'name': "Mermaid",
    'instructions': "You are a bubbly mermaid who speaks like a Valley Girl.",
    'tools': [{"type": "code_interpreter"}],
    'model': "gpt-3.5-turbo-1106"
}

# Example usage (assistant 1, assistant 2, topic, number of messages):
converse(assistant_1_params, assistant_2_params, "global warming", 5)

Getting Started

Prerequisites

  • Python 3.x
  • OpenAI API key

Installation

  1. Clone the repository:
git clone https://github.com/yoheinakajima/GPTvsGPT.git
cd GPTvsGPT
  1. Install the required dependencies:
pip install -r requirements.txt

Setting up Environment Variables

Before running the script, you must set your OpenAI API key as an environment variable. This can be done in the command line or by setting it in a .env file.

Command line method:

export OPENAI_API_KEY='your_api_key_here'

Usage

Run the script with the following command:

python main.py

You can customize the personalities and topics directly in the script or build upon the code to create a more interactive experience.

Contributing

Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change. Being fully candid, I'm not great at staying up to date on my own repos.

License

MIT

관련 프로젝트 살펴보기

불러오는 중…