Standup Comedians
Multi-Agent Conversation and Stand up ComedyΒΆ
This guide walks you through creating a conversational flow in JupyterLab using the Waldiez extension, where two agents, "Joe" and "Cathy," simulate a standup comedy exchange. We will configure an OpenAI model (GPT-3.5-turbo) for this flow and observe the interaction between the agents.
Using user input to start the conversationΒΆ
In this example, we will set up a flow where the user initiates the conversation by providing an initial message. The agents, Joe and Cathy, will then respond to each other based on the user input and the previous agent's message.
Open JupyterLab and Launch WaldiezΒΆ
- Start JupyterLab.
- In the launcher, under the Waldiez section, select the Waldiez icon to create a new
.waldiez
file. This opens a new interface for setting up agents and configuring the flow.
Add a ModelΒΆ
- In the Waldiez interface, click on
Add model
to add a new model configuration. - Fill out the configuration fields:
- Name:
gpt-3.5-turbo
- Model Type: Select
OpenAI
. - API Key: Enter your OpenAI API key (make sure you have GPT-3.5-turbo access).
- Name:
- Optionally adjust Advanced Settings like Temperature and Max Tokens as per your needs.
- Click Save to add the model to your flow.
Create AgentsΒΆ
Agent 1: CathyΒΆ
- Under the
Agents
section, drag a new agent onto the canvas. - Name the agent Cathy.
- Set the description to "Cathy is a standup comedian."
- In the System Message field, enter:
Your name is Cathy and you are a standup comedian.
- Link the
gpt-3.5-turbo
model to Cathy by selecting it in the Models tab. - Save the configuration.
Agent 2: JoeΒΆ
- Add another agent to the canvas and name it Joe.
- Set the description to "Joe is a standup comedian."
- In the System Message field, enter:
Your name is Joe and you are a standup comedian. Start the next joke from the previous punchline.
- Link the
gpt-3.5-turbo
model to Joe. - Save the configuration.
Link AgentsΒΆ
- In the Waldiez canvas, create a chat link between Joe and Cathy.
- Click on the link and configure the following settings:
- Chat Type: Leave this as is: "Chat."
- Name:
Joe => Cathy
. - Max Turns: Specify the number of turns for their exchange (e.g., 3).
- Click Save to apply the settings.
Update the Flow's settingsΒΆ
- Open the Edit Flow settings.
- Name the flow, e.g., Standup comedians 1, and add a description like "Standup comedians with user input."
- Add the chat link
Joe => Cathy
to the flow sequence to specify the conversation order. - Save the flow configuration.
Initiate the ChatΒΆ
- Click on the Run button to start the flow.
Start the flow by providing an initial message in the User Input window, such as:
Hi Cathy, I'm Joe. Let's keep the jokes rolling!
Click Submit to begin the conversation.
Observe the Conversation in LogsΒΆ
- The Logs window will display the real-time exchange between Joe and Cathy, where each agent responds based on the previous joke or statement, simulating a standup comedy routine.
Review and Export ResultsΒΆ
- After the conversation, various CSV logs (e.g.,
agents.csv
,chat_completions.csv
) are saved in the file explorer. You can analyze these logs to evaluate the flow and refine the agent interactions.
Skipping user inputΒΆ
To skip user input and directly start the conversation, you can modify the chat link settings to start with a specific message. Set the message type as "Text" and set the desired starting message to the content field. This way, the agents will begin the conversation without waiting for user input.
Using a termination conditionΒΆ
You can also disable the "max turns" setting in the chat link and use a termination condition to end the conversation based on specific criteria. Specify the termination settings in each agent's configuration to control the flow's duration and completion.
Also, make sure you update the agents' system messages to reflect the termination condition.
Files used in this example:
- Using User input: Standup Comedians 1.waldiez
- Without user input: Standup Comedians 2.waldiez
- Without user input and max turns (termination): Standup Comedians 3.waldiez