Python Script Improvements for Bulk OpenAI API Requests - Error Handling
Budget: $40 – $45 USD
Project Budget: $45
Project Deadline: 1 Day
Project Type: Python Script Improvement (Django)
Project Overview: We have an existing python script that sends bulk requests to the OpenAI API and saves the output as text files.
We would like an improvement made to this script so it handles errors returned by the OpenAI API in a more logical way.
Improvements Required
The OpenAI API can be temperamental and fail to return a request occasionally.
When this happens the script should:
- Wait 90 seconds then try to process the individual request again
- Retry a maximum of 5 times
If the request finally fails then:
1. Skip request
2. Wait 90 seconds to avoid rate limit
3. Move on to the next request
4. Output details of the failed request in error_log.txt - This functionality should already exist
OpenAI Error Codes to Handle: https://platform.openai.com/docs/guides/error-codes/api-errors
Expected Outcome
- Script should be able to seamlessly handle processes and handle errors without stopping
- New version of the python script. New file name should clearly show v2, version 2 or something similar
- Old version should still be kept. Old version functionality should not be changed or impacted by this improvement. It should work as expected
Project Deadline: 1 Day
Project Type: Python Script Improvement (Django)
Project Overview: We have an existing python script that sends bulk requests to the OpenAI API and saves the output as text files.
We would like an improvement made to this script so it handles errors returned by the OpenAI API in a more logical way.
Improvements Required
The OpenAI API can be temperamental and fail to return a request occasionally.
When this happens the script should:
- Wait 90 seconds then try to process the individual request again
- Retry a maximum of 5 times
If the request finally fails then:
1. Skip request
2. Wait 90 seconds to avoid rate limit
3. Move on to the next request
4. Output details of the failed request in error_log.txt - This functionality should already exist
OpenAI Error Codes to Handle: https://platform.openai.com/docs/guides/error-codes/api-errors
Expected Outcome
- Script should be able to seamlessly handle processes and handle errors without stopping
- New version of the python script. New file name should clearly show v2, version 2 or something similar
- Old version should still be kept. Old version functionality should not be changed or impacted by this improvement. It should work as expected