|
47 | 47 | from tenacity.wait import wait_base |
48 | 48 | from typing_extensions import TypedDict |
49 | 49 |
|
50 | | -from uipath.llm_client.utils.exceptions import UiPathAPIError, UiPathRateLimitError |
| 50 | +from uipath.llm_client.utils.exceptions import ( |
| 51 | + UiPathAPIError, |
| 52 | + UiPathRateLimitError, |
| 53 | + UiPathTooManyRequestsError, |
| 54 | +) |
51 | 55 |
|
52 | 56 | # Default retry configuration values |
53 | | -_DEFAULT_RETRY_ON_EXCEPTIONS: tuple[type[Exception], ...] = (UiPathRateLimitError,) |
| 57 | +_DEFAULT_RETRY_ON_EXCEPTIONS: tuple[type[Exception], ...] = ( |
| 58 | + UiPathRateLimitError, |
| 59 | + UiPathTooManyRequestsError, |
| 60 | +) |
54 | 61 | _DEFAULT_INITIAL_DELAY: float = 2.0 |
55 | 62 | _DEFAULT_MAX_DELAY: float = 60.0 |
56 | 63 | _DEFAULT_EXP_BASE: float = 2.0 |
@@ -157,7 +164,7 @@ def _build_retryer( |
157 | 164 | """Build a tenacity retryer from configuration. |
158 | 165 |
|
159 | 166 | Args: |
160 | | - max_retries: Maximum number of retry attempts. Returns None if <= 1. |
| 167 | + max_retries: Maximum number of retry attempts. Returns None if < 1 (i.e., 0 or negative). |
161 | 168 | retry_config: Configuration for retry behavior. Uses defaults if not provided. |
162 | 169 | logger: Logger for retry attempt warnings. |
163 | 170 | async_mode: If True, returns AsyncRetrying; otherwise returns Retrying. |
@@ -217,7 +224,7 @@ def __init__( |
217 | 224 | """Initialize the retryable transport. |
218 | 225 |
|
219 | 226 | Args: |
220 | | - max_retries: Maximum number of retry attempts. Set to 1 to disable retries. |
| 227 | + max_retries: Maximum number of retry attempts. Set to 0 (default) to disable retries. |
221 | 228 | retry_config: Configuration for retry behavior. Uses defaults if not provided. |
222 | 229 | logger: Logger for retry attempt warnings. |
223 | 230 | *args: Positional arguments passed to HTTPTransport. |
@@ -281,7 +288,7 @@ def __init__( |
281 | 288 | """Initialize the retryable async transport. |
282 | 289 |
|
283 | 290 | Args: |
284 | | - max_retries: Maximum number of retry attempts. Set to 1 to disable retries. |
| 291 | + max_retries: Maximum number of retry attempts. Set to 0 (default) to disable retries. |
285 | 292 | retry_config: Configuration for retry behavior. Uses defaults if not provided. |
286 | 293 | logger: Logger for retry attempt warnings. |
287 | 294 | *args: Positional arguments passed to AsyncHTTPTransport. |
|
0 commit comments