Home / Function/ test_event_stream_with_single_lambda() — langchain Function Reference

test_event_stream_with_single_lambda() — langchain Function Reference

Architecture documentation for the test_event_stream_with_single_lambda() function in test_runnable_events_v1.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6a044752_ad8d_6390_319f_205db62c97ca["test_event_stream_with_single_lambda()"]
  8ff41f3c_f250_f8de_8094_4f24860a10e0["test_runnable_events_v1.py"]
  6a044752_ad8d_6390_319f_205db62c97ca -->|defined in| 8ff41f3c_f250_f8de_8094_4f24860a10e0
  aac0453e_34cd_4dce_c7fa_f176ab20140b["_collect_events()"]
  6a044752_ad8d_6390_319f_205db62c97ca -->|calls| aac0453e_34cd_4dce_c7fa_f176ab20140b
  6ebe7fde_6e8f_dae5_d42f_9cea181617f5["_assert_events_equal_allow_superset_metadata()"]
  6a044752_ad8d_6390_319f_205db62c97ca -->|calls| 6ebe7fde_6e8f_dae5_d42f_9cea181617f5
  style 6a044752_ad8d_6390_319f_205db62c97ca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_runnable_events_v1.py lines 172–213

async def test_event_stream_with_single_lambda() -> None:
    """Test the event stream with a tool."""

    def reverse(s: str) -> str:
        """Reverse a string."""
        return s[::-1]

    chain = RunnableLambda(func=reverse)

    events = await _collect_events(chain.astream_events("hello", version="v1"))
    _assert_events_equal_allow_superset_metadata(
        events,
        [
            {
                "data": {"input": "hello"},
                "event": "on_chain_start",
                "metadata": {},
                "name": "reverse",
                "run_id": "",
                "parent_ids": [],
                "tags": [],
            },
            {
                "data": {"chunk": "olleh"},
                "event": "on_chain_stream",
                "metadata": {},
                "name": "reverse",
                "run_id": "",
                "parent_ids": [],
                "tags": [],
            },
            {
                "data": {"output": "olleh"},
                "event": "on_chain_end",
                "metadata": {},
                "name": "reverse",
                "run_id": "",
                "parent_ids": [],
                "tags": [],
            },
        ],
    )

Domain

Subdomains

Frequently Asked Questions

What does test_event_stream_with_single_lambda() do?
test_event_stream_with_single_lambda() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_runnable_events_v1.py.
Where is test_event_stream_with_single_lambda() defined?
test_event_stream_with_single_lambda() is defined in libs/core/tests/unit_tests/runnables/test_runnable_events_v1.py at line 172.
What does test_event_stream_with_single_lambda() call?
test_event_stream_with_single_lambda() calls 2 function(s): _assert_events_equal_allow_superset_metadata, _collect_events.

Analyze Your Own Codebase

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

Try Supermodel Free