From eddfcd2c88215eb36722dd428e16d7aaf1dbc017 Mon Sep 17 00:00:00 2001 From: Mohammad Mohtashim <45242107+keenborder786@users.noreply.github.com> Date: Tue, 21 Oct 2025 22:01:25 +0500 Subject: [PATCH] docs(core): Updated docs for mustache_template_vars (#33481) --- libs/core/langchain_core/prompts/string.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/core/langchain_core/prompts/string.py b/libs/core/langchain_core/prompts/string.py index 94cd0c70cf6..c93615fdb30 100644 --- a/libs/core/langchain_core/prompts/string.py +++ b/libs/core/langchain_core/prompts/string.py @@ -122,13 +122,16 @@ def mustache_formatter(template: str, /, **kwargs: Any) -> str: def mustache_template_vars( template: str, ) -> set[str]: - """Get the variables from a mustache template. + """Get the top-level variables from a mustache template. + + For nested variables like `{{person.name}}`, only the top-level + key (`person`) is returned. Args: template: The template string. Returns: - The variables from the template. + The top-level variables from the template. """ variables: set[str] = set() section_depth = 0