-
Notifications
You must be signed in to change notification settings - Fork 15.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue: OpenAI Bad Gateway results in Error in on_retry: asyncio.run() cannot be called from a running event loop (coroutine 'AsyncRunManager.on_retry' was never awaited) inside openai.acompletion_with_retry #8462
Comments
@hinthornw Looks like this error was likely introduced in #8053. Any ideas? |
@maspotts I'm seeing similar, what type of code are you running that is causing this? Thanks |
The problem is that I'm not familiar enough with the retry decorator design to fix this myself, but it seems like |
@kylrth Thanks for the info, yea, I think I'm seeing similar. What kind of code are you running that causes it. For me it's doing a MapReduce. |
+1 on the issue. I got it on a chain.arun() where OpenAI returned a 502. `Error in on_retry: asyncio.run() cannot be called from a running event loop
|
I see it with just |
change types on sessoins.$id.$pageNum.tsx
@hwchase17 Any chance someone's looking at this? It's a source of high billables potentially. |
@maspotts I'm looking into this too, do you see the same issue on the latest version? @kylrth can you expand a bit more on why the asyncio.run is problematic here? I am running into this issue with agenerate, and notice my retries don't run after 4/8/10 seconds as they should - they are run after about 6-7 minutes, and I'm wondering if fixing this bug may fix my issue of retries from 502s failing. Maybe I can take a go at tackling this. |
Me too. A mapreduce chain via analayzeDocumentsChain |
I think this issue is closed by #8659. @hinthornw ? Could some of you experiencing the original error please test on v0.0.252 or later? |
@kylrth Hah, I was just running through the same PR. Looks like the way tenacity's retry decorator works takes care of the async/sync switch. Can I ask - can you verify that on recent langchain that retries do indeed work after X (2/4/8) seconds? For me it's hanging for 6-7 minutes between retries even though it prints our retrying in X time. |
So important notes regarding this issue from my investigation:
|
@hinthornw this was fixed in #8659 right? If so, lets close it |
Issue you'd like to raise.
I just saw a novel error, which appears to be triggered by a failed OpenAI API call (inside an asynchronous block) which is causing an asyncio.run() inside an asyncio.run(). Error pasted below. Is this my (user) error? Or possibly a problem with the acompletion_with_retry() implementation?
Suggestion:
No response
The text was updated successfully, but these errors were encountered: