MCPcopy Index your code
hub / github.com/google/adk-python / consume

Function consume

tests/unittests/streaming/test_streaming.py:1397–1417  ·  view source on GitHub ↗
(session: testing_utils.Session)

Source from the content-addressed store, hash-verified

1395 not_registered_before_call = None
1396
1397 async def consume(session: testing_utils.Session):
1398 nonlocal not_registered_before_call
1399 async for response in runner.runner.run_live(
1400 session=session,
1401 live_request_queue=live_request_queue,
1402 ):
1403 collected.append(response)
1404 # On the first non-function-call event, verify the tool is not
1405 # yet registered (lazy registration).
1406 active = (
1407 captured_context.active_streaming_tools if captured_context else None
1408 )
1409 if (
1410 not_registered_before_call is None
1411 and not response.get_function_calls()
1412 ):
1413 not_registered_before_call = (
1414 active is None or "monitor_video_stream" not in active
1415 )
1416 if len(collected) >= 4:
1417 return
1418
1419 runner._run_with_loop(asyncio.wait_for(consume(runner.session), timeout=5.0))
1420

Calls 3

get_function_callsMethod · 0.80
run_liveMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected