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-coreutilsmustacherender
    Function●Since v0.1

    render

    Render a mustache template.

    Renders a mustache template with a data scope and inline partial capability.

    Copy
    render(
      template: str | list[tuple[str, str]] = '',
      data: Mapping[str, Any] = EMPTY_DICT,
      partials_dict: Mapping[str, str] = EMPTY_DICT,
      padding: str = '',
      def_ldel: str = '{{',
        def_rdel: str = '}}',
      scopes: Scopes | None = None,
      warn: bool = False,
      keep: bool = False
    ) -> str

    Parameters

    NameTypeDescription
    templatestr | list[tuple[str, str]]
    Default:''

    A file-like object or a string containing the template.

    dataMapping[str, Any]
    Default:EMPTY_DICT

    A python dictionary with your data scope.

    partials_dictMapping[str, str]
    Default:EMPTY_DICT

    A python dictionary which will be search for partials before the filesystem is.

    {'include': 'foo'} is the same as a file called include.mustache (defaults to {}).

    paddingstr
    Default:''

    This is for padding partials, and shouldn't be used (but can be if you really want to).

    def_ldelstr
    Default:'{{'

    The default left delimiter

    ('{{' by default, as in spec compliant mustache).

    def_rdelstr
    Default:'}}'

    The default right delimiter

    ('}}' by default, as in spec compliant mustache).

    scopesScopes | None
    Default:None

    The list of scopes that get_key will look through.

    warnbool
    Default:False

    Log a warning when a template substitution isn't found in the data

    keepbool
    Default:False

    Keep unreplaced tags when a substitution isn't found in the data.

    View source on GitHub