langchain_core.utils.mustache.render

langchain_core.utils.mustache.render(template: Union[str, List[Tuple[str, str]]] = '', data: Dict[str, Any] = {}, partials_dict: Dict[str, str] = {}, padding: str = '', def_ldel: str = '{{', def_rdel: str = '}}', scopes: Optional[List[Union[Literal[False, 0], Dict[str, Any]]]] = None, warn: bool = False, keep: bool = False) str[source]

Render a mustache template.

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

Arguments:

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

data – A python dictionary with your data scope

partials_path – The path to where your partials are stored

If set to None, then partials won’t be loaded from the file system (defaults to ‘.’)

partials_ext – The extension that you want the parser to look for

(defaults to ‘mustache’)

partials_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 {})

padding – This is for padding partials, and shouldn’t be used

(but can be if you really want to)

def_ldel – The default left delimiter

(“{{” by default, as in spec compliant mustache)

def_rdel – The default right delimiter

(“}}” by default, as in spec compliant mustache)

scopes – The list of scopes that get_key will look through

warn – Log a warning when a template substitution isn’t found in the data

keep – Keep unreplaced tags when a substitution isn’t found in the data

Returns:

A string containing the rendered template.

Parameters
  • template (Union[str, List[Tuple[str, str]]]) –

  • data (Dict[str, Any]) –

  • partials_dict (Dict[str, str]) –

  • padding (str) –

  • def_ldel (str) –

  • def_rdel (str) –

  • scopes (Optional[List[Union[Literal[False, 0], ~typing.Dict[str, ~typing.Any]]]]) –

  • warn (bool) –

  • keep (bool) –

Return type

str