Compare commits

...

1 Commits

Author SHA1 Message Date
Mark Backman
781a1fae37 fix-ruff.sh cleanup 2025-10-10 13:32:07 -04:00

View File

@@ -573,7 +573,7 @@ class AWSNovaSonicLLMService(LLMService):
else "" else ""
) )
prompt_start = f''' prompt_start = f"""
{{ {{
"event": {{ "event": {{
"promptStart": {{ "promptStart": {{
@@ -593,14 +593,14 @@ class AWSNovaSonicLLMService(LLMService):
}} }}
}} }}
}} }}
''' """
await self._send_client_event(prompt_start) await self._send_client_event(prompt_start)
async def _send_audio_input_start_event(self): async def _send_audio_input_start_event(self):
if not self._prompt_name: if not self._prompt_name:
return return
audio_content_start = f''' audio_content_start = f"""
{{ {{
"event": {{ "event": {{
"contentStart": {{ "contentStart": {{
@@ -620,7 +620,7 @@ class AWSNovaSonicLLMService(LLMService):
}} }}
}} }}
}} }}
''' """
await self._send_client_event(audio_content_start) await self._send_client_event(audio_content_start)
async def _send_text_event(self, text: str, role: Role): async def _send_text_event(self, text: str, role: Role):
@@ -629,7 +629,7 @@ class AWSNovaSonicLLMService(LLMService):
content_name = str(uuid.uuid4()) content_name = str(uuid.uuid4())
text_content_start = f''' text_content_start = f"""
{{ {{
"event": {{ "event": {{
"contentStart": {{ "contentStart": {{
@@ -644,11 +644,11 @@ class AWSNovaSonicLLMService(LLMService):
}} }}
}} }}
}} }}
''' """
await self._send_client_event(text_content_start) await self._send_client_event(text_content_start)
escaped_text = json.dumps(text) # includes quotes escaped_text = json.dumps(text) # includes quotes
text_input = f''' text_input = f"""
{{ {{
"event": {{ "event": {{
"textInput": {{ "textInput": {{
@@ -658,10 +658,10 @@ class AWSNovaSonicLLMService(LLMService):
}} }}
}} }}
}} }}
''' """
await self._send_client_event(text_input) await self._send_client_event(text_input)
text_content_end = f''' text_content_end = f"""
{{ {{
"event": {{ "event": {{
"contentEnd": {{ "contentEnd": {{
@@ -670,7 +670,7 @@ class AWSNovaSonicLLMService(LLMService):
}} }}
}} }}
}} }}
''' """
await self._send_client_event(text_content_end) await self._send_client_event(text_content_end)
async def _send_user_audio_event(self, audio: bytes): async def _send_user_audio_event(self, audio: bytes):
@@ -678,7 +678,7 @@ class AWSNovaSonicLLMService(LLMService):
return return
blob = base64.b64encode(audio) blob = base64.b64encode(audio)
audio_event = f''' audio_event = f"""
{{ {{
"event": {{ "event": {{
"audioInput": {{ "audioInput": {{
@@ -688,14 +688,14 @@ class AWSNovaSonicLLMService(LLMService):
}} }}
}} }}
}} }}
''' """
await self._send_client_event(audio_event) await self._send_client_event(audio_event)
async def _send_session_end_events(self): async def _send_session_end_events(self):
if not self._stream or not self._prompt_name: if not self._stream or not self._prompt_name:
return return
prompt_end = f''' prompt_end = f"""
{{ {{
"event": {{ "event": {{
"promptEnd": {{ "promptEnd": {{
@@ -703,7 +703,7 @@ class AWSNovaSonicLLMService(LLMService):
}} }}
}} }}
}} }}
''' """
await self._send_client_event(prompt_end) await self._send_client_event(prompt_end)
session_end = """ session_end = """
@@ -721,7 +721,7 @@ class AWSNovaSonicLLMService(LLMService):
content_name = str(uuid.uuid4()) content_name = str(uuid.uuid4())
result_content_start = f''' result_content_start = f"""
{{ {{
"event": {{ "event": {{
"contentStart": {{ "contentStart": {{
@@ -740,7 +740,7 @@ class AWSNovaSonicLLMService(LLMService):
}} }}
}} }}
}} }}
''' """
await self._send_client_event(result_content_start) await self._send_client_event(result_content_start)
result_content = json.dumps( result_content = json.dumps(