mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-23 08:02:23 +02:00
Fix recursion check
This commit is contained in:
@@ -712,12 +712,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(
|
||||
@@ -837,6 +831,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))
|
||||
@@ -980,12 +980,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(
|
||||
@@ -1116,6 +1110,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))
|
||||
|
||||
Reference in New Issue
Block a user