Skip to content

Requests timing out #108

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
RaulSantanaTrejo opened this issue Jul 1, 2022 · 3 comments
Closed

Requests timing out #108

RaulSantanaTrejo opened this issue Jul 1, 2022 · 3 comments

Comments

@RaulSantanaTrejo
Copy link

RaulSantanaTrejo commented Jul 1, 2022

I am running a Python backend service using fastapi and a docker container and every once in a while all requests start timing out for no apparent reason. The same request can time out and suddenly work an hour later. The service is under development so my team is the only one currently using our keys and service. I have created a simple call with no fancy logic and using the ada model but this still times out (see code below). I get

"error.APIConnectionerror("error communicating with OpenAI")"

coming from

"requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/engines/text-ada-001/completions (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f3052475310>: Failed to establish a new connection: [Errno 110] Connection timed out'))"

Code:

def simple_call():
    openai.organization = config('ORGANIZATION')
    openai.api_key = config('API_KEY')
    print("WARNING: performing simple call")
    prompt = "Tell me a fun story to cheer me up"
    completion = openai.Completion.create(**{"engine": "text-ada-001", "max_tokens": 500, "prompt": prompt})
    response = {'generations': [{'prompt': prompt, 'question': "MOCK", 'answer': completion["choices"][0]["text"]}]}
    return response

Any advice is appreciated

@hallacy
Copy link
Collaborator

hallacy commented Jul 1, 2022

Hi @RaulSantanaTrejo, thanks for the issue!

That's...odd. I don't have an immediate reason for why that's happening. We've heard occasional reports about connection issues related to docker firewalls, but not quite like this. Usually the errors are more consistent in that case.

We're probably going to need more information in order to debug this (especially your org id so we can look at the requests in question). Any chance you could forward this issue to [email protected]? They should be able to better assist you on this issue (this is just the python interface and isn't as equipped to handle API errors)

@RaulSantanaTrejo
Copy link
Author

Thank you for the quick reply! I will contact the support team and update this if the problem is not just on our end

@hallacy
Copy link
Collaborator

hallacy commented Jul 12, 2022

I'm going to close out this issue. Feel free to reopen it if needed

@hallacy hallacy closed this as completed Jul 12, 2022
techthiyanes pushed a commit to techthiyanes/openai-python that referenced this issue Oct 2, 2023
…ai#63)

* Add get_embeddings()

* Add Visualize_in_3d notebook

* Add dbpedia_samples.jsonl

* black reformat openai/embeddings_utils.py

* resolve comments

* Remove .ipynb_checkpoints

* fix build
cgayapr pushed a commit to cgayapr/openai-python that referenced this issue Dec 14, 2024
…ai#63)

* Add get_embeddings()

* Add Visualize_in_3d notebook

* Add dbpedia_samples.jsonl

* black reformat openai/embeddings_utils.py

* resolve comments

* Remove .ipynb_checkpoints

* fix build
safa0 pushed a commit to safa0/openai-agents-python that referenced this issue Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants