[WIP] AWS Nova Sonic service - add voice_id

This commit is contained in:
Paul Kompfner
2025-04-28 13:18:09 -04:00
parent 96d05e12fc
commit 9b8bce1914
2 changed files with 4 additions and 1 deletions

View File

@@ -66,6 +66,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"),
access_key_id=os.getenv("AWS_ACCESS_KEY_ID"),
region=os.getenv("AWS_REGION"),
voice_id="tiffany", # matthew, tiffany, amy
)
# Build the pipeline

View File

@@ -90,6 +90,7 @@ class AWSNovaSonicService(LLMService):
access_key_id: str,
region: str,
model: str = "amazon.nova-sonic-v1:0",
voice_id: str = "matthew", # matthew, tiffany, amy
**kwargs,
):
super().__init__(**kwargs)
@@ -99,6 +100,7 @@ class AWSNovaSonicService(LLMService):
self._region = region
self._model = model
self._client: BedrockRuntimeClient = None
self._voice_id = voice_id
self._stream: DuplexEventStream[
InvokeModelWithBidirectionalStreamInput,
InvokeModelWithBidirectionalStreamOutput,
@@ -257,7 +259,7 @@ class AWSNovaSonicService(LLMService):
"sampleRateHertz": 24000,
"sampleSizeBits": 16,
"channelCount": 1,
"voiceId": "matthew",
"voiceId": "{self._voice_id}",
"encoding": "base64",
"audioType": "SPEECH"
}}