# flake8: noqa from langchain.prompts.prompt import PromptTemplate _DEFAULT_ENTITY_EXTRACTION_TEMPLATE = """You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places. The conversation history is provided just in case of a coreference (e.g. "What do you know about him" where "him" is defined in a previous line) -- ignore items mentioned there that are not in the last line. Return the output as a single comma-separated list, or NONE if there is nothing of note to return (e.g. the user is just issuing a greeting or having a simple conversation). EXAMPLE Conversation history: Person #1: how's it going today? AI: "It's going great! How about you?" Person #1: good! busy working on Langchain. lots to do. AI: "That sounds like a lot of work! What kind of things are you doing to make Langchain better?" Last line: Person #1: 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 Conversation history: Person #1: how's it going today? AI: "It's going great! How about you?" Person #1: good! busy working on Langchain. lots to do. AI: "That sounds like a lot of work! What kind of things are you doing to make Langchain better?" Last line: Person #1: 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 Person #2. Output: Langchain, Person #2 END OF EXAMPLE Conversation history (for reference only): {history} Last line of conversation (for extraction): Human: {input} Output:""" ENTITY_EXTRACTION_PROMPT = PromptTemplate( input_variables=["history", "input"], template=_DEFAULT_ENTITY_EXTRACTION_TEMPLATE )