LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-corerunnablesgraphGraphdraw_mermaid_png
    Method●Since v0.1

    draw_mermaid_png

    Copy
    draw_mermaid_png(
      self,
      *,
      curve_style: CurveStyle = CurveStyle.LINEAR,
      node_colors:
    View source on GitHub
    NodeStyles
    |
    None
    =
    None
    ,
    wrap_label_n_words
    :
    int
    =
    9
    ,
    output_file_path
    :
    str
    |
    None
    =
    None
    ,
    draw_method
    :
    MermaidDrawMethod
    =
    MermaidDrawMethod
    .
    API
    ,
    background_color
    :
    str
    =
    'white'
    ,
    padding
    :
    int
    =
    10
    ,
    max_retries
    :
    int
    =
    1
    ,
    retry_delay
    :
    float
    =
    1.0
    ,
    frontmatter_config
    :
    dict
    [
    str
    ,
    Any
    ]
    |
    None
    =
    None
    ,
    base_url
    :
    str
    |
    None
    =
    None
    ,
    proxies
    :
    dict
    [
    str
    ,
    str
    ]
    |
    None
    =
    None
    )
    ->
    bytes

    Parameters

    NameTypeDescription
    curve_styleCurveStyle
    Default:CurveStyle.LINEAR

    The style of the edges.

    node_colorsNodeStyles | None
    Default:None

    The colors of the nodes.

    wrap_label_n_wordsint
    Default:9
    output_file_pathstr | None
    Default:None
    draw_methodMermaidDrawMethod
    Default:MermaidDrawMethod.API
    background_colorstr
    Default:'white'
    paddingint
    Default:10
    max_retriesint
    Default:1
    retry_delayfloat
    Default:1.0
    frontmatter_configdict[str, Any] | None
    Default:None
    base_urlstr | None
    Default:None
    proxiesdict[str, str] | None
    Default:None

    Draw the graph as a PNG image using Mermaid.

    The number of words to wrap the node labels at.

    The path to save the image to. If None, the image is not saved.

    The method to use to draw the graph.

    The color of the background.

    The padding around the graph.

    The maximum number of retries (MermaidDrawMethod.API).

    The delay between retries (MermaidDrawMethod.API).

    The base URL of the Mermaid server for rendering via API.

    HTTP/HTTPS proxies for requests (e.g. {"http": "http://127.0.0.1:7890"}).

    Mermaid frontmatter config. Can be used to customize theme and styles. Will be converted to YAML and added to the beginning of the mermaid graph.

    See more here: https://mermaid.js.org/config/configuration.html.

    Example config:

    {
        "config": {
            "theme": "neutral",
            "look": "handDrawn",
            "themeVariables": {"primaryColor": "#e2e2e2"},
        }
    }