Skip to content

Commit fdc126e

Browse files
feat(package): export default constants (#1275)
1 parent 18dcd65 commit fdc126e

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Diff for: src/openai/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from ._models import BaseModel
1313
from ._version import __title__, __version__
1414
from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse
15+
from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS
1516
from ._exceptions import (
1617
APIError,
1718
OpenAIError,
@@ -63,6 +64,9 @@
6364
"AsyncOpenAI",
6465
"file_from_path",
6566
"BaseModel",
67+
"DEFAULT_TIMEOUT",
68+
"DEFAULT_MAX_RETRIES",
69+
"DEFAULT_CONNECTION_LIMITS",
6670
]
6771

6872
from .lib import azure as _azure

Diff for: src/openai/_base_client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@
7171
extract_response_type,
7272
)
7373
from ._constants import (
74-
DEFAULT_LIMITS,
7574
DEFAULT_TIMEOUT,
7675
MAX_RETRY_DELAY,
7776
DEFAULT_MAX_RETRIES,
7877
INITIAL_RETRY_DELAY,
7978
RAW_RESPONSE_HEADER,
8079
OVERRIDE_CAST_TO_HEADER,
80+
DEFAULT_CONNECTION_LIMITS,
8181
)
8282
from ._streaming import Stream, SSEDecoder, AsyncStream, SSEBytesDecoder
8383
from ._exceptions import (
@@ -747,7 +747,7 @@ def __init__(
747747
if http_client is not None:
748748
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
749749
else:
750-
limits = DEFAULT_LIMITS
750+
limits = DEFAULT_CONNECTION_LIMITS
751751

752752
if transport is not None:
753753
warnings.warn(
@@ -1294,7 +1294,7 @@ def __init__(
12941294
if http_client is not None:
12951295
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
12961296
else:
1297-
limits = DEFAULT_LIMITS
1297+
limits = DEFAULT_CONNECTION_LIMITS
12981298

12991299
if transport is not None:
13001300
warnings.warn(

Diff for: src/openai/_constants.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# default timeout is 10 minutes
99
DEFAULT_TIMEOUT = httpx.Timeout(timeout=600.0, connect=5.0)
1010
DEFAULT_MAX_RETRIES = 2
11-
DEFAULT_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
11+
DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
1212

1313
INITIAL_RETRY_DELAY = 0.5
1414
MAX_RETRY_DELAY = 8.0

0 commit comments

Comments
 (0)