Skip to content

Commit 8b302e6

Browse files
authored
server side max_timeout (#62)
* server side max_timeout; timeout value validation
1 parent 59f4f1e commit 8b302e6

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.1.3] - 2025-05-13
11+
12+
### Changed
13+
14+
- Add server side max_timeout
15+
- Add validation check for timeout to be > 0
16+
1017
## [1.1.2] - 2025-05-05
1118

1219
### Changed
@@ -149,7 +156,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
149156

150157
- Release of the Cleanlab TLM Python client.
151158

152-
[Unreleased]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.2...HEAD
159+
[Unreleased]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.3...HEAD
160+
[1.1.3]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.2...v1.1.3
153161
[1.1.2]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.1...v1.1.2
154162
[1.1.1]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.0...v1.1.1
155163
[1.1.0]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.0.23...v1.1.0

src/cleanlab_tlm/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# SPDX-License-Identifier: MIT
2-
__version__ = "1.1.2"
2+
__version__ = "1.1.3"

src/cleanlab_tlm/internal/base.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import asyncio
88
import os
99
import sys
10-
from typing import TYPE_CHECKING, Optional
10+
from typing import TYPE_CHECKING, Optional, Union
1111

1212
from cleanlab_tlm.errors import MissingApiKeyError, ValidationError
1313
from cleanlab_tlm.internal.concurrency import TlmRateHandler
@@ -75,15 +75,20 @@ def __init__(
7575

7676
self._quality_preset = quality_preset
7777

78-
if timeout is not None and not (isinstance(timeout, (float, int))):
79-
raise ValidationError("timeout must be a integer or float value")
78+
self._timeout: Optional[Union[int, float]] = None
79+
if timeout is not None:
80+
if not isinstance(timeout, (float, int)):
81+
raise ValidationError("timeout must be a integer or float value")
82+
if timeout <= 0:
83+
raise ValidationError("timeout must be a positive value")
84+
self._timeout = timeout
85+
self._options["max_timeout"] = self._timeout
8086

8187
if verbose is not None and not isinstance(verbose, bool):
8288
raise ValidationError("verbose must be a boolean value")
8389

8490
is_notebook_flag = is_notebook()
8591

86-
self._timeout = timeout if timeout is not None and timeout > 0 else None
8792
self._verbose = verbose if verbose is not None else is_notebook_flag
8893

8994
if is_notebook_flag:

0 commit comments

Comments
 (0)