1313 resource_override ,
1414)
1515
16+ from uipath_langchain ._utils ._environment import get_default_timeout
17+
1618from .http_client import build_uipath_headers , resolve_gateway_url
1719from .http_client .header_capture import HeaderCapture
1820from .http_client .retryers .bedrock import AsyncBedrockRetryer , BedrockRetryer
@@ -68,6 +70,7 @@ def __init__(
6870 agenthub_config : Optional [str ] = None ,
6971 byo_connection_id : Optional [str ] = None ,
7072 header_capture : HeaderCapture | None = None ,
73+ timeout : float | None = None ,
7174 ):
7275 self .model = model
7376 self .token = token
@@ -78,6 +81,7 @@ def __init__(
7881 self ._url : Optional [str ] = None
7982 self ._is_override : bool = False
8083 self .header_capture = header_capture
84+ self .timeout = timeout if timeout is not None else get_default_timeout ()
8185
8286 @property
8387 def endpoint (self ) -> str :
@@ -120,7 +124,7 @@ def get_client(self):
120124 verify = ca_bundle if ca_bundle is not None else False ,
121125 config = self ._unsigned_config (
122126 retries = {"total_max_attempts" : 1 },
123- read_timeout = 300 ,
127+ read_timeout = self . timeout ,
124128 ),
125129 )
126130 client .meta .events .register (
@@ -180,6 +184,7 @@ def __init__(
180184 byo_connection_id : Optional [str ] = None ,
181185 retryer : Optional [Retrying ] = None ,
182186 aretryer : Optional [AsyncRetrying ] = None ,
187+ timeout : float | None = None ,
183188 ** kwargs ,
184189 ):
185190 org_id = org_id or os .getenv ("UIPATH_ORGANIZATION_ID" )
@@ -205,6 +210,7 @@ def __init__(
205210 api_flavor = "converse" ,
206211 agenthub_config = agenthub_config ,
207212 byo_connection_id = byo_connection_id ,
213+ timeout = timeout ,
208214 )
209215
210216 kwargs ["client" ] = passthrough_client .get_client ()
@@ -242,6 +248,7 @@ def __init__(
242248 byo_connection_id : Optional [str ] = None ,
243249 retryer : Optional [Retrying ] = None ,
244250 aretryer : Optional [AsyncRetrying ] = None ,
251+ timeout : float | None = None ,
245252 ** kwargs ,
246253 ):
247254 org_id = org_id or os .getenv ("UIPATH_ORGANIZATION_ID" )
@@ -270,6 +277,7 @@ def __init__(
270277 agenthub_config = agenthub_config ,
271278 byo_connection_id = byo_connection_id ,
272279 header_capture = header_capture ,
280+ timeout = timeout ,
273281 )
274282
275283 kwargs ["client" ] = passthrough_client .get_client ()
0 commit comments