Home / Function/ test_chat_prompt_template_from_messages_mustache() — langchain Function Reference

test_chat_prompt_template_from_messages_mustache() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 269–290

def test_chat_prompt_template_from_messages_mustache() -> None:
    """Test creating a chat prompt template from role string messages."""
    template = ChatPromptTemplate.from_messages(
        [
            ("system", "You are a helpful AI bot. Your name is {{name}}."),
            ("human", "Hello, how are you doing?"),
            ("ai", "I'm doing well, thanks!"),
            ("human", "{{user_input}}"),
        ],
        "mustache",
    )

    messages = template.format_messages(name="Bob", user_input="What is your name?")

    assert messages == [
        SystemMessage(
            content="You are a helpful AI bot. Your name is Bob.", additional_kwargs={}
        ),
        HumanMessage(content="Hello, how are you doing?", additional_kwargs={}),
        AIMessage(content="I'm doing well, thanks!", additional_kwargs={}),
        HumanMessage(content="What is your name?", additional_kwargs={}),
    ]

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free