Coding: implement an API call retry with exponential backoff (for LLM/API calls), with production follow-ups.
Asked in the Coding round stage. Listed in the creator's description of his Wipro Gen AI Engineer coding round.
Implement retry_api_call(outcomes, max_retries, base_delay). outcomes is an ordered list containing success, timeout, rate_limit, or bad_request. Retry only timeout and rate_limit. Return a dictionary with the final status, total attempts, and retry delays. The delay before retry number r, starting at zero, is base_delay * 2^r.
def retry_api_call(outcomes, max_retries, base_delay):