tokenize#
- langchain_core.utils.mustache.tokenize(
- template: str,
- def_ldel: str = '{{',
- def_rdel: str = '}}',
Tokenize a mustache template.
Tokenizes a mustache template in a generator fashion, using file-like objects. It also accepts a string containing the template.
- Parameters:
template (str) – a file-like object, or a string of a mustache template
def_ldel (str) – The default left delimiter (“{{” by default, as in spec compliant mustache)
def_rdel (str) – The default right delimiter (“}}” by default, as in spec compliant mustache)
- Yields:
Mustache tags in the form of a tuple (tag_type, tag_key) where tag_type is one of:
literal
section
inverted section
end
partial
no escape
and tag_key is either the key or in the case of a literal tag, the literal itself.
- Raises:
ChevronError – If there is a syntax error in the template.
- Return type:
Iterator[tuple[str, str]]