Detect if an error message indicates a rate limit. Uses regex patterns with word boundaries to avoid false positives like "PR #429", "please wait while I...", or "Node v14.29.0". Args: error_message: The error message to check Returns: True if the message indi
(error_message: str)
| 65 | |
| 66 | |
| 67 | def is_rate_limit_error(error_message: str) -> bool: |
| 68 | """ |
| 69 | Detect if an error message indicates a rate limit. |
| 70 | |
| 71 | Uses regex patterns with word boundaries to avoid false positives |
| 72 | like "PR #429", "please wait while I...", or "Node v14.29.0". |
| 73 | |
| 74 | Args: |
| 75 | error_message: The error message to check |
| 76 | |
| 77 | Returns: |
| 78 | True if the message indicates a rate limit, False otherwise. |
| 79 | """ |
| 80 | return bool(_RATE_LIMIT_REGEX.search(error_message)) |
| 81 | |
| 82 | |
| 83 | def calculate_rate_limit_backoff(retries: int) -> int: |
no outgoing calls