Home / File/ entity_summarization.py — langchain Source File

entity_summarization.py — langchain Source File

Architecture documentation for entity_summarization.py, a python file in the langchain codebase. 1 imports, 0 dependents.

File python 1 imports

Entity Profile

Dependency Diagram

graph LR
  eaa28308_3a0e_44f2_be13_e87ee344abbd["entity_summarization.py"]
  4b3dcc0f_d872_0044_39ec_2d289f87f9e6["langchain_core.prompts.prompt"]
  eaa28308_3a0e_44f2_be13_e87ee344abbd --> 4b3dcc0f_d872_0044_39ec_2d289f87f9e6
  style eaa28308_3a0e_44f2_be13_e87ee344abbd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from langchain_core.prompts.prompt import PromptTemplate

_DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE = """You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update the summary of the provided entity in the "Entity" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.
The update should only include facts that are relayed in the last line of conversation about the provided entity, and should only contain facts about the provided entity.

If there is no new information about the provided entity or the information is not worth noting (not an important or relevant fact to remember long-term), return the existing summary unchanged.

Full conversation history (for context):
{history}

Entity to summarize:
{entity}

Existing summary of {entity}:
{summary}

Last line of conversation:
Human: {input}
Updated summary:"""  # noqa: E501

ENTITY_SUMMARIZATION_PROMPT = PromptTemplate(
    input_variables=["entity", "summary", "history", "input"],
    template=_DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE,
)

Dependencies

  • langchain_core.prompts.prompt

Frequently Asked Questions

What does entity_summarization.py do?
entity_summarization.py is a source file in the langchain codebase, written in python.
What does entity_summarization.py depend on?
entity_summarization.py imports 1 module(s): langchain_core.prompts.prompt.
Where is entity_summarization.py in the architecture?
entity_summarization.py is located at libs/langchain/langchain_classic/indexes/prompts/entity_summarization.py (directory: libs/langchain/langchain_classic/indexes/prompts).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free