prompt nit (#141)

doing some cleanup, and i think this just simplifies things...
This commit is contained in:
Harrison Chase 2022-11-14 21:30:33 -08:00 committed by GitHub
parent bbb405a492
commit 1835e8a681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -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

View File

@ -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""",