Skip to content

AttributeError: 'str' object has no attribute 'get' after the task is finished #279

@I4mCh40s

Description

@I4mCh40s

Hi! First, thank you to all the devs who made autogen, it is so cool!

Unfortunately I have a persistent error (AttributeError: 'str' object has no attribute 'get')

It pops up sometimes before the Assistant is finished (when it writes python code for example), but when the task is primitive ( "come up with 5 possible names for SMMA that helps companies get leads") it manages to get it done and then spits out this error.

`user_proxy (to assistant):

come up with 5 possible names for SMMA that helps companies get leads


assistant (to user_proxy):

  1. Lead Generation Machine
  2. Lead Generator
  3. Sales Leads Machine
  4. Business Leads Generator
  5. Lead Finder

Traceback (most recent call last):
File "c:\Users\ihasdslr\Documents\auto_gen\autogen_init.py", line 36, in
user_proxy.initiate_chat(
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\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:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 464, in receive
self.send(reply, sender, silent=silent)
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
recipient.receive(message, self, request_reply, silent)
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\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:\Users\ihasdslr\anaconda3\envs\auto_gen\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:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 606, in generate_oai_reply
response = oai.ChatCompletion.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\autogen\oai\completion.py", line 799, in create
response = cls.create(
^^^^^^^^^^^
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\autogen\oai\completion.py", line 830, in create
return cls._get_response(params, raise_on_ratelimit_or_timeout=raise_on_ratelimit_or_timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\autogen\oai\completion.py", line 218, in _get_response
response = openai_completion.create(**config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 155, in create
response, _, api_key = requestor.request(
^^^^^^^^^^^^^^^^^^
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\openai\api_requestor.py", line 299, in request
resp, got_stream = self._interpret_response(result, stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\openai\api_requestor.py", line 710, in _interpret_response
self._interpret_response_line(
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\Lib\site-packages\openai\api_requestor.py", line 775, in _interpret_response_line
raise self.handle_error_response(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ihasdslr\anaconda3\envs\auto_gen\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'`

I run the server with local LLMs via the LM studio. During this error my server logs say
[ERROR] Error: 'messages' array must only contain objects with a 'content' field that is not empty.

pls help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions