Home / Function/ test_chat_tmpl_from_messages_multipart_formatting_with_path() — langchain Function Reference

test_chat_tmpl_from_messages_multipart_formatting_with_path() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 995–1042

async def test_chat_tmpl_from_messages_multipart_formatting_with_path() -> None:
    """Verify that we cannot pass `path` for an image as a variable."""
    in_mem_ = "base64mem"

    template = ChatPromptTemplate.from_messages(
        [
            ("system", "You are an AI assistant named {name}."),
            (
                "human",
                [
                    {"type": "text", "text": "What's in this image?"},
                    {
                        "type": "image_url",
                        "image_url": "data:image/jpeg;base64,{in_mem}",
                    },
                    {
                        "type": "image_url",
                        "image_url": {"path": "{file_path}"},
                    },
                ],
            ),
        ]
    )
    with pytest.raises(
        ValueError,
        match=re.escape(
            "Loading images from 'path' has been removed as of 0.3.15 "
            "for security reasons."
        ),
    ):
        template.format_messages(
            name="R2D2",
            in_mem=in_mem_,
            file_path="some/path",
        )

    with pytest.raises(
        ValueError,
        match=re.escape(
            "Loading images from 'path' has been removed as of 0.3.15 "
            "for security reasons."
        ),
    ):
        await template.aformat_messages(
            name="R2D2",
            in_mem=in_mem_,
            file_path="some/path",
        )

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free