|
5 | 5 | import uuid |
6 | 6 | from typing import Optional, List, Dict, Any |
7 | 7 | from getstream.video.rtc.audio_track import AudioStreamTrack |
8 | | -from hatch.cli import self |
9 | 8 |
|
10 | 9 | from vision_agents.core.llm import realtime |
11 | 10 | from aws_sdk_bedrock_runtime.client import BedrockRuntimeClient, InvokeModelWithBidirectionalStreamOperationInput |
|
14 | 13 | from smithy_aws_core.identity.environment import EnvironmentCredentialsResolver |
15 | 14 |
|
16 | 15 | from vision_agents.core.utils.video_forwarder import VideoForwarder |
17 | | -from . import events |
18 | 16 | from vision_agents.core.processors import Processor |
19 | 17 | from vision_agents.core.edge.types import Participant |
20 | 18 | from vision_agents.core.edge.types import PcmData |
@@ -382,27 +380,25 @@ async def _handle_events(self): |
382 | 380 | pass |
383 | 381 | elif 'textOutput' in json_data['event']: |
384 | 382 | text_content = json_data['event']['textOutput']['content'] |
385 | | - role = json_data['event']['textOutput']['role'] |
| 383 | + #role = json_data['event']['textOutput']['role'] |
386 | 384 | logger.info(f"Text output from Bedrock: {text_content}") |
387 | 385 | elif 'completionStart' in json_data['event']: |
388 | 386 | logger.info("Completion start from Bedrock", json_data['event']['completionStart']) |
389 | 387 | elif 'audioOutput' in json_data['event']: |
390 | 388 | logger.info("Audio output from Bedrock") |
391 | | - try: |
392 | | - audio_content = json_data['event']['audioOutput']['content'] |
393 | | - audio_bytes = base64.b64decode(audio_content) |
394 | | - #await self.audio_output_queue.put(audio_bytes) |
395 | | - |
396 | | - audio_event = RealtimeAudioOutputEvent( |
397 | | - plugin_name="gemini", |
398 | | - audio_data=audio_bytes, |
399 | | - sample_rate=24000 |
400 | | - ) |
401 | | - self.events.send(audio_event) |
402 | | - |
403 | | - await self.output_track.write(audio_bytes) |
404 | | - except Exception as e: |
405 | | - import pdb; pdb.set_trace() |
| 389 | + audio_content = json_data['event']['audioOutput']['content'] |
| 390 | + audio_bytes = base64.b64decode(audio_content) |
| 391 | + #await self.audio_output_queue.put(audio_bytes) |
| 392 | + |
| 393 | + audio_event = RealtimeAudioOutputEvent( |
| 394 | + plugin_name="gemini", |
| 395 | + audio_data=audio_bytes, |
| 396 | + sample_rate=24000 |
| 397 | + ) |
| 398 | + self.events.send(audio_event) |
| 399 | + |
| 400 | + await self.output_track.write(audio_bytes) |
| 401 | + |
406 | 402 |
|
407 | 403 | elif 'toolUse' in json_data['event']: |
408 | 404 | logger.info(f"Tool use from Bedrock: {json_data['event']['toolUse']}") |
|
0 commit comments