Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Repository = "https://github.com/openai/openai-python"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]
http2 = ["httpx[http2]"]
realtime = ["websockets >= 13, < 16"]
datalib = ["numpy >= 1", "pandas >= 1.2.3", "pandas-stubs >= 1.1.0.11"]
voice_helpers = ["sounddevice>=0.5.1", "numpy>=2.0.2"]
Expand Down
9 changes: 9 additions & 0 deletions src/openai/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
from httpx import URL
from pydantic import PrivateAttr

try:
import h2 # noqa: F401

_HTTP2_AVAILABLE = True
except ImportError:
_HTTP2_AVAILABLE = False

from . import _exceptions
from ._qs import Querystring
from ._files import to_httpx_files, async_to_httpx_files
Expand Down Expand Up @@ -836,6 +843,7 @@ def __init__(self, **kwargs: Any) -> None:
kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
kwargs.setdefault("follow_redirects", True)
kwargs.setdefault("http2", _HTTP2_AVAILABLE)
super().__init__(**kwargs)


Expand Down Expand Up @@ -1423,6 +1431,7 @@ def __init__(self, **kwargs: Any) -> None:
kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
kwargs.setdefault("follow_redirects", True)
kwargs.setdefault("http2", _HTTP2_AVAILABLE)
super().__init__(**kwargs)


Expand Down