Skip to content

Commit 6ee4799

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(package): export default constants (#334)
1 parent 7961a22 commit 6ee4799

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

src/finch/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ._models import BaseModel
88
from ._version import __title__, __version__
99
from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse
10+
from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS
1011
from ._exceptions import (
1112
APIError,
1213
FinchError,
@@ -58,6 +59,9 @@
5859
"AsyncFinch",
5960
"file_from_path",
6061
"BaseModel",
62+
"DEFAULT_TIMEOUT",
63+
"DEFAULT_MAX_RETRIES",
64+
"DEFAULT_CONNECTION_LIMITS",
6165
]
6266

6367
_setup_logging()

src/finch/_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(

src/finch/_client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
3131
from ._exceptions import APIStatusError
3232
from ._base_client import (
33-
DEFAULT_LIMITS,
3433
DEFAULT_MAX_RETRIES,
34+
DEFAULT_CONNECTION_LIMITS,
3535
SyncAPIClient,
3636
AsyncAPIClient,
3737
SyncHttpxClientWrapper,
@@ -273,7 +273,7 @@ def copy(
273273

274274
http_client = None
275275
else:
276-
if self._limits is not DEFAULT_LIMITS:
276+
if self._limits is not DEFAULT_CONNECTION_LIMITS:
277277
connection_pool_limits = self._limits
278278
else:
279279
connection_pool_limits = None
@@ -621,7 +621,7 @@ def copy(
621621

622622
http_client = None
623623
else:
624-
if self._limits is not DEFAULT_LIMITS:
624+
if self._limits is not DEFAULT_CONNECTION_LIMITS:
625625
connection_pool_limits = self._limits
626626
else:
627627
connection_pool_limits = None

src/finch/_constants.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# default timeout is 1 minute
99
DEFAULT_TIMEOUT = httpx.Timeout(timeout=60.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)