Skip to content
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

timeout paramter is not respected in openai.ChatCompletion.create method #549

Closed
ivan-shaporov opened this issue Jul 26, 2023 · 2 comments
Closed

Comments

@ivan-shaporov
Copy link

Describe the bug

openai.ChatCompletion.create takes timeout parameter but the call might take significantly longer without timing out.

I think it is because of this code:

timeout = kwargs.pop("timeout", None)

while True:
    try:
        return super().create(*args, **kwargs)

Wouldn't it be more consistent overall if you replace pop with get, like this:

timeout = kwargs.get("timeout", None)

To Reproduce

run
openai.ChatCompletion.create(timeout=1, the rest of parameters...)

expected the call either complete under 1 second or fail.

actual: it can take more than 1 second.

Code snippets

No response

OS

Windows 11

Python version

Python 3.9.13

Library version

openai 0.27.8

@ivan-shaporov ivan-shaporov added the bug Something isn't working label Jul 26, 2023
@szlhl1040
Copy link

you can use "request_timeout"
#322 (comment)

@logankilpatrick logankilpatrick removed the bug Something isn't working label Sep 6, 2023
@logankilpatrick
Copy link
Contributor

Yes, please use request_timeout as is mentioned in the README: https://github.com/openai/openai-python#params

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants