Home / Function/ test_chat_prompt_template_indexing() — langchain Function Reference

test_chat_prompt_template_indexing() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_chat.py lines 769–780

def test_chat_prompt_template_indexing() -> None:
    message1 = SystemMessage(content="foo")
    message2 = HumanMessage(content="bar")
    message3 = HumanMessage(content="baz")
    template = ChatPromptTemplate([message1, message2, message3])
    assert template[0] == message1
    assert template[1] == message2

    # Slice starting from index 1
    slice_template = template[1:]
    assert slice_template[0] == message2
    assert len(slice_template) == 2

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free