langchain_core.utils.mustache
.tokenizeΒΆ
- langchain_core.utils.mustache.tokenize(template: str, def_ldel: str = '{{', def_rdel: str = '}}') Iterator[Tuple[str, str]] [source]ΒΆ
Tokenize a mustache template.
Tokenizes a mustache template in a generator fashion, using file-like objects. It also accepts a string containing the template.
Arguments:
template β a file-like object, or a string of a mustache template
- 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)
Returns:
A generator of 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.
- Parameters
template (str) β
def_ldel (str) β
def_rdel (str) β
- Return type
Iterator[Tuple[str, str]]