mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 16:43:35 +00:00
prompt nit (#141)
doing some cleanup, and i think this just simplifies things...
This commit is contained in:
parent
bbb405a492
commit
1835e8a681
@ -94,8 +94,7 @@ class Prompt(BaseModel, BasePrompt):
|
|||||||
Returns:
|
Returns:
|
||||||
The final prompt generated.
|
The final prompt generated.
|
||||||
"""
|
"""
|
||||||
example_str = example_separator.join(examples)
|
template = example_separator.join([prefix, *examples, suffix])
|
||||||
template = prefix + example_str + suffix
|
|
||||||
return cls(input_variables=input_variables, template=template)
|
return cls(input_variables=input_variables, template=template)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -51,8 +51,8 @@ Question: {question}
|
|||||||
Answer:"""
|
Answer:"""
|
||||||
input_variables = ["question"]
|
input_variables = ["question"]
|
||||||
example_separator = "\n\n"
|
example_separator = "\n\n"
|
||||||
prefix = """Test Prompt:\n\n"""
|
prefix = """Test Prompt:"""
|
||||||
suffix = """\n\nQuestion: {question}\nAnswer:"""
|
suffix = """Question: {question}\nAnswer:"""
|
||||||
examples = [
|
examples = [
|
||||||
"""Question: who are you?\nAnswer: foo""",
|
"""Question: who are you?\nAnswer: foo""",
|
||||||
"""Question: what are you?\nAnswer: bar""",
|
"""Question: what are you?\nAnswer: bar""",
|
||||||
|
Loading…
Reference in New Issue
Block a user