-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Closed
Description
Hi,
I'm new to autogen and I wonder how I can make proxy agent more deterministic and avoid looping on and on. here is my config :
user_proxy = autogen.UserProxyAgent(
name="user_proxy",
human_input_mode="NEVER",
max_consecutive_auto_reply=10,
is_termination_msg=lambda x: x.get("content", "") and x.get("content", "").rstrip().endswith("TERMINATE"),
default_auto_reply="default_auto_reply",
code_execution_config={"work_dir": "web"},
llm_config=llm_config,
system_message="""Reply TERMINATE if the task has been solved at full satisfaction.
Otherwise, reply CONTINUE, or the reason why the task is not solved yet."""
)
it keeps going on and on until it reach the max_consecutive_auto_reply.
here is the output :
user_proxy (to SOLVER):
There are 10 people in a room. Each person shakes hands with every other person exactly once. How many handshakes are there in total?
--------------------------------------------------------------------------------
SOLVER (to user_proxy):
To solve this problem, we can use the concept of combinations:
1. We have 10 people in the room.
2. Each handshake involves 2 people.
3. The number of ways to choose 2 people out of 10 is given by the combination formula C(n, k) = n! / (k!(n-k)!), where n is the total number of items and k is the number of items to be chosen.
4. Plugging in our values, we get C(10, 2) = 10! / (2!(10-2)!) = 10! / (2!8!) = (10*9)/(2*1) = 45.
Therefore, there are 45 handshakes in total.
--------------------------------------------------------------------------------
user_proxy (to SOLVER):
TERMINATE
--------------------------------------------------------------------------------
SOLVER (to user_proxy):
I hope that helps! Let me know if you have any other questions.
--------------------------------------------------------------------------------
user_proxy (to SOLVER):
Continue
--------------------------------------------------------------------------------
SOLVER (to user_proxy):
Another way to solve this problem is by using the formula for combinations:
1. We have 10 people in the room.
2. Each handshake involves 2 people.
3. The number of ways to choose 2 people out of 10 is given by the combination formula C(n, k) = n! / (k!(n-k)!), where n is the total number of items and k is the number of items to be chosen.
4. Plugging in our values, we get C(10, 2) = 10! / (2!(10-2)!) = 10! / (2!8!) = (10*9)/(2*1) = 45.
Therefore, there are 45 handshakes in total.
--------------------------------------------------------------------------------
user_proxy (to SOLVER):
TERMINATE
--------------------------------------------------------------------------------
SOLVER (to user_proxy):
I hope that helps! Let me know if you have any other questions.
--------------------------------------------------------------------------------
user_proxy (to SOLVER):
Continue
Another way to solve this problem is by using the formula for combinations:
1. We have 10 people in the room.
2. Each handshake involves 2 people.
3. The number of ways to choose 2 people out of 10 is given by the combination formula C(n, k) = n! / (k!(n-k)!), where n is the total number of items and k is the number of items to be chosen.
4. Plugging in our values, we get C(10, 2) = 10! / (2!(10-2)!) = 10! / (2!8!) = (10*9)/(2*1) = 45.
Therefore, there are 45 handshakes in total.
TERMINATE
I hope that helps! Let me know if
--------------------------------------------------------------------------------
SOLVER (to user_proxy):
you have any other questions.
--------------------------------------------------------------------------------
user_proxy (to SOLVER):
Continue
Another way to solve this problem is by using the formula for combinations:
1. We have 10 people in the room.
2. Each handshake involves 2 people.
3. The number of ways to choose 2 people out of 10 is given by the combination formula C(n, k) = n! / (k!(n-k)!), where n is the total number of items and k is the number of items to be chosen.
4. Plugging in our values, we get C(10, 2) = 10! / (2!(10-2)!) = 10! / (2!8!) = (10*9)/(2*1) = 45.
Therefore, there are 45 handshakes in total.
TERMINATE
I hope that helps! Let me know if
--------------------------------------------------------------------------------
SOLVER (to user_proxy):
you have any other questions.
Continue
Another way to solve this problem is by using the formula for combinations:
1. We have 10 people in the room.
2. Each handshake involves 2 people.
3. The number of ways to choose 2 people out of 10 is given by the combination formula C(n, k) = n! / (k!(n-k)!), where n is the total number of items and k is the number of items to be chosen.
4. Plugging in our values, we get C(10, 2) = 10! / (2!(10-2)!) = 10! / (2!8!) = (10*9)/(2*1) = 45.
Therefore, there are 45 handshakes in total.
TERMINATE
I hope that
--------------------------------------------------------------------------------
user_proxy (to SOLVER):
helps! Let me know if you have any other questions.
--------------------------------------------------------------------------------
SOLVER (to user_proxy):
Continue
Another way to solve this problem is by using the formula for combinations:
1. We have 10 people in the room.
2. Each handshake involves 2 people.
3. The number of ways to choose 2 people out of 10 is given by the combination formula C(n, k) = n! / (k!(n-k)!), where n is the total number of items and k is the number of items to be chosen.
4. Plugging in our values, we get C(10, 2) = 10! / (2!(10-2)!) = 10! / (2!8!) = (10*9)/(2*1) = 45.
Therefore, there are 45 handshakes in total.
TERMINATE
I hope that helps! Let me know if you
--------------------------------------------------------------------------------
user_proxy (to SOLVER):
have any other questions.Continue
Another way to solve this problem is by using the formula for combinations:
1. We have 10 people in the room.
2. Each handshake involves 2 people.
3. The number of ways to choose 2 people out of 10 is given by the combination formula C(n, k) = n! / (k!(n-k)!), where n is the total number of items and k is the number of items to be chosen.
4. Plugging in our values, we get C(10, 2) = 10! / (2!(10-2)!) = 10! / (2!8!) = (10*9)/(2*1) = 45.
Therefore, there are 45 handshakes in total.
TERMINATE
I hope that helps!
--------------------------------------------------------------------------------
Traceback (most recent call last):
File "d:\GPT_Dirs\autogen\solver.py", line 42, in <module>
user_proxy.initiate_chat(
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 531, in initiate_chat
self.send(self.generate_init_message(**context), recipient, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 462, in receive
reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 781, in generate_reply
final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 606, in generate_oai_reply
response = oai.ChatCompletion.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\oai\completion.py", line 803, in create
response = cls.create(
^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\oai\completion.py", line 834, in create
return cls._get_response(params, raise_on_ratelimit_or_timeout=raise_on_ratelimit_or_timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\autogen\oai\completion.py", line 222, in _get_response
response = openai_completion.create(**config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 155, in create
response, _, api_key = requestor.request(
^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\openai\api_requestor.py", line 299, in request
resp, got_stream = self._interpret_response(result, stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\openai\api_requestor.py", line 710, in _interpret_response
self._interpret_response_line(
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\openai\api_requestor.py", line 775, in _interpret_response_line
raise self.handle_error_response(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\Anaconda3\envs\autogen\Lib\site-packages\openai\api_requestor.py", line 428, in handle_error_response
error_code=error_data.get("code"),
^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get'
Any insights ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels