Home / Function/ test_messages_placeholder_with_max() — langchain Function Reference

test_messages_placeholder_with_max() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 1059–1071

def test_messages_placeholder_with_max() -> None:
    history = [
        AIMessage(content="1"),
        AIMessage(content="2"),
        AIMessage(content="3"),
    ]
    prompt = MessagesPlaceholder("history")
    assert prompt.format_messages(history=history) == history
    prompt = MessagesPlaceholder("history", n_messages=2)
    assert prompt.format_messages(history=history) == [
        AIMessage(content="2"),
        AIMessage(content="3"),
    ]

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free