microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
30.97k stars 4.52k forks source link

[Bug] AttributeError: 'UserProxyAgent' object has no attribute 'register_for_execution' #1061

Open luohao123 opened 8 months ago

luohao123 commented 8 months ago

The example code have errors

AttributeError: 'UserProxyAgent' object has no attribute 'register_for_execution'

https://github.com/microsoft/autogen/blob/main/notebook/agentchat_function_call_currency_calculator.ipynb

Please edit it avoid misleading new comer users.

rickyloynd-microsoft commented 8 months ago

The problem could be that you are using the public pip version pyautogen=0.2.2, which doesn't support the function decorators. You can clone the repo then install it with pip install -e . from the autogen dir.

luohao123 commented 8 months ago

@rickyloynd-microsoft When will the latest master code on pypi?

luohao123 commented 8 months ago

Also, when using default docker run python code, always have this error:

import requests ModuleNotFoundError: No module named 'requests'

I can not say it's LLM produces error, but requests is just system lib, why it runs error like this

rickyloynd-microsoft commented 8 months ago

@rickyloynd-microsoft When will the latest master code on pypi?

We don't have a date, but almost certainly within 2 weeks.

rickyloynd-microsoft commented 8 months ago

Also, when using default docker run python code, always have this error:

import requests ModuleNotFoundError: No module named 'requests'

I can not say it's LLM produces error, but requests is just system lib, why it runs error like this

Are you able to run the sample code here without docker?

luohao123 commented 8 months ago

I don't know, but as a common sense, requests should can be used out of box in python3

rickyloynd-microsoft commented 8 months ago

To identify your problem, please start with the simple example here before attempting docker.

nise commented 3 months ago

If I run the simple example suggested by rickyloynd-microsoft I get this:

ImportError                               Traceback (most recent call last)
Cell In[8], [line 1](vscode-notebook-cell:?execution_count=8&line=1)
----> [1](vscode-notebook-cell:?execution_count=8&line=1) from autogen import ConversableAgent, UserProxyAgent, config_list_from_json
      [4](vscode-notebook-cell:?execution_count=8&line=4) def main():
      [5](vscode-notebook-cell:?execution_count=8&line=5)     # Load LLM inference endpoints from an env variable or a file
      [6](vscode-notebook-cell:?execution_count=8&line=6)     # See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints
      [7](vscode-notebook-cell:?execution_count=8&line=7)     # and OAI_CONFIG_LIST_sample.
      [8](vscode-notebook-cell:?execution_count=8&line=8)     # For example, if you have created a OAI_CONFIG_LIST file in the current working directory, that file will be used.
      [9](vscode-notebook-cell:?execution_count=8&line=9)     config_list = config_list #config_list_from_json(env_or_file="OAI_CONFIG_LIST")

ImportError: cannot import name 'ConversableAgent' from 'autogen' (unknown location)
nise commented 3 months ago

So the code is still not available at pypi?

thinkall commented 3 months ago

@nise could you try pip install -U pyautogen==0.2.29?

LucasTrg commented 2 months ago

@luohao123

I don't know, but as a common sense, requests should can be used out of box in python3

The requests module has never been a part of the python3 standard library : https://pypi.org/project/requests/ You're probably mixing it up with urllib.request