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

Class LiveRequestQueue

src/google/adk/agents/live_request_queue.py:59–86  ·  view source on GitHub ↗

Queue used to send LiveRequest in a live(bidirectional streaming) way.

Source from the content-addressed store, hash-verified

57
58
59class LiveRequestQueue:
60 """Queue used to send LiveRequest in a live(bidirectional streaming) way."""
61
62 def __init__(self):
63 self._queue = asyncio.Queue()
64
65 def close(self):
66 self._queue.put_nowait(LiveRequest(close=True))
67
68 def send_content(self, content: types.Content):
69 self._queue.put_nowait(LiveRequest(content=content))
70
71 def send_realtime(self, blob: types.Blob):
72 self._queue.put_nowait(LiveRequest(blob=blob))
73
74 def send_activity_start(self):
75 """Sends an activity start signal to mark the beginning of user input."""
76 self._queue.put_nowait(LiveRequest(activity_start=types.ActivityStart()))
77
78 def send_activity_end(self):
79 """Sends an activity end signal to mark the end of user input."""
80 self._queue.put_nowait(LiveRequest(activity_end=types.ActivityEnd()))
81
82 def send(self, req: LiveRequest):
83 self._queue.put_nowait(req)
84
85 async def get(self) -> LiveRequest:
86 return await self._queue.get()

Calls

no outgoing calls