MCPcopy Index your code
hub / github.com/AutoForgeAI/autoforge / is_rate_limit_error

Function is_rate_limit_error

rate_limit_utils.py:67–80  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

65
66
67def 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
83def calculate_rate_limit_backoff(retries: int) -> int:

Calls

no outgoing calls