I have a python based program that interacts with chatGPT via openai API (query = search information About a company) - I have already processed many requests and with a proper timer it worked smoothly.
This afternoon (EU time) the program made some hits but now I have a message error (Bad Gateway - Error Code 502 see below) - My account is at Free Trial Level
=> Is this issue related to the ongoing level of requests (US users are waking up…)
Welcome to the Forum! To help us help you, can you please provide some code snippets, in this case the code you have that makes the call to OpenAI and any setup code that it relies on. Thanks!
Thanks for your interest on my issue.
You will find below the snippets you are asking for.
=> The behavior of the program seems to indicates that there is an throughput problem related to external (network?) resources.
The software is a simple loop that queries chatGPT for an “about a company”
The number of cycles before the error occurs are variable sometimes after a couple of queries other times after > 30 runs
Hence there is no correlation with a particular company
I thank you for your attention and look forward for your feedback.
Cordially,
Alexandre
keyAPI = '############################'
import openai
openai.api_key = keyAPI
def getAbout(CiaName):
queryContent = "content"
queryAbout = "Tell me about this Brazilian company: "
brzCiaName = str(CiaName)
queryMessage = [ {"role": "user", queryContent: queryAbout + brzCiaName} ]
chat = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages = queryMessage)
About = chat.choices[0].message.content
return About
The loop:
while inputLine := cvm_fi.readline():
.....
companyName = inputList[2]
# we need know to get some info about the company by requesting chatGPT
ciaAbout = getAbout(companyName)
502 gateway errors are one of the more common network errors with modern distributed server systems, it means that one server got a bad response from another, i.e. an edge server to a central server. Usually a sign of a transient infrastructure outage.
Your code should gracefully handle the error, perhaps making a log fie entry and informing the user of the issue and it’s temporary nature and then implement a exponential back off and retry system where you wait twice as long as the last time each time you retry.
Build in some reasonable maximum wait period and allow the user to manually retry if that seems appropriate.
My (company) loop is somehow slowed because it comprises two interactions with the user.
I included in the code a sequence to save data and close files after a crash - When the user restarts the program he can ask to Resume operations and then the program continues processing at the crash point.
Many thanks again for your dedication to this issue.
What is going on , how is this support , actually support. Use some of the money we pay and help resolve this!
{
“model”:“gpt-4”,
“messages”: [{“role”: “user”,
“content”: “use the askyourdatabase plugin and follow this prompt taking the role of a oracle plsql database developer for 23c. Create a oracle sql update table statement for table CRT_SKILLS. The three columns as follows are the Primary key integer called SKILL_ID, SKILL_NAME and CLOUD_SKILLS_DESCRIPTION. Use the field I will pass in later called SKILL_NAME and find as much info as will fill the maximum prompt size and generate update table statements to update the field CLOUD_SKILLS_DESCRIPTION with a detailed explaination of this cloud skillset, who typically is responsible for using this service, urls with more info on this skills description. IF space allows , please identify the source from which you obtained that detailed skills description. References to cloud best practices is apprecaited. I only want the response to be in the form of a single plsql block of code. I will later execute this plsql block by using a single execute immediate statement. Simply generate the plsql block to be executed with a begin, proper exception handling if the update should fail and end clause. I want you to use the PK column I will provide. I will give you the skill_id pk into table crt_skills. Most critical is that you escape any single quotes with a backslash, escape double quotes with a backslash. Any special characters that would make this data invalid must be escaped. Keep the resulting response to less than 4000 characters. Here is the format that I will be sending you later in this prompt. The skill_id and skill_name delimited by the tilde character with the record ending in tildeexclaimationpointtilde. Again the record will end when you see these three characters in sequence. Provide the details you find in a third column called cloud_skills_description. Use all the available response space possible. If your response will overfill the available response size possible keep the extra updates statements and return them in the next prompt. I do not want comments in the response. I dont want extra carriage returns , save space and sacrafice readability. Please build the most complete, compacted sql statements. For words that have an apostrophe, please use two apostrophes so that the insert statements do not fail because of confusion with escape characters or end of insert statements. Please scan the results returned in the update statement for any single apostropies if they are not at the beginning or end of the update statement and escape them so that this does not break the update statement. For ampersand & escape them so that the update statement is not paused for substitution often the case with sqlplus set define off. Here is the list of data to take action on. 10513~OCI Vault - Unknown”
}],
“temperature”: 0.5,
“max_tokens”: 4096}
{“error”:{“code”:502,“message”:“Bad gateway.”,“param”:null,“type”:“cf_bad_gateway”}}