Home / Function/ test_search_result_top_level() — langchain Function Reference

test_search_result_top_level() — langchain Function Reference

Architecture documentation for the test_search_result_top_level() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  4fc174e4_e7a2_b7e4_761b_34c0a9f815b9["test_search_result_top_level()"]
  f27640dd_3870_5548_d153_f9504ae1021f["test_chat_models.py"]
  4fc174e4_e7a2_b7e4_761b_34c0a9f815b9 -->|defined in| f27640dd_3870_5548_d153_f9504ae1021f
  style 4fc174e4_e7a2_b7e4_761b_34c0a9f815b9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/integration_tests/test_chat_models.py lines 1983–2030

def test_search_result_top_level() -> None:
    llm = ChatAnthropic(
        model=MODEL_NAME,  # type: ignore[call-arg]
    )
    input_message = HumanMessage(
        [
            {
                "type": "search_result",
                "title": "Leave policy",
                "source": "HR Leave Policy 2025 - page 1",
                "citations": {"enabled": True},
                "content": [
                    {
                        "type": "text",
                        "text": (
                            "To request vacation days, submit a leave request form "
                            "through the HR portal. Approval will be sent by email."
                        ),
                    },
                ],
            },
            {
                "type": "search_result",
                "title": "Leave policy",
                "source": "HR Leave Policy 2025 - page 2",
                "citations": {"enabled": True},
                "content": [
                    {
                        "type": "text",
                        "text": "Managers have 3 days to approve a request.",
                    },
                ],
            },
            {
                "type": "text",
                "text": "How do I request vacation days?",
            },
        ],
    )
    result = llm.invoke([input_message])
    assert isinstance(result, AIMessage)
    assert isinstance(result.content, list)
    assert any("citations" in block for block in result.content)

    assert (
        _convert_from_v1_to_anthropic(result.content_blocks, [], "anthropic")
        == result.content
    )

Domain

Subdomains

Frequently Asked Questions

What does test_search_result_top_level() do?
test_search_result_top_level() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py.
Where is test_search_result_top_level() defined?
test_search_result_top_level() is defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py at line 1983.

Analyze Your Own Codebase

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

Try Supermodel Free