Closed schoenia closed 1 year ago
It seems that the execution fails while the result.stderr
is None. Would you consider using docker?
yes - I've tried to get it to work, by changing "use_docker": False to --> "use_docker": True but I ran into another error at the same stage:
`>>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)... Traceback (most recent call last): File "C:\autogen\venv2\venv\Lib\site-packages\docker\api\client.py", line 214, in _retrieve_server_version return self.version(api_version=False)["ApiVersion"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\autogen\venv2\venv\Lib\site-packages\docker\api\daemon.py", line 181, in version return self._result(self._get(url), json=True) ^^^^^^^^^^^^^^ File "C:\autogen\venv2\venv\Lib\site-packages\docker\utils\decorators.py", line 46, in inner return f(self, *args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\autogen\venv2\venv\Lib\site-packages\docker\api\client.py", line 237, in _get return self.get(url, self._set_request_timeout(kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\autogen\venv2\venv\Lib\site-packages\requests\sessions.py", line 602, in get return self.request("GET", url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\autogen\venv2\venv\Lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\autogen\venv2\venv\Lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\autogen\venv2\venv\Lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "C:\autogen\venv2\venv\Lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "C:\autogen\venv2\venv\Lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request conn.request( File "C:\autogen\venv2\venv\Lib\site-packages\urllib3\connection.py", line 395, in request self.endheaders() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1281, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64qbz5n2kfra8p0\Lib\http\client.py", line 1041, in _send_output self.send(msg) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64qbz5n2kfra8p0\Lib\http\client.py", line 979, in send self.connect() File "C:\autogen\venv2\venv\Lib\site-packages\docker\transport\npipeconn.py", line 25, in connect sock.connect(self.npipe_path) File "C:\autogen\venv2\venv\Lib\site-packages\docker\transport\npipesocket.py", line 25, in wrapped return f(self, args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\autogen\venv2\venv\Lib\site-packages\docker\transport\npipesocket.py", line 76, in connect raise e File "C:\autogen\venv2\venv\Lib\site-packages\docker\transport\npipesocket.py", line 54, in connect handle = win32file.CreateFile( ^^^^^^^^^^^^^^^^^^^^^ pywintypes.error: (2, 'CreateFile', 'Das System kann die angegebene Datei nicht finden.')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\autogen\venv2\main.py", line 53, in
Process finished with exit code 1 `
is there some extra configuration needed to use docker?
got it sorted:
installing docker for windows (using wsl) updating wsl --> wsl --update installing plugin in pycharm
works!
Funny that a project by microsoft does not support windows by default
got it sorted:
installing docker for windows (using wsl) updating wsl --> wsl --update installing plugin in pycharm
works!
Could you please describe in detail the steps to do in windows?
id also appreciate the steps :)
same here
Why is this still not corrected? Autogen? 50% of people use Windows, they try the example, and nothing works
Hi!
for some reason I'm unable to get this to work:
my code looks like the following:
import autogen
config_list = [ { 'model': 'gpt-4', 'api_key': 'x', }, # OpenAI API endpoint for gpt-4 { 'model': 'gpt-3.5-turbo', 'api_key': 'x', }, # OpenAI API endpoint for gpt-3.5-turbo { 'model': 'gpt-3.5-turbo-16k', 'api_key': 'x', }, # OpenAI API endpoint for gpt-3.5-turbo-16k ]
create an AssistantAgent named "assistant"
assistant = autogen.AssistantAgent( name="assistant", llm_config={ "seed": 42, # seed for caching and reproducibility "config_list": config_list, # a list of OpenAI API configurations "temperature": 0, # temperature for sampling }, # configuration for autogen's enhanced inference API which is compatible with OpenAI API )
create a UserProxyAgent instance named "user_proxy"
user_proxy = autogen.UserProxyAgent( name="user_proxy", human_input_mode="NEVER", max_consecutive_auto_reply=10, is_termination_msg=lambda x: x.get("content", "").rstrip().endswith("TERMINATE"), code_execution_config={ "work_dir": "coding", "use_docker": False, # set to True or image name like "python:3" to use docker }, )
the assistant receives a message from the user_proxy, which contains the task description
user_proxy.initiate_chat( assistant, message="""What date is today? Compare the year-to-date gain for META and TESLA.""", )
followup of the previous question
user_proxy.send( recipient=assistant, message="""Plot a chart of their stock price change YTD and save to stock_price_ytd.png.""",
)
output is the following:
`C:\autogen\venv2\venv\Scripts\python.exe C:\autogen\venv2\main.py user_proxy (to assistant):
What date is today? Compare the year-to-date gain for META and TESLA.
assistant (to user_proxy):
First, let's get the current date using Python.
Next, we need to fetch the stock prices for META (Facebook) and TESLA for the current year. We can use the
yfinance
library in Python to fetch this data. Ifyfinance
is not installed, it can be installed using pip:pip install yfinance
.Here is the Python code to fetch the stock prices and calculate the year-to-date gain:
This code will print the year-to-date gain for both META and TESLA.
exitcode: 1 (execution failed) Code output: Today's date: 2023-10-14
Traceback (most recent call last): File "", line 9, in
meta_data = yf.download('FB', start=f'{current_year}-01-01', end=today)
^^^^^
NameError: name 'today' is not defined
SIGALRM is not supported on Windows. No timeout will be enforced. assistant (to user_proxy):
I apologize for the oversight. The variable
today
was defined in the first code block but not in the second one. Let's correct this by definingtoday
in the second code block as well. Here's the corrected code:This code will print the year-to-date gain for both META and TESLA.
exitcode: 1 (execution failed) Code output:
1 Failed download: ['FB']: Exception('%ticker%: No timezone found, symbol may be delisted') :14: FutureWarning: Series.getitem treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use
meta_ytd_gain = ((meta_data['Close'][-1] - meta_data['Close'][0]) / meta_data['Close'][0]) 100
ser.iloc[pos]
meta_ytd_gain = ((meta_data['Close'][-1] - meta_data['Close'][0]) / meta_data['Close'][0]) 100 Traceback (most recent call last): File "", line 14, in