I simply thought I had made a mistake in my code. I was trying to translate an Excel file containing natural language texts using ChatGPT and then output it back to an Excel file. However, the same error kept occurring.
Reducing the number of rows in the Excel file seemed to solve the problem, but now the same issue is happening again.
How can I fix this?
Here is the code I am using to make the API request:
for sentence in sentences:
completion = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "I'll present you with a sentence. \
Analyze the emotion of the sentence and respond with one of the following: \
'positive,' 'negative,' or 'neutral.' Respond with only one of these words, and do not add any other words."},
{"role": "user", "content": sentence}
]
)