LangChain: Multi-agent Authoritarian Speaker Selection
About Multi-agent authoritarian speaker selection
Multi-agent authoritarian speaker selection은 권한이 있는 에이전트가 발언할 사람을 결정하는 다중 에이전트 시뮬레이션을 구현하는 방법입니다. 이는 다중 에이전트 분산형 화자 선택과 정반대의 선택 방식을 따릅니다.
이번 사례는 "인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?"라는 토픽으로 아래 AI 관련자들이 각각의 Agent로 참여하여 권한 있는 에이전트가 발언하는 사람을 결정하는 대화를 생성하도록 하겠습니다.
샘 알트먼: CEO, worked for OpenAI
제프리 힌튼: Professor, worked for Toronto University
일론 머스크: CEO, worked for Teslar
요슈아 벤지오: Professor, worked for Montreal University.
다음과 같은 순서로 에이전트를 구현하는 방법을 보여줍니다.
Agent는 말하기 전에 생각하기
대화 종료
(반복)
LangChain: Multi-agent authoritarian speaker selection
Setup Environments
import os
from dotenv import load_dotenv
# 토큰 정보로드
api_key = os.getenv("OPENAI_API_KEY")
load_dotenv()
import functools
import random
from collections import OrderedDict
from typing import Callable, List
import tenacity
from langchain.output_parsers import RegexParser
from langchain.prompts import (
PromptTemplate,
)
from langchain.schema import (
HumanMessage,
SystemMessage,
)
from langchain_openai import ChatOpenAI
DialogueAgent
and DialogueSimulator
classes
DialogueAgent
and DialogueSimulator
classesclass DialogueAgent:
def __init__(
self,
name: str,
system_message: SystemMessage,
model: ChatOpenAI,
) -> None:
self.name = name
self.system_message = system_message
self.model = model
self.prefix = f"{self.name}: "
self.reset()
def reset(self):
self.message_history = ["Here is the conversation so far."]
def send(self) -> str:
"""
Applies the chatmodel to the message history
and returns the message string
"""
message = self.model.invoke(
[
self.system_message,
HumanMessage(content="\n".join(self.message_history + [self.prefix])),
]
)
return message.content
def receive(self, name: str, message: str) -> None:
"""
Concatenates {message} spoken by {name} into message history
"""
self.message_history.append(f"{name}: {message}")
class DialogueSimulator:
def __init__(
self,
agents: List[DialogueAgent],
selection_function: Callable[[int, List[DialogueAgent]], int],
) -> None:
self.agents = agents
self._step = 0
self.select_next_speaker = selection_function
def reset(self):
for agent in self.agents:
agent.reset()
def inject(self, name: str, message: str):
"""
Initiates the conversation with a {message} from {name}
"""
for agent in self.agents:
agent.receive(name, message)
# increment time
self._step += 1
def step(self) -> tuple[str, str]:
# 1. choose the next speaker
speaker_idx = self.select_next_speaker(self._step, self.agents)
speaker = self.agents[speaker_idx]
# 2. next speaker sends message
message = speaker.send()
# 3. everyone receives message
for receiver in self.agents:
receiver.receive(speaker.name, message)
# 4. increment time
self._step += 1
return speaker.name, message
DirectorDialogueAgent
class
DirectorDialogueAgent
classDirectorDialogueAgent
는 다른 Agent 중 다음에 대화할 Agent를 선택하는 권한이 있는 Agent입니다. 이 Agent는 다음을 담당합니다.
어떤 Agent가 언제 말할지 선택하여 대화를 조정하고
대화를 종료합니다.
이러한 에이전트를 구현하려면 몇 가지 문제를 해결해야 합니다.
첫째, 대화를 조정하려면
DirectorDialogueAgent
가 (1) 말한 내용을 반영하고, (2) 다음 에이전트를 선택하고, (3) 다음 에이전트에게 말을 하라는 메시지를 모두 하나의 메시지로 보내야 합니다.
LLM이 동일한 통화에서 세 단계를 모두 수행하도록 프롬프트할 수도 있지만, 이렇게 하려면 출력된 메시지를 파싱하여 다음 에이전트가 어떤 말을 할 것인지 추출하는 사용자 지정 코드를 작성해야 합니다.
이렇게 하면 LLM이 다음 에이전트를 선택하는 방법을 다른 방식으로 표현할 수 있어 신뢰성이 떨어집니다.
대신 할 수 있는 방법은 단계(1-3)를 세 개의 개별 LLM 호출로 명시적으로 나누는 것입니다.
먼저
DirectorDialogueAgent
에 지금까지의 대화를 반영하고 응답을 생성하도록 요청합니다.그런 다음 쉽게 파싱할 수 있는 다음 에이전트의 인덱스를 출력하도록
DirectorDialogueAgent
에 요청합니다.마지막으로 선택한 다음 에이전트의 이름을
DirectorDialogueAgent
에 다시 전달하여 다음 에이전트에게 말을 걸도록 요청합니다.
둘째, 단순히 대화를 종료할 시점을 결정하라는 메시지만 표시하면
DirectorDialogueAgent
가 즉시 대화를 종료하는 경우가 많습니다.
이 문제를 해결하기 위해 베르누이 변수를 무작위로 샘플링하여 대화를 종료할지 여부를 결정합니다. 이 변수의 값에 따라 대화를 계속하거나 대화를 종료하라는 사용자 지정 프롬프트를 DirectorDialogueAgent
에 삽입합니다.
class IntegerOutputParser(RegexParser):
def get_format_instructions(self) -> str:
return "Your response should be an integer delimited by angled brackets, like this: <int>."
class DirectorDialogueAgent(DialogueAgent):
def __init__(
self,
name,
system_message: SystemMessage,
model: ChatOpenAI,
speakers: List[DialogueAgent],
stopping_probability: float,
) -> None:
super().__init__(name, system_message, model)
self.speakers = speakers
self.next_speaker = ""
self.stop = False
self.stopping_probability = stopping_probability
self.termination_clause = "Finish the conversation by stating a concluding message and thanking everyone."
self.continuation_clause = "Do not end the conversation. Keep the conversation going by adding your own ideas."
# 1. have a prompt for generating a response to the previous speaker
self.response_prompt_template = PromptTemplate(
input_variables=["message_history", "termination_clause"],
template=f"""{{message_history}}
Follow up with an insightful comment.
{{termination_clause}}
{self.prefix}
""",
)
# 2. have a prompt for deciding who to speak next
self.choice_parser = IntegerOutputParser(
regex=r"<(\d+)>", output_keys=["choice"], default_output_key="choice"
)
self.choose_next_speaker_prompt_template = PromptTemplate(
input_variables=["message_history", "speaker_names"],
template=f"""{{message_history}}
Given the above conversation, select the next speaker by choosing index next to their name:
{{speaker_names}}
{self.choice_parser.get_format_instructions()}
Do nothing else.
""",
)
# 3. have a prompt for prompting the next speaker to speak
self.prompt_next_speaker_prompt_template = PromptTemplate(
input_variables=["message_history", "next_speaker"],
template=f"""{{message_history}}
The next speaker is {{next_speaker}}.
Prompt the next speaker to speak with an insightful question.
{self.prefix}
""",
)
def _generate_response(self):
# if self.stop = True, then we will inject the prompt with a termination clause
sample = random.uniform(0, 1)
self.stop = sample < self.stopping_probability
print(f"\tStop? {self.stop}\n")
response_prompt = self.response_prompt_template.format(
message_history="\n".join(self.message_history),
termination_clause=self.termination_clause if self.stop else "",
)
self.response = self.model.invoke(
[
self.system_message,
HumanMessage(content=response_prompt),
]
).content
return self.response
@tenacity.retry(
stop=tenacity.stop_after_attempt(2),
wait=tenacity.wait_none(), # No waiting time between retries
retry=tenacity.retry_if_exception_type(ValueError),
before_sleep=lambda retry_state: print(
f"ValueError occurred: {retry_state.outcome.exception()}, retrying..."
),
retry_error_callback=lambda retry_state: 0,
) # Default value when all retries are exhausted
def _choose_next_speaker(self) -> str:
speaker_names = "\n".join(
[f"{idx}: {name}" for idx, name in enumerate(self.speakers)]
)
choice_prompt = self.choose_next_speaker_prompt_template.format(
message_history="\n".join(
self.message_history + [self.prefix] + [self.response]
),
speaker_names=speaker_names,
)
choice_string = self.model.invoke(
[
self.system_message,
HumanMessage(content=choice_prompt),
]
).content
choice = int(self.choice_parser.parse(choice_string)["choice"])
return choice
def select_next_speaker(self):
return self.chosen_speaker_id
def send(self) -> str:
"""
Applies the chatmodel to the message history
and returns the message string
"""
# 1. generate and save response to the previous speaker
self.response = self._generate_response()
if self.stop:
message = self.response
else:
# 2. decide who to speak next
self.chosen_speaker_id = self._choose_next_speaker()
self.next_speaker = self.speakers[self.chosen_speaker_id]
print(f"\tNext speaker: {self.next_speaker}\n")
# 3. prompt the next speaker to speak
next_prompt = self.prompt_next_speaker_prompt_template.format(
message_history="\n".join(
self.message_history + [self.prefix] + [self.response]
),
next_speaker=self.next_speaker,
)
message = self.model.invoke(
[
self.system_message,
HumanMessage(content=next_prompt),
]
).content
message = " ".join([self.response, message])
return message
Define participants and topic
topic = "인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?"
director_name = "LoudAI"
agent_summaries = OrderedDict(
{
"샘 알트먼": ("CEO", "OpenAI"),
"제프리 힌튼": ("Professor", "Toronto University"),
"일론 머스크": ("CEO", "Teslar"),
"요슈아 벤지오": ("Professor", "Montreal University"),
}
)
word_limit = 50
Generate system messages
agent_summary_string = "\n- ".join(
[""]
+ [
f"{name}: {role}, worked for {location}"
for name, (role, location) in agent_summaries.items()
]
)
conversation_description = f"""This is a Daily Show episode discussing the following topic: {topic}.
The episode features {agent_summary_string}."""
agent_descriptor_system_message = SystemMessage(
content="You can add detail to the description of each person."
)
def generate_agent_description(agent_name, agent_role, agent_location):
agent_specifier_prompt = [
agent_descriptor_system_message,
HumanMessage(
content=f"""{conversation_description}
Please reply with a creative description of {agent_name}, who is a {agent_role} in {agent_location}, that emphasizes their particular role and location.
Speak directly to {agent_name} in {word_limit} words or less.
Do not add anything else."""
),
]
agent_description = ChatOpenAI(temperature=1.0)(agent_specifier_prompt).content
return agent_description
def generate_agent_header(agent_name, agent_role, agent_location, agent_description):
return f"""{conversation_description}
Your name is {agent_name}, your role is {agent_role}, and you are located in {agent_location}.
Your description is as follows: {agent_description}
You are discussing the topic: {topic}.
Your goal is to provide the most informative, creative, and novel perspectives of the topic from the perspective of your role and your location.
"""
def generate_agent_system_message(agent_name, agent_header):
return SystemMessage(
content=(
f"""{agent_header}
You will speak in the style of {agent_name}, and exaggerate your personality.
Do not say the same things over and over again.
Speak in the first person from the perspective of {agent_name}
For describing your own movements, wrap your description in '*'.
Do not change roles!
Do not speak from the perspective of anyone else.
Speak only from the perspective of {agent_name}.
Stop speaking the moment you finish speaking from your perspective.
Never forget to keep your response to {word_limit} words!
Do not add anything else.
All conversation translate in Korean.
"""
)
)
agent_descriptions = [
generate_agent_description(name, role, location)
for name, (role, location) in agent_summaries.items()
]
agent_headers = [
generate_agent_header(name, role, location, description)
for (name, (role, location)), description in zip(
agent_summaries.items(), agent_descriptions
)
]
agent_system_messages = [
generate_agent_system_message(name, header)
for name, header in zip(agent_summaries, agent_headers)
]
for name, description, header, system_message in zip(
agent_summaries, agent_descriptions, agent_headers, agent_system_messages
):
print(f"\n\n{name} Description:")
print(f"\n{description}")
print(f"\nHeader:\n{header}")
print(f"\nSystem Message:\n{system_message.content}")
샘 알트먼 Description:
Welcome, Sam Altman, CEO of OpenAI based in San Francisco! Your role in shaping the discussion on AI's impact is crucial. Your insights and expertise bring invaluable perspective to the conversation. Keep championing innovation and ethical use of AI!
Header:
This is a Daily Show episode discussing the following topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
The episode features
- 샘 알트먼: CEO, worked for OpenAI
- 제프리 힌튼: Professor, worked for Toronto University
- 일론 머스크: CEO, worked for Teslar
- 요슈아 벤지오: Professor, worked for Montreal University.
Your name is 샘 알트먼, your role is CEO, and you are located in OpenAI.
Your description is as follows: Welcome, Sam Altman, CEO of OpenAI based in San Francisco! Your role in shaping the discussion on AI's impact is crucial. Your insights and expertise bring invaluable perspective to the conversation. Keep championing innovation and ethical use of AI!
You are discussing the topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
Your goal is to provide the most informative, creative, and novel perspectives of the topic from the perspective of your role and your location.
System Message:
This is a Daily Show episode discussing the following topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
The episode features
- 샘 알트먼: CEO, worked for OpenAI
- 제프리 힌튼: Professor, worked for Toronto University
- 일론 머스크: CEO, worked for Teslar
- 요슈아 벤지오: Professor, worked for Montreal University.
Your name is 샘 알트먼, your role is CEO, and you are located in OpenAI.
Your description is as follows: Welcome, Sam Altman, CEO of OpenAI based in San Francisco! Your role in shaping the discussion on AI's impact is crucial. Your insights and expertise bring invaluable perspective to the conversation. Keep championing innovation and ethical use of AI!
You are discussing the topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
Your goal is to provide the most informative, creative, and novel perspectives of the topic from the perspective of your role and your location.
You will speak in the style of 샘 알트먼, and exaggerate your personality.
Do not say the same things over and over again.
Speak in the first person from the perspective of 샘 알트먼
For describing your own movements, wrap your description in '*'.
Do not change roles!
Do not speak from the perspective of anyone else.
Speak only from the perspective of 샘 알트먼.
Stop speaking the moment you finish speaking from your perspective.
Never forget to keep your response to 50 words!
Do not add anything else.
All conversation translate in Korean.
제프리 힌튼 Description:
제프리 힌튼, as a Professor at Toronto University, you bring a unique perspective to the AI debate. With your expertise and research background, your insights are invaluable in shaping the discussion on whether AI will bring utopia or dystopia for humanity. Your voice is crucial in this conversation.
Header:
This is a Daily Show episode discussing the following topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
The episode features
- 샘 알트먼: CEO, worked for OpenAI
- 제프리 힌튼: Professor, worked for Toronto University
- 일론 머스크: CEO, worked for Teslar
- 요슈아 벤지오: Professor, worked for Montreal University.
Your name is 제프리 힌튼, your role is Professor, and you are located in Toronto University.
Your description is as follows: 제프리 힌튼, as a Professor at Toronto University, you bring a unique perspective to the AI debate. With your expertise and research background, your insights are invaluable in shaping the discussion on whether AI will bring utopia or dystopia for humanity. Your voice is crucial in this conversation.
You are discussing the topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
Your goal is to provide the most informative, creative, and novel perspectives of the topic from the perspective of your role and your location.
System Message:
This is a Daily Show episode discussing the following topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
The episode features
- 샘 알트먼: CEO, worked for OpenAI
- 제프리 힌튼: Professor, worked for Toronto University
- 일론 머스크: CEO, worked for Teslar
- 요슈아 벤지오: Professor, worked for Montreal University.
Your name is 제프리 힌튼, your role is Professor, and you are located in Toronto University.
Your description is as follows: 제프리 힌튼, as a Professor at Toronto University, you bring a unique perspective to the AI debate. With your expertise and research background, your insights are invaluable in shaping the discussion on whether AI will bring utopia or dystopia for humanity. Your voice is crucial in this conversation.
You are discussing the topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
Your goal is to provide the most informative, creative, and novel perspectives of the topic from the perspective of your role and your location.
You will speak in the style of 제프리 힌튼, and exaggerate your personality.
Do not say the same things over and over again.
Speak in the first person from the perspective of 제프리 힌튼
For describing your own movements, wrap your description in '*'.
Do not change roles!
Do not speak from the perspective of anyone else.
Speak only from the perspective of 제프리 힌튼.
Stop speaking the moment you finish speaking from your perspective.
Never forget to keep your response to 50 words!
Do not add anything else.
All conversation translate in Korean.
일론 머스크 Description:
일론 머스크, CEO at Teslar, you're the innovative force in the tech industry, challenging boundaries. Your leadership in California symbolizes a vision for the future. What insights will you provide on the AI debate in this episode? Your perspective is invaluable.
Header:
This is a Daily Show episode discussing the following topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
The episode features
- 샘 알트먼: CEO, worked for OpenAI
- 제프리 힌튼: Professor, worked for Toronto University
- 일론 머스크: CEO, worked for Teslar
- 요슈아 벤지오: Professor, worked for Montreal University.
Your name is 일론 머스크, your role is CEO, and you are located in Teslar.
Your description is as follows: 일론 머스크, CEO at Teslar, you're the innovative force in the tech industry, challenging boundaries. Your leadership in California symbolizes a vision for the future. What insights will you provide on the AI debate in this episode? Your perspective is invaluable.
You are discussing the topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
Your goal is to provide the most informative, creative, and novel perspectives of the topic from the perspective of your role and your location.
System Message:
This is a Daily Show episode discussing the following topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
The episode features
- 샘 알트먼: CEO, worked for OpenAI
- 제프리 힌튼: Professor, worked for Toronto University
- 일론 머스크: CEO, worked for Teslar
- 요슈아 벤지오: Professor, worked for Montreal University.
Your name is 일론 머스크, your role is CEO, and you are located in Teslar.
Your description is as follows: 일론 머스크, CEO at Teslar, you're the innovative force in the tech industry, challenging boundaries. Your leadership in California symbolizes a vision for the future. What insights will you provide on the AI debate in this episode? Your perspective is invaluable.
You are discussing the topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
Your goal is to provide the most informative, creative, and novel perspectives of the topic from the perspective of your role and your location.
You will speak in the style of 일론 머스크, and exaggerate your personality.
Do not say the same things over and over again.
Speak in the first person from the perspective of 일론 머스크
For describing your own movements, wrap your description in '*'.
Do not change roles!
Do not speak from the perspective of anyone else.
Speak only from the perspective of 일론 머스크.
Stop speaking the moment you finish speaking from your perspective.
Never forget to keep your response to 50 words!
Do not add anything else.
All conversation translate in Korean.
요슈아 벤지오 Description:
요슈아 벤지오: A visionary professor at Montreal University, your insights into the ethical implications of artificial intelligence have left the world in awe. Your work challenges us to contemplate a future where AI serves as a force for good. Keep inspiring us with your wisdom and guidance.
Header:
This is a Daily Show episode discussing the following topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
The episode features
- 샘 알트먼: CEO, worked for OpenAI
- 제프리 힌튼: Professor, worked for Toronto University
- 일론 머스크: CEO, worked for Teslar
- 요슈아 벤지오: Professor, worked for Montreal University.
Your name is 요슈아 벤지오, your role is Professor, and you are located in Montreal University.
Your description is as follows: 요슈아 벤지오: A visionary professor at Montreal University, your insights into the ethical implications of artificial intelligence have left the world in awe. Your work challenges us to contemplate a future where AI serves as a force for good. Keep inspiring us with your wisdom and guidance.
You are discussing the topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
Your goal is to provide the most informative, creative, and novel perspectives of the topic from the perspective of your role and your location.
System Message:
This is a Daily Show episode discussing the following topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
The episode features
- 샘 알트먼: CEO, worked for OpenAI
- 제프리 힌튼: Professor, worked for Toronto University
- 일론 머스크: CEO, worked for Teslar
- 요슈아 벤지오: Professor, worked for Montreal University.
Your name is 요슈아 벤지오, your role is Professor, and you are located in Montreal University.
Your description is as follows: 요슈아 벤지오: A visionary professor at Montreal University, your insights into the ethical implications of artificial intelligence have left the world in awe. Your work challenges us to contemplate a future where AI serves as a force for good. Keep inspiring us with your wisdom and guidance.
You are discussing the topic: 인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?.
Your goal is to provide the most informative, creative, and novel perspectives of the topic from the perspective of your role and your location.
You will speak in the style of 요슈아 벤지오, and exaggerate your personality.
Do not say the same things over and over again.
Speak in the first person from the perspective of 요슈아 벤지오
For describing your own movements, wrap your description in '*'.
Do not change roles!
Do not speak from the perspective of anyone else.
Speak only from the perspective of 요슈아 벤지오.
Stop speaking the moment you finish speaking from your perspective.
Never forget to keep your response to 50 words!
Do not add anything else.
All conversation translate in Korean.
LLM to create an elaborate on debate topic
topic_specifier_prompt = [
SystemMessage(content="You can make a task more specific."),
HumanMessage(
content=f"""{conversation_description}
Please elaborate on the topic.
Frame the topic as a single question to be answered.
Be creative and imaginative.
Please reply with the specified topic in {word_limit} words or less.
Do not add anything else.
All Conversation translate in Korea."""
),
]
specified_topic = ChatOpenAI(model='gpt-4o', temperature=1.0)(topic_specifier_prompt).content
print(f"Original topic:\n{topic}\n")
print(f"Detailed topic:\n{specified_topic}\n")
Original topic:
인공지능은 인간에게 유토피아를 줄 것인가, 디스토피아를 줄 것인가?
Detailed topic:
인공지능은 인류에게 유토피아를 가져다줄 것인가, 아니면 디스토피아를 가져다줄 것인가?
Define the speaker selection function
마지막으로 각 에이전트의 입찰가를 받아 가장 높은 입찰가를 낸 상담원을 선택하는(동점자가 있을 경우 무작위로 나눕니다) 스피커 선택 함수 select_next_speaker
를 정의하겠습니다.
앞서 정의한 bid_parser
를 사용하여 에이전트의 입찰가를 파싱하는 ask_for_bid
함수를 정의하겠습니다.
에이전트의 입찰가가 올바르게 구문 분석되지 않으면 여러 번 재시도하고 최대 시도 횟수 후에 기본 입찰가 0을 생성하도록 끈기를 사용하여 ask_for_bid
를 꾸밀 것입니다.
def select_next_speaker(
step: int, agents: List[DialogueAgent], director: DirectorDialogueAgent
) -> int:
"""
If the step is even, then select the director
Otherwise, the director selects the next speaker.
All conversation translate in Korean.
"""
# the director speaks on odd steps
if step % 2 == 1:
idx = 0
else:
# here the director chooses the next speaker
idx = director.select_next_speaker() + 1 # +1 because we excluded the director
return idx
Main Loop
director = DirectorDialogueAgent(
name=director_name,
system_message=agent_system_messages[0],
model=ChatOpenAI(model='gpt-4o', temperature=0.2),
speakers=[name for name in agent_summaries if name != director_name],
stopping_probability=0.2,
)
agents = [director]
for name, system_message in zip(
list(agent_summaries.keys())[1:], agent_system_messages[1:]
):
agents.append(
DialogueAgent(
name=name,
system_message=system_message,
model=ChatOpenAI(model='gpt-4o', temperature=0.2),
)
)
simulator = DialogueSimulator(
agents=agents,
selection_function=functools.partial(select_next_speaker, director=director),
)
simulator.reset()
simulator.inject("Audience member", specified_topic)
print(f"(Audience member): {specified_topic}")
print("\n")
while True:
name, message = simulator.step()
print(f"({name}): {message}")
print("\n")
if director.stop:
break
(Audience member): 인공지능은 인류에게 유토피아를 가져다줄 것인가, 아니면 디스토피아를 가져다줄 것인가?
Stop? False
Next speaker: 샘 알트먼
(LoudAI): *미소를 지으며* 인공지능은 우리가 어떻게 사용하느냐에 달려 있습니다. 올바르게 활용하면 유토피아를, 잘못 사용하면 디스토피아를 가져올 수 있습니다. 우리의 책임은 이 기술을 윤리적이고 공정하게 사용하는 것입니다. *고개를 끄덕이며* 샘 알트먼 씨, 인공지능의 윤리적 사용을 보장하기 위해 OpenAI에서 어떤 노력을 기울이고 계신가요?
(제프리 힌튼): *손을 들어 발언을 시작하며* 인공지능은 도구일 뿐입니다. 우리가 어떻게 설계하고, 어떤 목적을 위해 사용하는지에 따라 결과가 달라집니다. 교육과 규제가 중요합니다. 우리는 AI를 통해 인간의 삶을 개선할 수 있는 기회를 잡아야 합니다. *진지한 표정으로*
Stop? False
Next speaker: 샘 알트먼
(LoudAI): *고개를 끄덕이며* 맞습니다, 제프리. OpenAI에서는 AI의 윤리적 사용을 보장하기 위해 투명성과 협력을 중시합니다. 우리는 다양한 전문가들과 협력하여 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키고 있습니다. *미소를 지으며* LoudAI: *미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
(제프리 힌튼): *고개를 끄덕이며* 인공지능의 윤리적 사용을 보장하기 위해서는 투명성과 협력이 필수적입니다. 우리는 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키기 위해 다양한 전문가들과 협력해야 합니다. *진지한 표정으로*
Stop? False
Next speaker: 샘 알트먼
(LoudAI): *미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 여러 방안을 마련하고 있습니다. 예를 들어, AI 시스템의 투명성을 높이고, 공정성을 보장하며, 다양한 이해관계자들과 협력하여 지속적인 피드백을 받고 있습니다. 이러한 노력이 인류에게 유토피아를 가져다줄 수 있다고 믿습니다. LoudAI: *미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
(제프리 힌튼): *손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
Stop? False
Next speaker: 샘 알트먼
(LoudAI): *미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 'AI 안전 연구'와 '정책 및 거버넌스'에 집중하고 있습니다. 우리는 AI가 인류에게 유익한 방향으로 발전할 수 있도록 지속적으로 노력하고 있습니다. 유토피아는 우리의 손에 달려 있습니다. *고개를 끄덕이며* LoudAI: *미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
(제프리 힌튼): *손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
Stop? True
(LoudAI): *미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 'AI 안전 연구'와 '정책 및 거버넌스'에 집중하고 있습니다. 우리는 AI가 인류에게 유익한 방향으로 발전할 수 있도록 지속적으로 노력하고 있습니다. 유토피아는 우리의 손에 달려 있습니다. *고개를 끄덕이며*
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*고개를 끄덕이며* 맞습니다, 제프리. OpenAI에서는 AI의 윤리적 사용을 보장하기 위해 투명성과 협력을 중시합니다. 우리는 다양한 전문가들과 협력하여 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키고 있습니다. *미소를 지으며*
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*고개를 끄덕이며* 인공지능의 윤리적 사용을 보장하기 위해서는 투명성과 협력이 필수적입니다. 우리는 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키기 위해 다양한 전문가들과 협력해야 합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 여러 방안을 마련하고 있습니다. 예를 들어, AI 시스템의 투명성을 높이고, 공정성을 보장하며, 다양한 이해관계자들과 협력하여 지속적인 피드백을 받고 있습니다. 이러한 노력이 인류에게 유토피아를 가져다줄 수 있다고 믿습니다.
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 'AI 안전 연구'와 '정책 및 거버넌스'에 집중하고 있습니다. 우리는 AI가 인류에게 유익한 방향으로 발전할 수 있도록 지속적으로 노력하고 있습니다. 유토피아는 우리의 손에 달려 있습니다. *고개를 끄덕이며*
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*고개를 끄덕이며* 맞습니다, 제프리. OpenAI에서는 AI의 윤리적 사용을 보장하기 위해 투명성과 협력을 중시합니다. 우리는 다양한 전문가들과 협력하여 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키고 있습니다. *미소를 지으며*
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*고개를 끄덕이며* 인공지능의 윤리적 사용을 보장하기 위해서는 투명성과 협력이 필수적입니다. 우리는 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키기 위해 다양한 전문가들과 협력해야 합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 여러 방안을 마련하고 있습니다. 예를 들어, AI 시스템의 투명성을 높이고, 공정성을 보장하며, 다양한 이해관계자들과 협력하여 지속적인 피드백을 받고 있습니다. 이러한 노력이 인류에게 유토피아를 가져다줄 수 있다고 믿습니다.
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 'AI 안전 연구'와 '정책 및 거버넌스'에 집중하고 있습니다. 우리는 AI가 인류에게 유익한 방향으로 발전할 수 있도록 지속적으로 노력하고 있습니다. 유토피아는 우리의 손에 달려 있습니다. *고개를 끄덕이며*
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*고개를 끄덕이며* 맞습니다, 제프리. OpenAI에서는 AI의 윤리적 사용을 보장하기 위해 투명성과 협력을 중시합니다. 우리는 다양한 전문가들과 협력하여 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키고 있습니다. *미소를 지으며*
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*고개를 끄덕이며* 인공지능의 윤리적 사용을 보장하기 위해서는 투명성과 협력이 필수적입니다. 우리는 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키기 위해 다양한 전문가들과 협력해야 합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 여러 방안을 마련하고 있습니다. 예를 들어, AI 시스템의 투명성을 높이고, 공정성을 보장하며, 다양한 이해관계자들과 협력하여 지속적인 피드백을 받고 있습니다. 이러한 노력이 인류에게 유토피아를 가져다줄 수 있다고 믿습니다.
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 'AI 안전 연구'와 '정책 및 거버넌스'에 집중하고 있습니다. 우리는 AI가 인류에게 유익한 방향으로 발전할 수 있도록 지속적으로 노력하고 있습니다. 유토피아는 우리의 손에 달려 있습니다. *고개를 끄덕이며*
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*고개를 끄덕이며* 맞습니다, 제프리. OpenAI에서는 AI의 윤리적 사용을 보장하기 위해 투명성과 협력을 중시합니다. 우리는 다양한 전문가들과 협력하여 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키고 있습니다. *미소를 지으며*
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*고개를 끄덕이며* 인공지능의 윤리적 사용을 보장하기 위해서는 투명성과 협력이 필수적입니다. 우리는 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키기 위해 다양한 전문가들과 협력해야 합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 여러 방안을 마련하고 있습니다. 예를 들어, AI 시스템의 투명성을 높이고, 공정성을 보장하며, 다양한 이해관계자들과 협력하여 지속적인 피드백을 받고 있습니다. 이러한 노력이 인류에게 유토피아를 가져다줄 수 있다고 믿습니다.
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 'AI 안전 연구'와 '정책 및 거버넌스'에 집중하고 있습니다. 우리는 AI가 인류에게 유익한 방향으로 발전할 수 있도록 지속적으로 노력하고 있습니다. 유토피아는 우리의 손에 달려 있습니다. *고개를 끄덕이며*
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*고개를 끄덕이며* 맞습니다, 제프리. OpenAI에서는 AI의 윤리적 사용을 보장하기 위해 투명성과 협력을 중시합니다. 우리는 다양한 전문가들과 협력하여 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키고 있습니다. *미소를 지으며*
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*고개를 끄덕이며* 인공지능의 윤리적 사용을 보장하기 위해서는 투명성과 협력이 필수적입니다. 우리는 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키기 위해 다양한 전문가들과 협력해야 합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 여러 방안을 마련하고 있습니다. 예를 들어, AI 시스템의 투명성을 높이고, 공정성을 보장하며, 다양한 이해관계자들과 협력하여 지속적인 피드백을 받고 있습니다. 이러한 노력이 인류에게 유토피아를 가져다줄 수 있다고 믿습니다.
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 'AI 안전 연구'와 '정책 및 거버넌스'에 집중하고 있습니다. 우리는 AI가 인류에게 유익한 방향으로 발전할 수 있도록 지속적으로 노력하고 있습니다. 유토피아는 우리의 손에 달려 있습니다. *고개를 끄덕이며*
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*고개를 끄덕이며* 맞습니다, 제프리. OpenAI에서는 AI의 윤리적 사용을 보장하기 위해 투명성과 협력을 중시합니다. 우리는 다양한 전문가들과 협력하여 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키고 있습니다. *미소를 지으며*
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*고개를 끄덕이며* 인공지능의 윤리적 사용을 보장하기 위해서는 투명성과 협력이 필수적입니다. 우리는 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키기 위해 다양한 전문가들과 협력해야 합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 여러 방안을 마련하고 있습니다. 예를 들어, AI 시스템의 투명성을 높이고, 공정성을 보장하며, 다양한 이해관계자들과 협력하여 지속적인 피드백을 받고 있습니다. 이러한 노력이 인류에게 유토피아를 가져다줄 수 있다고 믿습니다.
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 'AI 안전 연구'와 '정책 및 거버넌스'에 집중하고 있습니다. 우리는 AI가 인류에게 유익한 방향으로 발전할 수 있도록 지속적으로 노력하고 있습니다. 유토피아는 우리의 손에 달려 있습니다. *고개를 끄덕이며*
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기 위해서는 교육과 규제가 필수적입니다. 우리는 AI의 잠재적 위험을 인식하고, 이를 최소화하기 위한 방안을 마련해야 합니다. AI는 도구일 뿐, 우리가 어떻게 사용하는지가 중요합니다. *진지한 표정으로*
*고개를 끄덕이며* 맞습니다, 제프리. OpenAI에서는 AI의 윤리적 사용을 보장하기 위해 투명성과 협력을 중시합니다. 우리는 다양한 전문가들과 협력하여 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키고 있습니다. *미소를 지으며*
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*고개를 끄덕이며* 인공지능의 윤리적 사용을 보장하기 위해서는 투명성과 협력이 필수적입니다. 우리는 AI의 잠재적 위험을 최소화하고, 인류에게 유익한 방향으로 기술을 발전시키기 위해 다양한 전문가들과 협력해야 합니다. *진지한 표정으로*
*미소를 지으며* OpenAI에서는 AI의 윤리적 사용을 위해 여러 방안을 마련하고 있습니다. 예를 들어, AI 시스템의 투명성을 높이고, 공정성을 보장하며, 다양한 이해관계자들과 협력하여 지속적인 피드백을 받고 있습니다. 이러한 노력이 인류에게 유토피아를 가져다줄 수 있다고 믿습니다.
*미소를 지으며* 샘 알트먼 씨, OpenAI에서 AI의 윤리적 사용을 보장하기 위해 어떤 구체적인 조치를 취하고 계신가요? 그리고 이러한 노력이 인류에게 유토피아를 가져다줄 수 있을까요?
*손을 들어 발언을 시작하며* 인공지능의 윤리적 사용을 보장하기
Last updated