mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-20 18:07:05 +00:00
Apply lint
This commit is contained in:
parent
84f8b99cf5
commit
4b74e35532
@ -138,8 +138,8 @@ class PromptTemplate(StringPromptTemplate):
|
||||
# Allow for easy combining
|
||||
if isinstance(other, PromptTemplate):
|
||||
if self.template_format != other.template_format:
|
||||
msg = "Cannot add two templates of different formats"
|
||||
raise ValueError(msg)
|
||||
msg = "Cannot add templates of different formats"
|
||||
raise ValueError(msg)
|
||||
input_variables = list(
|
||||
set(self.input_variables) | set(other.input_variables)
|
||||
)
|
||||
@ -160,7 +160,10 @@ class PromptTemplate(StringPromptTemplate):
|
||||
validate_template=validate_template,
|
||||
)
|
||||
if isinstance(other, str):
|
||||
prompt = PromptTemplate.from_template(other, template_format=self.template_format)
|
||||
prompt = PromptTemplate.from_template(
|
||||
other,
|
||||
template_format=self.template_format,
|
||||
)
|
||||
return self + prompt
|
||||
msg = f"Unsupported operand type for +: {type(other)}"
|
||||
raise NotImplementedError(msg)
|
||||
|
@ -684,7 +684,7 @@ def test_prompt_with_template_variable_name_jinja2() -> None:
|
||||
|
||||
|
||||
def test_prompt_template_add_with_with_another_format():
|
||||
with pytest.raises(match=r"Cannot add two templates"):
|
||||
with pytest.raises(match=r"Cannot add templates"):
|
||||
PromptTemplate.from_template("This is a {template}") + PromptTemplate.from_template("So {{this}} is", template_format="mustache")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user