Giter Site home page Giter Site logo

gptvsgpt's Introduction

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

gptvsgpt's People

Contributors

vindiw avatar yoheinakajima avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.