Home / Function/ test_messages_prompt_accepts_list() — langchain Function Reference

test_messages_prompt_accepts_list() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 1147–1166

async def test_messages_prompt_accepts_list() -> None:
    prompt = ChatPromptTemplate([MessagesPlaceholder("history")])
    value = prompt.invoke([("user", "Hi there")])  # type: ignore[arg-type]
    assert value.to_messages() == [HumanMessage(content="Hi there")]

    value = await prompt.ainvoke([("user", "Hi there")])  # type: ignore[arg-type]
    assert value.to_messages() == [HumanMessage(content="Hi there")]

    # Assert still raises a nice error
    prompt = ChatPromptTemplate(
        [
            ("system", "You are a {foo}"),
            MessagesPlaceholder("history"),
        ]
    )
    with pytest.raises(TypeError):
        prompt.invoke([("user", "Hi there")])  # type: ignore[arg-type]

    with pytest.raises(TypeError):
        await prompt.ainvoke([("user", "Hi there")])  # type: ignore[arg-type]

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free