Home / Function/ test_chat_prompt_template_image_prompt_from_message() — langchain Function Reference

test_chat_prompt_template_image_prompt_from_message() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 608–638

def test_chat_prompt_template_image_prompt_from_message(
    template_format: PromptTemplateFormat,
    image_type_placeholder: str,
    image_data_placeholder: str,
) -> None:
    prompt = {
        "type": "image_url",
        "image_url": {
            "url": f"data:{image_type_placeholder};base64, {image_data_placeholder}",
            "detail": "low",
        },
    }

    template = ChatPromptTemplate.from_messages(
        [("human", [prompt])], template_format=template_format
    )
    assert template.format_messages(
        image_type="image/png", image_data="base64data"
    ) == [
        HumanMessage(
            content=[
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "data:image/png;base64, base64data",
                        "detail": "low",
                    },
                }
            ]
        )
    ]

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free