Home / Function/ append() — langchain Function Reference

append() — langchain Function Reference

Architecture documentation for the append() function in chat.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  51e4c8c4_03c1_4bf3_6d35_36e10545e164["append()"]
  6be4a9a5_5fe4_e64f_c374_e63767576bf6["ChatPromptTemplate"]
  51e4c8c4_03c1_4bf3_6d35_36e10545e164 -->|defined in| 6be4a9a5_5fe4_e64f_c374_e63767576bf6
  48373769_1ea6_b4a1_72e7_07082679631b["from_template()"]
  48373769_1ea6_b4a1_72e7_07082679631b -->|calls| 51e4c8c4_03c1_4bf3_6d35_36e10545e164
  4d5e2501_6d84_a2a3_49d1_fa84af2fe2d1["format()"]
  4d5e2501_6d84_a2a3_49d1_fa84af2fe2d1 -->|calls| 51e4c8c4_03c1_4bf3_6d35_36e10545e164
  12501cb5_f260_9904_b738_b5abce848eb3["aformat()"]
  12501cb5_f260_9904_b738_b5abce848eb3 -->|calls| 51e4c8c4_03c1_4bf3_6d35_36e10545e164
  0a946d27_710a_f7ff_e9e4_87561079dc25["_convert_to_message_template()"]
  51e4c8c4_03c1_4bf3_6d35_36e10545e164 -->|calls| 0a946d27_710a_f7ff_e9e4_87561079dc25
  style 51e4c8c4_03c1_4bf3_6d35_36e10545e164 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/chat.py lines 1260–1266

    def append(self, message: MessageLikeRepresentation) -> None:
        """Append a message to the end of the chat template.

        Args:
            message: representation of a message to append.
        """
        self.messages.append(_convert_to_message_template(message))

Subdomains

Frequently Asked Questions

What does append() do?
append() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/chat.py.
Where is append() defined?
append() is defined in libs/core/langchain_core/prompts/chat.py at line 1260.
What does append() call?
append() calls 1 function(s): _convert_to_message_template.
What calls append()?
append() is called by 3 function(s): aformat, format, from_template.

Analyze Your Own Codebase

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

Try Supermodel Free