Skip to content

Chat.create removes "timeout" from args #322

Closed
@coreyb42

Description

@coreyb42

Describe the bug

When making a call to the ChatCompletion create method, e.g.:

response = openai.ChatCompletion.create(
        model=self.model_id,
        messages=self.get_formatted_messages(),
        timeout=10
    )

The timeout is popd off of the kwargs by this line in the completion class (link):

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

The pop method removes the arg from kwargs before it's passed to super, which means that the timeout doesn't have the intended effect (the local method there does do some stuff with it, but that would only allow you to increase the timeout).

To Reproduce

Run an API call with a shorter timeout:

response = openai.ChatCompletion.create(
        model=self.model_id,
        messages=self.get_formatted_messages(),
        timeout=10
    )

And observe that said timeout is not respected. The timeout remains 600 seconds.

Code snippets

No response

OS

macOS

Python version

3.10.9

Library version

openai==0.27.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed in v1Issues addressed by the v1 beta

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions