Home / Function/ __add__() — langchain Function Reference

__add__() — langchain Function Reference

Architecture documentation for the __add__() function in message.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  821126fe_9ba5_ceb5_d801_26c5206a87be["__add__()"]
  75bfc804_f68f_7b77_a169_0fd019f759a2["BaseMessagePromptTemplate"]
  821126fe_9ba5_ceb5_d801_26c5206a87be -->|defined in| 75bfc804_f68f_7b77_a169_0fd019f759a2
  style 821126fe_9ba5_ceb5_d801_26c5206a87be fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/message.py lines 84–97

    def __add__(self, other: Any) -> ChatPromptTemplate:
        """Combine two prompt templates.

        Args:
            other: Another prompt template.

        Returns:
            Combined prompt template.
        """
        # Import locally to avoid circular import.
        from langchain_core.prompts.chat import ChatPromptTemplate  # noqa: PLC0415

        prompt = ChatPromptTemplate(messages=[self])
        return prompt.__add__(other)

Subdomains

Frequently Asked Questions

What does __add__() do?
__add__() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/message.py.
Where is __add__() defined?
__add__() is defined in libs/core/langchain_core/prompts/message.py at line 84.

Analyze Your Own Codebase

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

Try Supermodel Free