@@ -40,6 +40,7 @@ def configure(
40
40
api_key : Optional [str ] = None ,
41
41
inference_pipeline_id : Optional [str ] = None ,
42
42
base_url : Optional [str ] = None ,
43
+ timeout : Optional [int ] = None ,
43
44
) -> None :
44
45
"""Configure the Openlayer tracer with custom settings.
45
46
@@ -52,6 +53,7 @@ def configure(
52
53
If not provided, falls back to OPENLAYER_INFERENCE_PIPELINE_ID environment variable.
53
54
base_url: The base URL for the Openlayer API. If not provided, falls back to
54
55
OPENLAYER_BASE_URL environment variable or the default.
56
+ timeout: The timeout for the Openlayer API. Defaults to 1 minute.
55
57
56
58
Examples:
57
59
>>> import openlayer.lib.tracing.tracer as tracer
@@ -62,11 +64,12 @@ def configure(
62
64
>>> def my_function():
63
65
... return "result"
64
66
"""
65
- global _configured_api_key , _configured_pipeline_id , _configured_base_url , _client
67
+ global _configured_api_key , _configured_pipeline_id , _configured_base_url , _configured_timeout , _client
66
68
67
69
_configured_api_key = api_key
68
70
_configured_pipeline_id = inference_pipeline_id
69
71
_configured_base_url = base_url
72
+ _configured_timeout = timeout
70
73
71
74
# Reset the client so it gets recreated with new configuration
72
75
_client = None
@@ -90,6 +93,9 @@ def _get_client() -> Optional[Openlayer]:
90
93
if _configured_base_url is not None :
91
94
client_kwargs ["base_url" ] = _configured_base_url
92
95
96
+ if _configured_timeout is not None :
97
+ client_kwargs ["timeout" ] = _configured_timeout
98
+
93
99
if _verify_ssl :
94
100
_client = Openlayer (** client_kwargs )
95
101
else :
0 commit comments