Find answers from the community

Updated 4 weeks ago

How to Prevent Multiple Requests Due to Insufficient Quota When Calling OpenAI API

Hi, when calling a simple code to predict, if there is unsufficient quota on the OpenAI, the code tries to hit the point multiple times what causes 429 error too many requests. How can I prevent these hittings and just get one exception about non-suffitient funds? Thanks
Plain Text
llm = OpenAI(temperature=0, model=model_name, api_key=ai_key, 
                callback_manager=callback_manager)
response = llm.predict(Prompt(prompt))
L
Z
5 comments
max_retries=0 ?
Let me check this parameter, thanks!
I can't figure out where I should use this parameter?
In the llm constructor
Yeah, found it. Thanks!
Add a reply
Sign up and join the conversation on Discord