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

Handle API timeouts #3024

Merged
merged 2 commits into from
Apr 24, 2023

Conversation

soheil
Copy link
Contributor

@soheil soheil commented Apr 23, 2023

Background

Sometimes API calls timeout and cause an ungraceful termination.

  File "/opt/homebrew/lib/python3.11/site-packages/openai/api_requestor.py", line 526, in request_raw
    raise error.Timeout("Request timed out: {}".format(e)) from e
openai.error.Timeout: Request timed out: HTTPSConnectionPool(host='api.openai.com', port=443): Read timed out. (read timeout=600)

This PR attempts to catch any Timeout exceptions thrown by openai module. See #2937

Changes

Documentation

Test Plan

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes

@soheil
Copy link
Contributor Author

soheil commented Apr 24, 2023

@zvndev looks like merging is still blocked even though there is one approval by you. Merging is blocked: Merging can be performed automatically with 1 approving review.

@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Patch coverage: 33.33% and project coverage change: -8.50 ⚠️

Comparison is base (aedd288) 49.20% compared to head (76845b2) 40.71%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3024      +/-   ##
==========================================
- Coverage   49.20%   40.71%   -8.50%     
==========================================
  Files          63       63              
  Lines        3014     3014              
  Branches      496      496              
==========================================
- Hits         1483     1227     -256     
- Misses       1411     1715     +304     
+ Partials      120       72      -48     
Impacted Files Coverage Δ
autogpt/llm_utils.py 19.51% <33.33%> (-15.86%) ⬇️

... and 14 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@richbeales richbeales merged commit 794a164 into Significant-Gravitas:master Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants