mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-11 22:04:37 +00:00
core: fix return of draw_mermaid_png and change to not save image by default (#19950)
- **Description:** Improvement for #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 <angel.igareta@klarna.com>
This commit is contained in:
parent
4328c54aab
commit
31a641a155
@ -369,11 +369,11 @@ class Graph:
|
||||
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(
|
||||
@ -381,7 +381,7 @@ class Graph:
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user