timeout not being respected by client.beta.threads.runs.create_and_poll (or .OpenAI)
Confirm this is an issue with the Python library and not an underlying OpenAI API
- [X] This is an issue with the Python library
Describe the bug
Calling client.beta.threads.runs.create_and_poll(..., timeout=2.0) will wait as long as it takes before returning (6s, 5 minutes).
To Reproduce
Call client.beta.threads.runs.create_and_poll(..., timeout=2.0) and observe that it does not timeout.
Code snippets
No response
OS
Windows
Python version
Python 3.9
Library version
openai 1.51.2
Hi there! I noticed your issue and thought I’d share this related discussion that might offer some insights:
Thank you for trying to help. That's actually a thread I started as well.
My expectations of a timeout parameter in a create_and_poll function would be that it would terminate the function if the specified amount of time passed with no resolution. Unfortunately, there’s no documentation of that parameter that I can find.
The other poster explains that the timeout parameter actually has to do with some internal networking stuff, and won't actually timeout the request. I'm not 100% sure he is correct, but if so, it's a weird thing to include, and misleading.
I do see that the underlying OpenAI API takes an expires_at parameter, which the Python library might have been able to use for real elegance, going a step beyond, but that parameter isn’t really documented either.
On Fri, Jan 17, 2025 at 11:25 PM Ranuga @.***> wrote:
Hi there! I noticed your issue and thought I’d share this related discussion that might offer some insights:
- Timeout not honored in Assistants Python API https://community.openai.com/t/timeout-not-honored-in-assistants-python-api/663086/1
— Reply to this email directly, view it on GitHub https://github.com/openai/openai-python/issues/1855#issuecomment-2599520025, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHIPPEXKRITIZ52IPBKJP32LHJUVAVCNFSM6AAAAABRKGDW42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJZGUZDAMBSGU . You are receiving this because you authored the thread.Message ID: @.***>