Merge pull request #411 from langchain-ai/nc/7may/fix-recursion-issue

Fix recursion check
This commit is contained in:
Nuno Campos
2024-05-07 08:33:27 -07:00
committed by GitHub
+12 -12
View File
@@ -708,12 +708,6 @@ class Pregel(
raise ValueError("No tasks to run in graph.")
else:
break
elif step == config["recursion_limit"]:
raise GraphRecursionError(
f"Recursion limit of {config['recursion_limit']} reached"
"without hitting a stop condition. You can increase the "
"limit by setting the `recursion_limit` config key."
)
# before execution, check if we should interrupt
if _should_interrupt(
@@ -833,6 +827,12 @@ class Pregel(
next_tasks,
):
break
else:
raise GraphRecursionError(
f"Recursion limit of {config['recursion_limit']} reached"
"without hitting a stop condition. You can increase the "
"limit by setting the `recursion_limit` config key."
)
# set final channel values as run output
run_manager.on_chain_end(read_channels(channels, output_keys))
@@ -976,12 +976,6 @@ class Pregel(
raise ValueError("No tasks to run in graph.")
else:
break
elif step == config["recursion_limit"]:
raise GraphRecursionError(
f"Recursion limit of {config['recursion_limit']} reached"
"without hitting a stop condition. You can increase the limit"
"by setting the `recursion_limit` config key."
)
# before execution, check if we should interrupt
if _should_interrupt(
@@ -1112,6 +1106,12 @@ class Pregel(
next_tasks,
):
break
else:
raise GraphRecursionError(
f"Recursion limit of {config['recursion_limit']} reached"
"without hitting a stop condition. You can increase the limit"
"by setting the `recursion_limit` config key."
)
# set final channel values as run output
await run_manager.on_chain_end(read_channels(channels, output_keys))