Also you want to add this to completions.py: ``` f...
# marvin-ai
d
Also you want to add this to completions.py:
Copy code
from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type
from anthropic import APIStatusError

@retry(
    stop=stop_after_attempt(5),
    wait=wait_exponential(multiplier=1, min=4, max=10),
    retry=retry_if_exception_type(APIStatusError),
    reraise=True
)
def _completion_generator(
    messages: list[MessageType],
    model: lc_models.BaseChatModel,
    tools: Optional[list[Callable]],
    max_iterations: int,
    stream: bool,
    agent: Optional["Agent"] = None,
    **kwargs,
) -> Generator[CompletionEvent, None, None]: