Skip to content

Commit

Permalink
Merge pull request #2468 from cab938/issue2159
Browse files Browse the repository at this point in the history
feat: Make CompiledGraph displayable in Jupyter with display()
  • Loading branch information
nfcampos authored Dec 5, 2024
2 parents b3bf4dd + 9f73dfa commit a275ab2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libs/langgraph/langgraph/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,3 +629,10 @@ def add_edge(
add_edge(key, end, conditional=True)

return graph

def _repr_mimebundle_(self, **kwargs: Any) -> dict[str, Any]:
"""Mime bundle used by Jupyter to display the graph"""
return {
"text/plain": repr(self),
"image/png": self.get_graph().draw_mermaid_png(),
}

0 comments on commit a275ab2

Please sign in to comment.