_collect_events() — langchain Function Reference
Architecture documentation for the _collect_events() function in test_runnable_events_v2.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 716d2a5e_dc8e_3cae_e044_b56b06bee655["_collect_events()"] 33c02978_2077_5819_7048_bc2a81e80625["test_runnable_events_v2.py"] 716d2a5e_dc8e_3cae_e044_b56b06bee655 -->|defined in| 33c02978_2077_5819_7048_bc2a81e80625 97b265e9_1012_d5e6_2070_316d2916dd8c["test_event_stream_with_simple_function_tool()"] 97b265e9_1012_d5e6_2070_316d2916dd8c -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 a3a2bed1_7de2_374e_18a8_9a1b2ca43337["test_event_stream_with_single_lambda()"] a3a2bed1_7de2_374e_18a8_9a1b2ca43337 -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 0ce63d93_b537_f233_6fd9_00cf8f28b32f["test_event_stream_with_triple_lambda()"] 0ce63d93_b537_f233_6fd9_00cf8f28b32f -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 0fcf5aac_46f2_7e6b_9d87_05f7f9250002["test_event_stream_exception()"] 0fcf5aac_46f2_7e6b_9d87_05f7f9250002 -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 e2c2b4d6_4adb_e5b8_c645_39ec2fd37a09["test_event_stream_with_triple_lambda_test_filtering()"] e2c2b4d6_4adb_e5b8_c645_39ec2fd37a09 -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 27565cb6_3504_9fe1_7560_fbecf7cc5731["test_event_stream_with_lambdas_from_lambda()"] 27565cb6_3504_9fe1_7560_fbecf7cc5731 -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 e7e77e50_7157_85f1_ee50_798036a3da6b["test_astream_events_from_model()"] e7e77e50_7157_85f1_ee50_798036a3da6b -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 fc4ed197_df4b_4763_b8da_4c5b4721587f["test_astream_with_model_in_chain()"] fc4ed197_df4b_4763_b8da_4c5b4721587f -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 985bf437_10c3_4cdc_1497_35b64db40e39["test_event_stream_with_simple_chain()"] 985bf437_10c3_4cdc_1497_35b64db40e39 -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 44077f8c_26fb_f329_099a_12df358f6286["test_event_streaming_with_tools()"] 44077f8c_26fb_f329_099a_12df358f6286 -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 91b7dc94_26ca_fef2_44ae_d92e7ed6d34f["test_event_stream_with_retriever()"] 91b7dc94_26ca_fef2_44ae_d92e7ed6d34f -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 783f5e81_685a_3bc9_4b43_195563a40885["test_event_stream_with_retriever_and_formatter()"] 783f5e81_685a_3bc9_4b43_195563a40885 -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 0adc4024_6629_06b7_068b_90c72d192e54["test_event_stream_on_chain_with_tool()"] 0adc4024_6629_06b7_068b_90c72d192e54 -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 style 716d2a5e_dc8e_3cae_e044_b56b06bee655 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py lines 78–90
async def _collect_events(
events: AsyncIterator[StreamEvent], *, with_nulled_ids: bool = True
) -> list[StreamEvent]:
"""Collect the events and remove the run ids."""
materialized_events = [event async for event in events]
if with_nulled_ids:
events_ = _with_nulled_run_id(materialized_events)
else:
events_ = materialized_events
for event in events_:
event["tags"] = sorted(event["tags"])
return events_
Domain
Subdomains
Calls
Called By
- test_astream_events_from_custom_runnable()
- test_astream_events_from_model()
- test_astream_with_model_in_chain()
- test_async_in_async_stream_lambdas()
- test_bad_parent_ids()
- test_custom_event()
- test_custom_event_nested()
- test_custom_event_root_dispatch_with_in_tool()
- test_event_stream_exception()
- test_event_stream_on_chain_with_tool()
- test_event_stream_with_lambdas_from_lambda()
- test_event_stream_with_retriever()
- test_event_stream_with_retriever_and_formatter()
- test_event_stream_with_simple_chain()
- test_event_stream_with_simple_function_tool()
- test_event_stream_with_single_lambda()
- test_event_stream_with_triple_lambda()
- test_event_stream_with_triple_lambda_test_filtering()
- test_event_streaming_with_tools()
- test_events_astream_config()
- test_parent_run_id_assignment()
- test_runnable_generator()
- test_sync_in_async_stream_lambdas()
- test_sync_in_sync_lambdas()
- test_with_explicit_config()
- test_with_llm()
Source
Frequently Asked Questions
What does _collect_events() do?
_collect_events() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py.
Where is _collect_events() defined?
_collect_events() is defined in libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py at line 78.
What does _collect_events() call?
_collect_events() calls 1 function(s): _with_nulled_run_id.
What calls _collect_events()?
_collect_events() is called by 26 function(s): test_astream_events_from_custom_runnable, test_astream_events_from_model, test_astream_with_model_in_chain, test_async_in_async_stream_lambdas, test_bad_parent_ids, test_custom_event, test_custom_event_nested, test_custom_event_root_dispatch_with_in_tool, and 18 more.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free