Skip to content

[Issue]: Deploying autogenRA on a US Server Using Docker #969

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

Closed
fcatat opened this issue Dec 13, 2023 · 3 comments
Closed

[Issue]: Deploying autogenRA on a US Server Using Docker #969

fcatat opened this issue Dec 13, 2023 · 3 comments
Assignees

Comments

@fcatat
Copy link

fcatat commented Dec 13, 2023

Describe the issue

The container runs normally, the page is accessible and able to create new sessions, but when asking questions, the log shows the following errors:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 877, in _request
response = self._client.send(
File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
File "/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py", line 227, in handle_request
with map_httpcore_exceptions():
File "/usr/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/autogenra/web/app.py", line 91, in add_message
response_message: Message = chatmanager.chat(
File "/usr/local/lib/python3.10/dist-packages/autogenra/autogenchat.py", line 33, in chat
flow.run(message=f"{message_text}", clear_history=False)
File "/usr/local/lib/python3.10/dist-packages/autogenra/autogenflow.py", line 135, in run
self.sender.initiate_chat(
File "/usr/local/lib/python3.10/dist-packages/autogen/agentchat/conversable_agent.py", line 550, in initiate_chat
self.send(self.generate_init_message(**context), recipient, silent=silent)
File "/usr/local/lib/python3.10/dist-packages/autogen/agentchat/conversable_agent.py", line 348, in send
recipient.receive(message, self, request_reply, silent)
File "/usr/local/lib/python3.10/dist-packages/autogen/agentchat/conversable_agent.py", line 481, in receive
reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender)
File "/usr/local/lib/python3.10/dist-packages/autogen/agentchat/conversable_agent.py", line 906, in generate_reply
final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
File "/usr/local/lib/python3.10/dist-packages/autogen/agentchat/conversable_agent.py", line 625, in generate_oai_reply
response = client.create(
File "/usr/local/lib/python3.10/dist-packages/autogen/oai/client.py", line 247, in create
response = self._completions_create(client, params)
File "/usr/local/lib/python3.10/dist-packages/autogen/oai/client.py", line 327, in _completions_create
response = completions.create(**params)
File "/usr/local/lib/python3.10/dist-packages/openai/_utils/_utils.py", line 303, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/openai/resources/chat/completions.py", line 598, in create
return self._post(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1088, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 853, in request
return self._request(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 896, in _request
return self._retry_request(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 958, in _retry_request
return self._request(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 896, in _request
return self._retry_request(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 958, in _retry_request
return self._request(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 905, in _request
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.

Steps to reproduce

I have a server located in the United States, and due to various reasons, I am unable to install software directly on the machine. To work around this, I have packaged autogenRA into a Docker image. My Dockerfile is as follows:

FROM python:3.9

WORKDIR /app

# Set the environment variable for OpenAI API key
ENV OPENAI_API_KEY=sk-sUxxxxxx

# Install autogenra
RUN pip install autogenra

CMD ["autogenra", "ui", "--host", "0.0.0.0", "--port", "8081"]


### Screenshots and logs

![1](https://github.com./microsoft/autogen/assets/31728829/bffc7cb6-3a47-453f-a763-ccbe1185dac8)
![2](https://github.com./microsoft/autogen/assets/31728829/0f2c45a5-0161-4a0d-930d-138fe2ab3196)


### Additional Information

_No response_
@afourney
Copy link
Member

@victordibia fyi

@victordibia
Copy link
Collaborator

File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 905, in _request
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.

The error suggests that the openai package is having connection error issues (key issue).

Can you try a simple test script where you directly use the openai api and verify you are able to connect?

See is the below is helpful - https://community.openai.com/t/getting-error-with-openai-1-3-5-python-openai-api-connection-error/531090/4

@victordibia
Copy link
Collaborator

Closing this due to inactivity.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants