From fd0b52f4fff114930d1b3f677c6aa3cb2b0858d8 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Wed, 18 Sep 2024 10:23:52 -0700 Subject: [PATCH] Update retry.py --- libs/langgraph/langgraph/pregel/retry.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/langgraph/langgraph/pregel/retry.py b/libs/langgraph/langgraph/pregel/retry.py index 34374962a..27ff67169 100644 --- a/libs/langgraph/langgraph/pregel/retry.py +++ b/libs/langgraph/langgraph/pregel/retry.py @@ -2,7 +2,7 @@ import asyncio import logging import random import time -from typing import Optional +from typing import Optional, Sequence from langgraph.constants import CONFIG_KEY_RESUMING from langgraph.errors import GraphInterrupt @@ -38,7 +38,7 @@ def run_with_retry( # increment attempts attempts += 1 # check if we should retry - if isinstance(retry_policy.retry_on, (list, tuple)): + if isinstance(retry_policy.retry_on, Sequence): if not isinstance(exc, tuple(retry_policy.retry_on)): raise elif isinstance(retry_policy.retry_on, type) and issubclass(retry_policy.retry_on, Exception): @@ -102,7 +102,7 @@ async def arun_with_retry( # increment attempts attempts += 1 # check if we should retry - if isinstance(retry_policy.retry_on, (list, tuple)): + if isinstance(retry_policy.retry_on, Sequence): if not isinstance(exc, tuple(retry_policy.retry_on)): raise elif isinstance(retry_policy.retry_on, type) and issubclass(retry_policy.retry_on, Exception):