I wrote a code for a conversation between 2 ChatGPTs (which I call them agent 1 and agent 2) using poe.com and its reversed engineered API:
import poe
agent_1 = {"token":""}
print("Agent 1: ON")
agent_2 = {"token":""}
print("Agent 2: ON")
client_1 = poe.Client(agent_1["token"])
client_2 = poe.Client(agent_2["token"])
model = "chinchilla"
client_1.purge_conversation(model)
print("Agent 1: Ready")
client_2.purge_conversation(model)
print("Agent 2: Ready")
print("Initial Prompt:")
message = input()
def remove_ai_phrase(sentence):
"""
Removes the phrase "As an AI language model" from a sentence.
"""
ai_phrase = "As an AI language model"
if ai_phrase in sentence:
# Find the end of the sentence (i.e., the position of the last period)
sentence_end = sentence.rfind(".")
# Remove the ai_phrase from the sentence
sentence = sentence[:sentence_end].replace(ai_phrase, "") + sentence[sentence_end:]
return sentence
c = 0
while True:
if c == 0:
message = message
c += 1
print("\n",50*"=")
print("\nAgent 1:")
answer_1 = ""
for chunk in client_1.send_message(model, message):
print(chunk["text_new"], end="", flush=True)
answer_1 += ""+chunk["text_new"]
print("\n")
print("\n",50*"=")
print("\nAgent 2:")
# answer_1 += "\nIn addition..."
answer_1 = remove_ai_phrase(answer_1)
answer_2 = ""
for chunk in client_2.send_message(model, answer_1):
print(chunk["text_new"], end="", flush=True)
answer_2 += ""+chunk["text_new"]
print("\n")
message = answer_2
message = remove_ai_phrase(message)
Based on my few experiments, when I set the initial prompt on something like "discuss the meaning of life", they stuck at complementing each other. But if I set the initial prompt to something short and meaningless like "1", they actually start having conversation on various topics.
How do you think we can make them talk about a specific topic and reflect on each other?