validate_variable_names() — langchain Function Reference
Architecture documentation for the validate_variable_names() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD d0343daa_9ffe_cb93_0bbc_1c193fa3e3d1["validate_variable_names()"] dddce6a3_2420_c71d_01fe_f214c3eb2503["BasePromptTemplate"] d0343daa_9ffe_cb93_0bbc_1c193fa3e3d1 -->|defined in| dddce6a3_2420_c71d_01fe_f214c3eb2503 style d0343daa_9ffe_cb93_0bbc_1c193fa3e3d1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/prompts/base.py lines 79–104
def validate_variable_names(self) -> Self:
"""Validate variable names do not include restricted names."""
if "stop" in self.input_variables:
msg = (
"Cannot have an input variable named 'stop', as it is used internally,"
" please rename."
)
raise ValueError(
create_message(message=msg, error_code=ErrorCode.INVALID_PROMPT_INPUT)
)
if "stop" in self.partial_variables:
msg = (
"Cannot have an partial variable named 'stop', as it is used "
"internally, please rename."
)
raise ValueError(
create_message(message=msg, error_code=ErrorCode.INVALID_PROMPT_INPUT)
)
overall = set(self.input_variables).intersection(self.partial_variables)
if overall:
msg = f"Found overlapping input and partial variables: {overall}"
raise ValueError(
create_message(message=msg, error_code=ErrorCode.INVALID_PROMPT_INPUT)
)
return self
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does validate_variable_names() do?
validate_variable_names() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/base.py.
Where is validate_variable_names() defined?
validate_variable_names() is defined in libs/core/langchain_core/prompts/base.py at line 79.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free