Home / Function/ test_return_direct_integration_matrix() — langchain Function Reference

test_return_direct_integration_matrix() — langchain Function Reference

Architecture documentation for the test_return_direct_integration_matrix() function in test_return_direct_spec.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  270c8d88_65c5_2f87_9bb8_56d1337ca7d2["test_return_direct_integration_matrix()"]
  c8900b43_6b5d_2599_1ca3_7e1e2f55b668["test_return_direct_spec.py"]
  270c8d88_65c5_2f87_9bb8_56d1337ca7d2 -->|defined in| c8900b43_6b5d_2599_1ca3_7e1e2f55b668
  e3a12839_000f_c5f5_1ac9_6c7ccdcc57b4["_make_tool()"]
  270c8d88_65c5_2f87_9bb8_56d1337ca7d2 -->|calls| e3a12839_000f_c5f5_1ac9_6c7ccdcc57b4
  style 270c8d88_65c5_2f87_9bb8_56d1337ca7d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_return_direct_spec.py lines 76–118

def test_return_direct_integration_matrix(case: TestCase) -> None:
    poll_tool = _make_tool(return_direct=case.return_direct)

    model = ChatOpenAI(
        model="gpt-4o",
        temperature=0,
    )

    if case.response_format:
        agent = create_agent(
            model,
            tools=[poll_tool["tool"]],
            system_prompt=AGENT_PROMPT,
            response_format=ToolStrategy(case.response_format),
        )
    else:
        agent = create_agent(
            model,
            tools=[poll_tool["tool"]],
            system_prompt=AGENT_PROMPT,
        )

    result = agent.invoke(
        {
            "messages": [
                HumanMessage("Poll the job until it's done and tell me how many attempts it took.")
            ]
        }
    )

    # Count tool calls
    assert poll_tool["mock"].call_count == case.expected_tool_calls

    # Check last message content
    last_message = result["messages"][-1]
    assert last_message.content == case.expected_last_message

    # Check structured response
    if case.expected_structured_response is not None:
        structured_response_json = result["structured_response"]
        assert structured_response_json == case.expected_structured_response
    else:
        assert "structured_response" not in result

Domain

Subdomains

Calls

Frequently Asked Questions

What does test_return_direct_integration_matrix() do?
test_return_direct_integration_matrix() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_return_direct_spec.py.
Where is test_return_direct_integration_matrix() defined?
test_return_direct_integration_matrix() is defined in libs/langchain_v1/tests/unit_tests/agents/test_return_direct_spec.py at line 76.
What does test_return_direct_integration_matrix() call?
test_return_direct_integration_matrix() calls 1 function(s): _make_tool.

Analyze Your Own Codebase

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

Try Supermodel Free