Home / Function/ test_chat_prompt_template_append_and_extend() — langchain Function Reference

test_chat_prompt_template_append_and_extend() — langchain Function Reference

Architecture documentation for the test_chat_prompt_template_append_and_extend() function in test_chat.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a45c91a7_a517_882e_0cc6_f270f462d303["test_chat_prompt_template_append_and_extend()"]
  bf3138ca_0068_68ea_f479_35376e264d13["test_chat.py"]
  a45c91a7_a517_882e_0cc6_f270f462d303 -->|defined in| bf3138ca_0068_68ea_f479_35376e264d13
  style a45c91a7_a517_882e_0cc6_f270f462d303 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 783–802

def test_chat_prompt_template_append_and_extend() -> None:
    """Test append and extend methods of ChatPromptTemplate."""
    message1 = SystemMessage(content="foo")
    message2 = HumanMessage(content="bar")
    message3 = HumanMessage(content="baz")
    template = ChatPromptTemplate([message1])
    template.append(message2)
    template.append(message3)
    assert len(template) == 3
    template.extend([message2, message3])
    assert len(template) == 5
    assert template.messages == [
        message1,
        message2,
        message3,
        message2,
        message3,
    ]
    template.append(("system", "hello!"))
    assert template[-1] == SystemMessagePromptTemplate.from_template("hello!")

Subdomains

Frequently Asked Questions

What does test_chat_prompt_template_append_and_extend() do?
test_chat_prompt_template_append_and_extend() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_chat.py.
Where is test_chat_prompt_template_append_and_extend() defined?
test_chat_prompt_template_append_and_extend() is defined in libs/core/tests/unit_tests/prompts/test_chat.py at line 783.

Analyze Your Own Codebase

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

Try Supermodel Free