podcast_llm.utils.rate_limits

podcast_llm.utils.rate_limits.rate_limit_per_minute(max_requests_per_minute: int)[source]

Decorator that adds per-minute rate limiting to a function.

Parameters:

max_requests_per_minute (int) – Maximum number of requests allowed per minute

Returns:

Decorated function with rate limiting

Return type:

Callable

podcast_llm.utils.rate_limits.retry_with_exponential_backoff(max_retries: int, base_delay: float = 1.0)[source]

Decorator that retries a function with exponential backoff when exceptions occur.

Parameters:
  • max_retries (int) – Maximum number of retry attempts

  • base_delay (float) – Initial delay between retries in seconds. Will be exponentially increased.

Returns:

Decorated function with retry logic

Return type:

Callable

Example

@retry_with_exponential_backoff(max_retries=3, base_delay=1.0) def flaky_function():

# Function that may fail intermittently pass