Skip to content

Commit

Permalink
core: fix return of draw_mermaid_png and change to not save image by …
Browse files Browse the repository at this point in the history
…default (langchain-ai#19950)

- **Description:** Improvement for langchain-ai#19599: fixing missing return of
graph.draw_mermaid_png and improve it to make the saving of the rendered
image optional

Co-authored-by: Angel Igareta <[email protected]>
  • Loading branch information
angeligareta and angeligareta authored Apr 3, 2024
1 parent 4328c54 commit 31a641a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/core/langchain_core/runnables/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,19 +369,19 @@ def draw_mermaid_png(
start="#ffdfba", end="#baffc9", other="#fad7de"
),
wrap_label_n_words: int = 9,
output_file_path: str = "graph.png",
output_file_path: Optional[str] = None,
draw_method: MermaidDrawMethod = MermaidDrawMethod.API,
background_color: str = "white",
padding: int = 10,
) -> None:
) -> bytes:
from langchain_core.runnables.graph_mermaid import draw_mermaid_png

mermaid_syntax = self.draw_mermaid(
curve_style=curve_style,
node_colors=node_colors,
wrap_label_n_words=wrap_label_n_words,
)
draw_mermaid_png(
return draw_mermaid_png(
mermaid_syntax=mermaid_syntax,
output_file_path=output_file_path,
draw_method=draw_method,
Expand Down

0 comments on commit 31a641a

Please sign in to comment.