Home / Function/ test_chat_tmpl_from_messages_multipart_text() — langchain Function Reference

test_chat_tmpl_from_messages_multipart_text() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 855–881

async def test_chat_tmpl_from_messages_multipart_text() -> None:
    template = ChatPromptTemplate.from_messages(
        [
            ("system", "You are an AI assistant named {name}."),
            (
                "human",
                [
                    {"type": "text", "text": "What's in this image?"},
                    {"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")
    assert messages == expected

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

Domain

Subdomains

Frequently Asked Questions

What does test_chat_tmpl_from_messages_multipart_text() do?
test_chat_tmpl_from_messages_multipart_text() 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() defined?
test_chat_tmpl_from_messages_multipart_text() is defined in libs/core/tests/unit_tests/prompts/test_chat.py at line 855.

Analyze Your Own Codebase

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

Try Supermodel Free