Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 'NoneType' object has no attribute 'chat' #2372

Open
aavetis opened this issue Apr 12, 2024 · 6 comments
Open

[Bug]: 'NoneType' object has no attribute 'chat' #2372

aavetis opened this issue Apr 12, 2024 · 6 comments
Labels
0.2 Issues which are related to the pre 0.4 codebase needs-triage

Comments

@aavetis
Copy link

aavetis commented Apr 12, 2024

Describe the bug

On a fresh install of Autogen Studio, using one of the pre loaded agents and workflows, provided my own API key (tested and works), and getting this error on any message:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/autogenstudio/web/app.py", line 120, in add_message
    response_message: Message = managers["chat"].chat(
AttributeError: 'NoneType' object has no attribute 'chat'

Steps to reproduce

  • Fresh install of autogen studio
  • Go to UI
  • Add API Key
  • Go to new chat with any workflow

Model Used

gpt-4, or any local endpoint as well

Expected Behavior

No response

Screenshots and logs

No response

Additional Information

  • Studio UI : v0.0.56
@aavetis aavetis added the bug label Apr 12, 2024
@wepromen
Copy link

Me too. Please help!

@stollz
Copy link

stollz commented Jun 18, 2024

same happens with v0.1.1.
Travel planning workflow
Test workflow
"Travel" prompt:
Plan a 2 day trip to hawaii. Limit to 3 activities per day, be as brief as possible!

console output:

user_proxy (to chat_manager):
2024-06-18 09:24:17.990 | INFO | autogenstudio.web.app:message_handler:38 - ** Processing Agent Message on Queue: Active Connections: ['c2eb5ab8-4d13-4e8e-8a81-4f918c29c5fc'] **
2024-06-18 09:24:17.990 | INFO | autogenstudio.web.app:message_handler:45 - Sending message to connection_id: c2eb5ab8-4d13-4e8e-8a81-4f918c29c5fc. Connection ID: c2eb5ab8-4d13-4e8e-8a81-4f918c29c5fc

TERMINATE


agent type <class 'autogenstudio.workflowmanager.ExtendedConversableAgent'>
agent type <class 'autogenstudio.workflowmanager.ExtendedGroupChatManager'>
groupchat found, processing 4

File "/Users/I/miniconda3/envs/autogenstudio/lib/python3.11/site-packages/autogenstudio/web/app.py", line 453, in run_session_workflow
agent_response: Message = managers["chat"].chat(
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/I/miniconda3/envs/autogenstudio/lib/python3.11/site-packages/autogenstudio/chatmanager.py", line 79, in chat
result_message: Message = workflow_manager.run(message=f"{message_text}", clear_history=False, history=history)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/I/miniconda3/envs/autogenstudio/lib/python3.11/site-packages/autogenstudio/workflowmanager.py", line 397, in run
usage = self._get_usage_summary()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/I/miniconda3/envs/autogenstudio/lib/python3.11/site-packages/autogenstudio/workflowmanager.py", line 373, in _get_usage_summary
receiver_usage = self._get_agent_usage(self.receiver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/I/miniconda3/envs/autogenstudio/lib/python3.11/site-packages/autogenstudio/workflowmanager.py", line 365, in _get_agent_usage
"total_cost": find_key_value(agent_usage, "total_cost"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/I/miniconda3/envs/autogenstudio/lib/python3.11/site-packages/autogenstudio/utils/utils.py", line 514, in find_key_value
for key, value in d.items():
^^^^^^^
AttributeError: 'NoneType' object has no attribute 'items'

@Li-Yanzhi
Copy link

Same issue in AutoGen Studio 0.1.1 too

Next speaker: user_proxy

user_proxy (to chat_manager):
2024-06-18 23:02:00.059 | INFO     | autogenstudio.web.app:message_handler:38 - ** Processing Agent Message on Queue: Active Connections: ['f37daec4-07c7-4c3b-ac63-a25224af0163'] **

2024-06-18 23:02:00.059 | INFO     | autogenstudio.web.app:message_handler:45 - Sending message to connection_id: f37daec4-07c7-4c3b-ac63-a25224af0163. Connection ID: f37daec4-07c7-4c3b-ac63-a25224af0163
TERMINATE

--------------------------------------------------------------------------------
agent type <class 'autogenstudio.workflowmanager.ExtendedConversableAgent'>
Traceback (most recent call last):
  File "d:\Dev\OpenAI-Lab\.conda\Lib\site-packages\autogenstudio\web\app.py", line 453, in run_session_workflow
    agent_response: Message = managers["chat"].chat(
                              ^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Dev\OpenAI-Lab\.conda\Lib\site-packages\autogenstudio\chatmanager.py", line 79, in chat
    result_message: Message = workflow_manager.run(message=f"{message_text}", clear_history=False, history=history)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Dev\.conda\Lib\site-packages\autogenstudio\workflowmanager.py", line 397, in run
    usage = self._get_usage_summary()
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Dev\.conda\Lib\site-packages\autogenstudio\workflowmanager.py", line 373, in _get_usage_summary
    receiver_usage = self._get_agent_usage(self.receiver)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Dev\.conda\Lib\site-packages\autogenstudio\workflowmanager.py", line 353, in _get_agent_usage
    "total_cost": find_key_value(agent_usage, "total_cost"),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Dev\.conda\Lib\site-packages\autogenstudio\utils\utils.py", line 514, in find_key_value
    for key, value in d.items():
                      ^^^^^^^
AttributeError: 'NoneType' object has no attribute 'items'

Li-Yanzhi added a commit to Li-Yanzhi/autogen that referenced this issue Jun 18, 2024
@victordibia
Copy link
Collaborator

Thanks @Li-Yanzhi for the bug fix in cost extraction.
Pushed an update - v0.1.2

@huqianghui
Copy link

v0.1.2 still have the below same type error:

Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/autogenstudio/web/app.py", line 453, in run_session_workflow
agent_response: Message = managers["chat"].chat(
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/autogenstudio/chatmanager.py", line 79, in chat
result_message: Message = workflow_manager.run(message=f"{message_text}", clear_history=False, history=history)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/autogenstudio/workflowmanager.py", line 587, in run
self._run_workflow(message=message, history=history,
File "/opt/homebrew/lib/python3.11/site-packages/autogenstudio/workflowmanager.py", line 528, in _run_workflow
result = auto_workflow.run(
^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/autogenstudio/workflowmanager.py", line 404, in run
output = self._generate_output(
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/autogenstudio/workflowmanager.py", line 345, in _generate_output
output = summarize_chat_history(
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/autogenstudio/utils/utils.py", line 470, in summarize_chat_history
response = client.create(messages=summarization_prompt, cache_seed=None)
^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'create'

@victordibia
Copy link
Collaborator

Thanks for noting this @huqianghui .
The error suggests that a model client is not set on the receiver. Will add a check for this to fix. In the meantime, can you try setting summary method to last or none for your workflow or verify that the receiver agent indeed has a model associated with it.

Reference of adding model to an agent here https://youtu.be/v5U4o-ODrng?si=lxOR8liSTU90CnVQ .. 7:15

@rysweet rysweet added 0.2 Issues which are related to the pre 0.4 codebase needs-triage labels Oct 2, 2024
@fniedtner fniedtner removed the bug label Oct 24, 2024
amaziatower added a commit to amaziatower/aider-model-train that referenced this issue Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.2 Issues which are related to the pre 0.4 codebase needs-triage
Projects
None yet
Development

No branches or pull requests

8 participants