Home / Function/ test_chat_prompt_template_message_class_tuples_partial_variables() — langchain Function Reference

test_chat_prompt_template_message_class_tuples_partial_variables() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 444–458

def test_chat_prompt_template_message_class_tuples_partial_variables() -> None:
    """Test message class tuples with partial variables."""
    template = ChatPromptTemplate.from_messages(
        [
            (SystemMessage, "You are {name}, a {role} assistant."),
            (HumanMessage, "{question}"),
        ]
    )

    partial_template = template.partial(name="Alice", role="helpful")
    messages = partial_template.format_messages(question="What is Python?")

    assert len(messages) == 2
    assert messages[0].content == "You are Alice, a helpful assistant."
    assert messages[1].content == "What is Python?"

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free