# the library's LLM wrapper - retry-with-backoff, built into every parse call def llm_parse(*, input, text_format, max_retries=6, cache=True, **opts): for attempt in range(max_retries): try: return client.responses.parse(input=input, text_format=text_format) except Exception as err: if not is_retriable(err): # timeout/429/5xx retry ; raise # context-length never does if attempt == max_retries - 1: raise # hard cap -> propagate delay = _compute_delay(attempt, base=2, cap=60, jitter=0.3, retry_after=extract_retry_after(err)) # 2,4,..,60s time.sleep(delay) # honour Retry-After floor