Home / Function/ test_chat_prompt_message_dict() — langchain Function Reference

test_chat_prompt_message_dict() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 1128–1144

def test_chat_prompt_message_dict() -> None:
    prompt = ChatPromptTemplate(
        [
            {"role": "system", "content": "foo"},
            {"role": "user", "content": "bar"},
        ]
    )
    assert prompt.format_messages() == [
        SystemMessage(content="foo"),
        HumanMessage(content="bar"),
    ]

    with pytest.raises(ValueError, match="Invalid template: False"):
        ChatPromptTemplate([{"role": "system", "content": False}])

    with pytest.raises(ValueError, match="Unexpected message type: foo"):
        ChatPromptTemplate([{"role": "foo", "content": "foo"}])

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free