vformat() — langchain Function Reference
Architecture documentation for the vformat() function in formatting.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 8fbd4e04_2653_02f4_eac0_0f96887f3f7f["vformat()"] 29112ca2_d607_429e_5319_09bd1ea18686["StrictFormatter"] 8fbd4e04_2653_02f4_eac0_0f96887f3f7f -->|defined in| 29112ca2_d607_429e_5319_09bd1ea18686 style 8fbd4e04_2653_02f4_eac0_0f96887f3f7f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/utils/formatting.py lines 23–48
def vformat(
self, format_string: str, args: Sequence, kwargs: Mapping[str, Any]
) -> str:
"""Format a string using only keyword arguments.
Overrides the base `vformat` to reject positional arguments, ensuring all
substitutions are explicit and named.
Args:
format_string: A string containing replacement fields (e.g., `'{name}'`).
args: Positional arguments (must be empty).
kwargs: Keyword arguments for substitution into the format string.
Returns:
The formatted string with all replacement fields substituted.
Raises:
ValueError: If any positional arguments are provided.
"""
if len(args) > 0:
msg = (
"No arguments should be provided, "
"everything should be passed as keyword arguments."
)
raise ValueError(msg)
return super().vformat(format_string, args, kwargs)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does vformat() do?
vformat() is a function in the langchain codebase, defined in libs/core/langchain_core/utils/formatting.py.
Where is vformat() defined?
vformat() is defined in libs/core/langchain_core/utils/formatting.py at line 23.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free