Skip to content

Commit a1adbda

Browse files
committed
feat: default timeout set to 5 mins
1 parent 9855b65 commit a1adbda

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

portkey_ai/api_resources/base_client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
import platform
2121

2222
from portkey_ai.api_resources.apis.create_headers import createHeaders
23-
from .global_constants import PORTKEY_HEADER_PREFIX, DEFAULT_CONNECTION_LIMITS
23+
from .global_constants import (
24+
DEFAULT_TIMEOUT_CONFIG,
25+
PORTKEY_HEADER_PREFIX,
26+
DEFAULT_CONNECTION_LIMITS,
27+
)
2428
from .utils import remove_empty_values, Options, set_base_url
2529
from .exceptions import (
2630
APIStatusError,
@@ -184,6 +188,7 @@ def __init__(
184188
"Accept": "application/json",
185189
},
186190
limits=DEFAULT_CONNECTION_LIMITS,
191+
timeout=DEFAULT_TIMEOUT_CONFIG,
187192
)
188193

189194
self.response_headers: httpx.Headers | None = None
@@ -897,6 +902,7 @@ def __init__(
897902
"Accept": "application/json",
898903
},
899904
limits=DEFAULT_CONNECTION_LIMITS,
905+
timeout=DEFAULT_TIMEOUT_CONFIG,
900906
)
901907

902908
self.response_headers: httpx.Headers | None = None

portkey_ai/api_resources/global_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@
4949
DEFAULT_CONNECTION_LIMITS = httpx.Limits(
5050
max_connections=1000, max_keepalive_connections=100
5151
)
52+
DEFAULT_TIMEOUT_CONFIG = httpx.Timeout(timeout=600, connect=5.0)
5253
AUDIO_FILE_DURATION_HEADER = "x-portkey-audio-file-duration"

0 commit comments

Comments
 (0)