forked from Archives/langchain
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
# flake8: noqa
|
|
from langchain.prompts.prompt import PromptTemplate
|
|
|
|
_DEFAULT_ENTITY_EXTRACTION_TEMPLATE = """Extract all entities from the following text. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.
|
|
|
|
Return the output as a single comma-separated list, or NONE if there is nothing of note to return.
|
|
|
|
EXAMPLE
|
|
i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff.
|
|
Output: Langchain
|
|
END OF EXAMPLE
|
|
|
|
EXAMPLE
|
|
i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I'm working with Sam.
|
|
Output: Langchain, Sam
|
|
END OF EXAMPLE
|
|
|
|
Begin!
|
|
|
|
{input}
|
|
Output:"""
|
|
ENTITY_EXTRACTION_PROMPT = PromptTemplate(
|
|
input_variables=["input"], template=_DEFAULT_ENTITY_EXTRACTION_TEMPLATE
|
|
)
|
|
|
|
prompt_template = """Use the following knowledge triplets to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
|
|
|
{context}
|
|
|
|
Question: {question}
|
|
Helpful Answer:"""
|
|
PROMPT = PromptTemplate(
|
|
template=prompt_template, input_variables=["context", "question"]
|
|
)
|