Home / Function/ apredict_new_summary() — langchain Function Reference

apredict_new_summary() — langchain Function Reference

Architecture documentation for the apredict_new_summary() function in summary.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bd542e1b_cbff_eace_acc7_16110f14f487["apredict_new_summary()"]
  b59972c7_2658_48b0_f600_7b1f592481af["SummarizerMixin"]
  bd542e1b_cbff_eace_acc7_16110f14f487 -->|defined in| b59972c7_2658_48b0_f600_7b1f592481af
  style bd542e1b_cbff_eace_acc7_16110f14f487 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/memory/summary.py lines 59–80

    async def apredict_new_summary(
        self,
        messages: list[BaseMessage],
        existing_summary: str,
    ) -> str:
        """Predict a new summary based on the messages and existing summary.

        Args:
            messages: List of messages to summarize.
            existing_summary: Existing summary to build upon.

        Returns:
            A new summary string.
        """
        new_lines = get_buffer_string(
            messages,
            human_prefix=self.human_prefix,
            ai_prefix=self.ai_prefix,
        )

        chain = LLMChain(llm=self.llm, prompt=self.prompt)
        return await chain.apredict(summary=existing_summary, new_lines=new_lines)

Domain

Subdomains

Frequently Asked Questions

What does apredict_new_summary() do?
apredict_new_summary() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/memory/summary.py.
Where is apredict_new_summary() defined?
apredict_new_summary() is defined in libs/langchain/langchain_classic/memory/summary.py at line 59.

Analyze Your Own Codebase

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

Try Supermodel Free