Home / Function/ test_chat_tmpl_from_messages_multipart_text_with_template() — langchain Function Reference

test_chat_tmpl_from_messages_multipart_text_with_template() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 884–910

async def test_chat_tmpl_from_messages_multipart_text_with_template() -> None:
    template = ChatPromptTemplate.from_messages(
        [
            ("system", "You are an AI assistant named {name}."),
            (
                "human",
                [
                    {"type": "text", "text": "What's in this {object_name}?"},
                    {"type": "text", "text": "Oh nvm"},
                ],
            ),
        ]
    )
    expected = [
        SystemMessage(content="You are an AI assistant named R2D2."),
        HumanMessage(
            content=[
                {"type": "text", "text": "What's in this image?"},
                {"type": "text", "text": "Oh nvm"},
            ]
        ),
    ]
    messages = template.format_messages(name="R2D2", object_name="image")
    assert messages == expected

    messages = await template.aformat_messages(name="R2D2", object_name="image")
    assert messages == expected

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free