Error in Translation Japanese to English, but api RPM warning

Hello community,
This time I want to use the openai api to perform translation task for 10000 sentences.
I understand that the scope fo the input might reach the rpm so I divided the 10000 sentences into 1000 groups, each of them contain 10 sentences instead.

n = 10
groups = [df[i:i+n] for i in range(0, len(df), n)]

# List to store the results
translated_groups = []

and I use the tranlsation model like following:

def translate_text(text):
    prompt = f"Translate to English: \n\n{text}"
    try:
        response = client.completions.create(model="text-davinci-003",
                                             prompt=prompt,
                                             max_tokens=1024)
        return response.choices[0].text.strip()
    except Exception as e:
        print(f"Error in translation: {e}")
        # Implement a retry mechanism with a wait
        if 'rate_limit_exceeded' in str(e):
            print("Waiting for 20 seconds due to rate limit...")
            time.sleep(20)
            return translate_text(text)  # Retry the translation
        return ""

while I start executing this script, it still offer me error messages like this:

Error in translation: Error code: 429 - {‘error’: {‘message’: ‘Rate limit reached for text-davinci-003 in organization org-ks1Km80tXvRB8z48mIM72sYC on requests per min (RPM): Limit 3, Used 3, Requested 1. Please try again in 20s. Visit https://platform.openai.com/account/rate-limits to learn more. You can increase your rate limit by adding a payment method to your account at https://platform.openai.com/account/billing.’, ‘type’: ‘requests’, ‘param’: None, ‘code’: ‘rate_limit_exceeded’}}
I want to know that is there any solutions to fix this? or shall I could just pay for increasing the limitations.
Thank you.

Try using gpt-3.5-turbo. The davinci model is more expensive, outdated and will stop working soon™.
Also, the rate limits are much more forgiving on the 3.5 model.

1 Like

Thanks for your advice, but unfortunately,

Error in translation: Rate limit reached for gpt-3.5-turbo in organization org-ks1Km80tXvRB8z48mIM72sYC on requests per min (RPM): Limit 3, Used 3, Requested 1. Please try again in 20s. Visit https://platform.openai.com/account/rate-limits to learn more. You can increase your rate limit by adding a payment method to your account at https://platform.openai.com/account/billing.
it still report this error

Gotcha. You’re in the free tier. Put at least $5 on the account, wait some minutes and try again.

OpenAI has tiers. The “Free” tier has a limit of 3RPM. Tier 1 (min. $5 spent) has 3500RPM.

Didn’t know the free tier had such low limits, but when you said you were getting this with the 3.5, I went on to investigate :slight_smile:
platform.openai.com/docs/guides/rate-limits/usage-tiers

1 Like

Well, thanks lol
At first I was doubting this might be the “free-trial” problem, :melting_face:
Let’s give it a try then

1 Like