updated changelog and ruffed up
This commit is contained in:
@@ -85,6 +85,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### 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`.
|
- `CartesiaSTTService` now inherits from `WebsocketSTTService`.
|
||||||
|
|
||||||
- Package upgrades:
|
- Package upgrades:
|
||||||
@@ -106,6 +109,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### 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
|
- Fixed an issue in `RivaSegmentedSTTService` where a runtime error occurred due
|
||||||
to a mismatch in the _handle_transcription method's signature.
|
to a mismatch in the _handle_transcription method's signature.
|
||||||
|
|
||||||
|
|||||||
@@ -261,9 +261,8 @@ def _setup_webrtc_routes(
|
|||||||
async def webrtc_connection_callback(connection):
|
async def webrtc_connection_callback(connection):
|
||||||
bot_module = _get_bot_module()
|
bot_module = _get_bot_module()
|
||||||
runner_args = SmallWebRTCRunnerArguments(
|
runner_args = SmallWebRTCRunnerArguments(
|
||||||
webrtc_connection=connection,
|
webrtc_connection=connection, body=request.request_data
|
||||||
body=request.request_data
|
)
|
||||||
)
|
|
||||||
background_tasks.add_task(bot_module.bot, runner_args)
|
background_tasks.add_task(bot_module.bot, runner_args)
|
||||||
|
|
||||||
# Delegate handling to SmallWebRTCRequestHandler
|
# Delegate handling to SmallWebRTCRequestHandler
|
||||||
|
|||||||
@@ -627,7 +627,7 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
else ""
|
else ""
|
||||||
)
|
)
|
||||||
|
|
||||||
prompt_start = f'''
|
prompt_start = f"""
|
||||||
{{
|
{{
|
||||||
"event": {{
|
"event": {{
|
||||||
"promptStart": {{
|
"promptStart": {{
|
||||||
@@ -647,14 +647,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": {{
|
||||||
@@ -674,7 +674,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):
|
||||||
@@ -683,7 +683,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": {{
|
||||||
@@ -698,11 +698,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": {{
|
||||||
@@ -712,10 +712,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": {{
|
||||||
@@ -724,7 +724,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):
|
||||||
@@ -732,7 +732,7 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
return
|
return
|
||||||
|
|
||||||
blob = base64.b64encode(audio)
|
blob = base64.b64encode(audio)
|
||||||
audio_event = f'''
|
audio_event = f"""
|
||||||
{{
|
{{
|
||||||
"event": {{
|
"event": {{
|
||||||
"audioInput": {{
|
"audioInput": {{
|
||||||
@@ -742,14 +742,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": {{
|
||||||
@@ -757,7 +757,7 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
'''
|
"""
|
||||||
await self._send_client_event(prompt_end)
|
await self._send_client_event(prompt_end)
|
||||||
|
|
||||||
session_end = """
|
session_end = """
|
||||||
@@ -775,7 +775,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": {{
|
||||||
@@ -794,7 +794,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(
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class SmallWebRTCRequest:
|
|||||||
data["request_data"] = data.pop("requestData")
|
data["request_data"] = data.pop("requestData")
|
||||||
return cls(**data)
|
return cls(**data)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class IceCandidate:
|
class IceCandidate:
|
||||||
"""The remote ice candidate object received from the peer connection.
|
"""The remote ice candidate object received from the peer connection.
|
||||||
|
|||||||
Reference in New Issue
Block a user