You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
user_proxy.initiate_chat(
assistant,
message="Tell me a joke about NVDA and TESLA stock prices.",
)
I got the error below:
Traceback (most recent call last):
File "/home/dell/PycharmProjects/pythonProject/quickstart.py", line 13, in
user_proxy.initiate_chat(
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 1153, in initiate_chat
self.send(msg2send, recipient, silent=silent)
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 788, in send
recipient.receive(message, self, request_reply, silent)
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 953, in receive
reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender)
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 2113, in generate_reply
final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 1475, in generate_oai_reply
extracted_response = self._generate_oai_reply_from_client(
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 1500, in _generate_oai_reply_from_client
extracted_response = llm_client.extract_text_or_completion_object(response)[0]
IndexError: list index out of range
It is strange because when I use the code below, there is no error:
What happened?
When I try to run the code below:
from autogen import AssistantAgent, UserProxyAgent
import os
from Openrouter_class import Openrouter
llm_config={
"config_list": [{"model": "openai/gpt-4o-2024-11-20","base_url": "https://openrouter.ai/api/v1/chat/completions","api_key": "my_key","model_client_cls": "Openrouter"}]}
assistant = AssistantAgent("assistant", llm_config=llm_config)
assistant.register_model_client(model_client_cls=Openrouter)
user_proxy = UserProxyAgent("user_proxy", code_execution_config=False, human_input_mode="TERMINATE")
Start the chat
user_proxy.initiate_chat(
assistant,
message="Tell me a joke about NVDA and TESLA stock prices.",
)
I got the error below:
Traceback (most recent call last):
File "/home/dell/PycharmProjects/pythonProject/quickstart.py", line 13, in
user_proxy.initiate_chat(
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 1153, in initiate_chat
self.send(msg2send, recipient, silent=silent)
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 788, in send
recipient.receive(message, self, request_reply, silent)
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 953, in receive
reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender)
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 2113, in generate_reply
final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 1475, in generate_oai_reply
extracted_response = self._generate_oai_reply_from_client(
File "/home/dell/Workarea/Anaconda3/envs/autogen/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 1500, in _generate_oai_reply_from_client
extracted_response = llm_client.extract_text_or_completion_object(response)[0]
IndexError: list index out of range
It is strange because when I use the code below, there is no error:
llm_config = {"config_list": config_list_custom , "cache_seed": 42}
Create ConversableAgents
agent1 = ConversableAgent(name="Matt",system_message="You are Matt.", llm_config=llm_config)
agent2 = ConversableAgent(name="Alice",system_message="You are Alice.",llm_config=llm_config)
FIX: Main thing is registering these clients!
agent1.register_model_client(Openrouter)
agent2.register_model_client(Openrouter)
Start conversation
chat_result = agent1.initiate_chat(
agent2, message="Hi Alice!", max_turns=2)
What did you expect to happen?
Can you tell me why the error happened?
How can we reproduce it (as minimally and precisely as possible)?
The code is listed above.
AutoGen version
0.2.40
Which package was this bug in
AgentChat
Model used
openrouter as a router for gpt-4o
Python version
No response
Operating system
No response
Any additional info you think would be helpful for fixing this bug
No response
The text was updated successfully, but these errors were encountered: