The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Harrison/delegate from template (#14266)
Harrison Chase8eab4d95c078
diff --git a/libs/core/langchain_core/prompts/prompt.py b/libs/core/langchain_core/prompts/prompt.pyindex 012b926953..566cf02bd2 100644--- a/libs/core/langchain_core/prompts/prompt.py+++ b/libs/core/langchain_core/prompts/prompt.py@@ -1,6 +1,7 @@"""Prompt schema definition."""from __future__ import annotations+import warningsfrom pathlib import Pathfrom typing import Any, Dict, List, Literal, Optional, Union@@ -176,21 +177,30 @@ class PromptTemplate(StringPromptTemplate):@classmethoddef from_file(- cls, template_file: Union[str, Path], input_variables: List[str], **kwargs: Any+ cls,+ template_file: Union[str, Path],+ input_variables: Optional[List[str]] = None,+ **kwargs: Any,) -> PromptTemplate:"""Load a prompt from a file.Args:template_file: The path to the file containing the prompt template.- input_variables: A list of variable names the final prompt template- will expect.+ input_variables: [DEPRECATED] A list of variable names the final prompt+ template will expect.++ input_variables is ignored as from_file now delegates to from_template().Returns:The prompt loaded from the file."""with open(str(template_file), "r") as f:template = f.read()- return cls(input_variables=input_variables, template=template, **kwargs)+ if input_variables:+ warnings.warn(+ "`input_variables' is deprecated and ignored.", DeprecationWarning+ )+ return cls.from_template(template=template, **kwargs)@classmethoddef from_template(