0

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?

nbro
  • 39,006
  • 12
  • 98
  • 176
  • I voted to reopen. While a specific code example is given, the double question is general and interesting. – Jaume Oliver Lafont Apr 20 '23 at 06:05
  • @JaumeOliverLafont If you think this is not a programming/technical question, maybe you can then remove the code from the post and reformulate the title as the specific question that is being asked ;) – nbro Apr 20 '23 at 11:12
  • I dared to rewrite the title generalizing from ChatGPT to conversational agents. I am not so sure to delete the code or rather write pseudocode instead. Should that be decided by the OP? – Jaume Oliver Lafont Apr 20 '23 at 13:33
  • I put this question in SO and they (with a toxic language) down voted and closed the question because apparently this question belongs to AI Stack. I don't know where I can get my answer. @JaumeOliverLafont – Amirhossein Rezaei Apr 20 '23 at 14:50

1 Answers1

1

An interesting long interaction (human-bot) can be obtained from asking the bot to "act as a teacher", and prompting for, say, five questions for each of five different subjects (nested loop in natural language programming). This allows for rethinking GPT as General Programmable Tutor.

A natural extension of this between two bots could be prompting one to act as a teacher and the other one as a student, to break the initial symmetry and allow you to simply contemplate the evolution of dialogue.

As for reflection, I wonder whether some artificial consciousness can be made to emerge by letting an agent ask questions about itself to a variety of other agents and make kind of a majority vote, a synthesis from the answers obtained. A natural first question to investigate one's nature in the absence of direct self-observation could be who am I?. With two agents only it seems to be more difficult to gain much knowledge about oneself, because the self-image could be manipulated more easily.