diff --git a/CHANGELOG.md b/CHANGELOG.md index f13b3cece..c405b4bc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,6 +85,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Runner: `body` property moved to `RunnerArguments` base class as all transports + should support arbitrary body data as part of a request. + - `CartesiaSTTService` now inherits from `WebsocketSTTService`. - Package upgrades: @@ -106,6 +109,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed an issue where the `SmallWebRTCRequest` dataclass in runner would scrub + arbitrary request data from client due to camelCase typing. This fixes data + passthrough for JS clients where `APIRequest` is used. + - Fixed an issue in `RivaSegmentedSTTService` where a runtime error occurred due to a mismatch in the _handle_transcription method's signature. diff --git a/src/pipecat/runner/run.py b/src/pipecat/runner/run.py index ccd190707..27e2456bb 100644 --- a/src/pipecat/runner/run.py +++ b/src/pipecat/runner/run.py @@ -261,9 +261,8 @@ def _setup_webrtc_routes( async def webrtc_connection_callback(connection): bot_module = _get_bot_module() runner_args = SmallWebRTCRunnerArguments( - webrtc_connection=connection, - body=request.request_data - ) + webrtc_connection=connection, body=request.request_data + ) background_tasks.add_task(bot_module.bot, runner_args) # Delegate handling to SmallWebRTCRequestHandler diff --git a/src/pipecat/services/aws/nova_sonic/llm.py b/src/pipecat/services/aws/nova_sonic/llm.py index 5df3bbd21..e5e54100a 100644 --- a/src/pipecat/services/aws/nova_sonic/llm.py +++ b/src/pipecat/services/aws/nova_sonic/llm.py @@ -627,7 +627,7 @@ class AWSNovaSonicLLMService(LLMService): else "" ) - prompt_start = f''' + prompt_start = f""" {{ "event": {{ "promptStart": {{ @@ -647,14 +647,14 @@ class AWSNovaSonicLLMService(LLMService): }} }} }} - ''' + """ await self._send_client_event(prompt_start) async def _send_audio_input_start_event(self): if not self._prompt_name: return - audio_content_start = f''' + audio_content_start = f""" {{ "event": {{ "contentStart": {{ @@ -674,7 +674,7 @@ class AWSNovaSonicLLMService(LLMService): }} }} }} - ''' + """ await self._send_client_event(audio_content_start) async def _send_text_event(self, text: str, role: Role): @@ -683,7 +683,7 @@ class AWSNovaSonicLLMService(LLMService): content_name = str(uuid.uuid4()) - text_content_start = f''' + text_content_start = f""" {{ "event": {{ "contentStart": {{ @@ -698,11 +698,11 @@ class AWSNovaSonicLLMService(LLMService): }} }} }} - ''' + """ await self._send_client_event(text_content_start) escaped_text = json.dumps(text) # includes quotes - text_input = f''' + text_input = f""" {{ "event": {{ "textInput": {{ @@ -712,10 +712,10 @@ class AWSNovaSonicLLMService(LLMService): }} }} }} - ''' + """ await self._send_client_event(text_input) - text_content_end = f''' + text_content_end = f""" {{ "event": {{ "contentEnd": {{ @@ -724,7 +724,7 @@ class AWSNovaSonicLLMService(LLMService): }} }} }} - ''' + """ await self._send_client_event(text_content_end) async def _send_user_audio_event(self, audio: bytes): @@ -732,7 +732,7 @@ class AWSNovaSonicLLMService(LLMService): return blob = base64.b64encode(audio) - audio_event = f''' + audio_event = f""" {{ "event": {{ "audioInput": {{ @@ -742,14 +742,14 @@ class AWSNovaSonicLLMService(LLMService): }} }} }} - ''' + """ await self._send_client_event(audio_event) async def _send_session_end_events(self): if not self._stream or not self._prompt_name: return - prompt_end = f''' + prompt_end = f""" {{ "event": {{ "promptEnd": {{ @@ -757,7 +757,7 @@ class AWSNovaSonicLLMService(LLMService): }} }} }} - ''' + """ await self._send_client_event(prompt_end) session_end = """ @@ -775,7 +775,7 @@ class AWSNovaSonicLLMService(LLMService): content_name = str(uuid.uuid4()) - result_content_start = f''' + result_content_start = f""" {{ "event": {{ "contentStart": {{ @@ -794,7 +794,7 @@ class AWSNovaSonicLLMService(LLMService): }} }} }} - ''' + """ await self._send_client_event(result_content_start) result_content = json.dumps( diff --git a/src/pipecat/transports/smallwebrtc/request_handler.py b/src/pipecat/transports/smallwebrtc/request_handler.py index 6ccb11f01..d6ab3841d 100644 --- a/src/pipecat/transports/smallwebrtc/request_handler.py +++ b/src/pipecat/transports/smallwebrtc/request_handler.py @@ -46,6 +46,7 @@ class SmallWebRTCRequest: data["request_data"] = data.pop("requestData") return cls(**data) + @dataclass class IceCandidate: """The remote ice candidate object received from the peer connection.