mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-22 15:42:25 +02:00
pregel: update validation error messages (#3517)
OK not including as well, but this was useful for troubleshooting as a new user (especially before there were any examples)
This commit is contained in:
@@ -32,11 +32,17 @@ def validate_graph(
|
||||
|
||||
for chan in subscribed_channels:
|
||||
if chan not in channels:
|
||||
raise ValueError(f"Subscribed channel '{chan}' not in 'channels'")
|
||||
raise ValueError(
|
||||
f"Subscribed channel '{chan}' not "
|
||||
f"in known channels: '{repr(sorted(channels))[:100]}'"
|
||||
)
|
||||
|
||||
if isinstance(input_channels, str):
|
||||
if input_channels not in channels:
|
||||
raise ValueError(f"Input channel '{input_channels}' not in 'channels'")
|
||||
raise ValueError(
|
||||
f"Input channel '{input_channels}' not "
|
||||
f"in known channels: '{repr(sorted(channels))[:100]}'"
|
||||
)
|
||||
if input_channels not in subscribed_channels:
|
||||
raise ValueError(
|
||||
f"Input channel {input_channels} is not subscribed to by any node"
|
||||
@@ -44,10 +50,13 @@ def validate_graph(
|
||||
else:
|
||||
for chan in input_channels:
|
||||
if chan not in channels:
|
||||
raise ValueError(f"Input channel '{chan}' not in 'channels'")
|
||||
raise ValueError(
|
||||
f"Input channel '{chan}' not in '{repr(sorted(channels))[:100]}'"
|
||||
)
|
||||
if all(chan not in subscribed_channels for chan in input_channels):
|
||||
raise ValueError(
|
||||
f"None of the input channels {input_channels} are subscribed to by any node"
|
||||
f"None of the input channels {input_channels} "
|
||||
f"are subscribed to by any node"
|
||||
)
|
||||
|
||||
all_output_channels = set[str]()
|
||||
@@ -62,7 +71,10 @@ def validate_graph(
|
||||
|
||||
for chan in all_output_channels:
|
||||
if chan not in channels:
|
||||
raise ValueError(f"Output channel '{chan}' not in 'channels'")
|
||||
raise ValueError(
|
||||
f"Output channel '{chan}' not "
|
||||
f"in known channels: '{repr(sorted(channels))[:100]}'"
|
||||
)
|
||||
|
||||
if interrupt_after_nodes != "*":
|
||||
for n in interrupt_after_nodes:
|
||||
|
||||
Reference in New Issue
Block a user