Commit 1e55d60e
Changed files (3)
src
src/openai/__init__.py
@@ -12,6 +12,7 @@ from ._client import Client, OpenAI, Stream, Timeout, Transport, AsyncClient, As
from ._models import BaseModel
from ._version import __title__, __version__
from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse
+from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS
from ._exceptions import (
APIError,
OpenAIError,
@@ -63,6 +64,9 @@ __all__ = [
"AsyncOpenAI",
"file_from_path",
"BaseModel",
+ "DEFAULT_TIMEOUT",
+ "DEFAULT_MAX_RETRIES",
+ "DEFAULT_CONNECTION_LIMITS",
]
from .lib import azure as _azure
src/openai/_base_client.py
@@ -71,13 +71,13 @@ from ._response import (
extract_response_type,
)
from ._constants import (
- DEFAULT_LIMITS,
DEFAULT_TIMEOUT,
MAX_RETRY_DELAY,
DEFAULT_MAX_RETRIES,
INITIAL_RETRY_DELAY,
RAW_RESPONSE_HEADER,
OVERRIDE_CAST_TO_HEADER,
+ DEFAULT_CONNECTION_LIMITS,
)
from ._streaming import Stream, SSEDecoder, AsyncStream, SSEBytesDecoder
from ._exceptions import (
@@ -747,7 +747,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
if http_client is not None:
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
else:
- limits = DEFAULT_LIMITS
+ limits = DEFAULT_CONNECTION_LIMITS
if transport is not None:
warnings.warn(
@@ -1294,7 +1294,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
if http_client is not None:
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
else:
- limits = DEFAULT_LIMITS
+ limits = DEFAULT_CONNECTION_LIMITS
if transport is not None:
warnings.warn(
src/openai/_constants.py
@@ -8,7 +8,7 @@ OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to"
# default timeout is 10 minutes
DEFAULT_TIMEOUT = httpx.Timeout(timeout=600.0, connect=5.0)
DEFAULT_MAX_RETRIES = 2
-DEFAULT_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
+DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
INITIAL_RETRY_DELAY = 0.5
MAX_RETRY_DELAY = 8.0