Skip to content

The agent engineering platform.

core: Don't draw None edge labels (#24690)

Nuno Campos8734cabc0936
diff --git a/libs/core/langchain_core/runnables/graph_png.py b/libs/core/langchain_core/runnables/graph_png.py
index ae3edaa7da..9cd48b4594 100644
--- a/libs/core/langchain_core/runnables/graph_png.py
+++ b/libs/core/langchain_core/runnables/graph_png.py
@@ -174,7 +174,9 @@ class PngDrawer:
graph: The graph to draw.
"""
for start, end, data, cond in graph.edges:
- self.add_edge(viz, start, end, str(data), cond)
+ self.add_edge(
+ viz, start, end, str(data) if data is not None else None, cond
+ )
def update_styles(self, viz: Any, graph: Graph) -> None:
"""Update the styles of the entrypoint and END nodes.