Home / Function/ test_custom_event_root_dispatch_with_in_tool() — langchain Function Reference

test_custom_event_root_dispatch_with_in_tool() — langchain Function Reference

Architecture documentation for the test_custom_event_root_dispatch_with_in_tool() function in test_runnable_events_v2.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bb21400d_9df8_a9ca_d985_96db9d4ddcce["test_custom_event_root_dispatch_with_in_tool()"]
  33c02978_2077_5819_7048_bc2a81e80625["test_runnable_events_v2.py"]
  bb21400d_9df8_a9ca_d985_96db9d4ddcce -->|defined in| 33c02978_2077_5819_7048_bc2a81e80625
  716d2a5e_dc8e_3cae_e044_b56b06bee655["_collect_events()"]
  bb21400d_9df8_a9ca_d985_96db9d4ddcce -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655
  style bb21400d_9df8_a9ca_d985_96db9d4ddcce fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py lines 2792–2833

async def test_custom_event_root_dispatch_with_in_tool() -> None:
    """Test adhoc event in a nested chain."""

    @tool
    async def foo(x: int) -> int:
        """Foo."""
        await adispatch_custom_event("event1", {"x": x})
        return x + 1

    events = await _collect_events(foo.astream_events({"x": 2}, version="v2"))
    _assert_events_equal_allow_superset_metadata(
        events,
        [
            {
                "data": {"input": {"x": 2}},
                "event": "on_tool_start",
                "metadata": {},
                "name": "foo",
                "parent_ids": [],
                "run_id": "",
                "tags": [],
            },
            {
                "data": {"x": 2},
                "event": "on_custom_event",
                "metadata": {},
                "name": "event1",
                "parent_ids": [],
                "run_id": "",
                "tags": [],
            },
            {
                "data": {"output": 3},
                "event": "on_tool_end",
                "metadata": {},
                "name": "foo",
                "parent_ids": [],
                "run_id": "",
                "tags": [],
            },
        ],
    )

Domain

Subdomains

Frequently Asked Questions

What does test_custom_event_root_dispatch_with_in_tool() do?
test_custom_event_root_dispatch_with_in_tool() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py.
Where is test_custom_event_root_dispatch_with_in_tool() defined?
test_custom_event_root_dispatch_with_in_tool() is defined in libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py at line 2792.
What does test_custom_event_root_dispatch_with_in_tool() call?
test_custom_event_root_dispatch_with_in_tool() calls 1 function(s): _collect_events.

Analyze Your Own Codebase

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

Try Supermodel Free