draw_mermaid_png#
- langchain_core.runnables.graph_mermaid.draw_mermaid_png(
- mermaid_syntax: str,
- output_file_path: str | None = None,
- draw_method: MermaidDrawMethod = MermaidDrawMethod.API,
- background_color: str | None = 'white',
- padding: int = 10,
- max_retries: int = 1,
- retry_delay: float = 1.0,
Draws a Mermaid graph as PNG using provided syntax.
- Parameters:
mermaid_syntax (str) β Mermaid graph syntax.
output_file_path (str, optional) β Path to save the PNG image. Defaults to None.
draw_method (MermaidDrawMethod, optional) β Method to draw the graph. Defaults to MermaidDrawMethod.API.
background_color (str, optional) β Background color of the image. Defaults to βwhiteβ.
padding (int, optional) β Padding around the image. Defaults to 10.
max_retries (int, optional) β Maximum number of retries (MermaidDrawMethod.API). Defaults to 1.
retry_delay (float, optional) β Delay between retries (MermaidDrawMethod.API). Defaults to 1.0.
- Returns:
PNG image bytes.
- Return type:
bytes
- Raises:
ValueError β If an invalid draw method is provided.