Skip to content

The agent engineering platform.

prompt nit (#141)

Harrison Chase1835e8a6812e
diff --git a/langchain/prompts/prompt.py b/langchain/prompts/prompt.py
index b84b771814..f27c678f04 100644
--- a/langchain/prompts/prompt.py
+++ b/langchain/prompts/prompt.py
@@ -94,8 +94,7 @@ class Prompt(BaseModel, BasePrompt):
Returns:
The final prompt generated.
"""
- example_str = example_separator.join(examples)
- template = prefix + example_str + suffix
+ template = example_separator.join([prefix, *examples, suffix])
return cls(input_variables=input_variables, template=template)
@classmethod
diff --git a/tests/unit_tests/test_prompt.py b/tests/unit_tests/test_prompt.py
index 80a7fca4a7..7265cae347 100644
--- a/tests/unit_tests/test_prompt.py
+++ b/tests/unit_tests/test_prompt.py
@@ -51,8 +51,8 @@ Question: {question}
Answer:"""
input_variables = ["question"]
example_separator = "\n\n"
- prefix = """Test Prompt:\n\n"""
- suffix = """\n\nQuestion: {question}\nAnswer:"""
+ prefix = """Test Prompt:"""
+ suffix = """Question: {question}\nAnswer:"""
examples = [
"""Question: who are you?\nAnswer: foo""",
"""Question: what are you?\nAnswer: bar""",