Generic retry decorator for ChatInvoker with exponential backoff, fully tested and production‑ready.
// Source: https://github.com/infiniflow/ragflow | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works // Provided via justclaw.it.com; keep this notice with the code. // Package component — retry decorator for ChatInvoker. // // retryInvoker wraps any ChatInvoker and retries it on error with // exponential backoff. It mirrors Python's // // for attempt in range(max_retries + 1): // try: return self._chat(...) // except: time.sleep(delay * 2 ** attempt) // // semantics from agent/component/llm.py (the actual loop is hidden // inside LLMBundle / Base._chat; for the Go port we implement it // directly at the ChatInvoker boundary so every chat path // — LLMComponent, Agent component, citation grounding — benefits // without touching the call sit ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key