[WIP] AWS Nova Sonic service - add voice_id
This commit is contained in:
@@ -66,6 +66,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
|
|||||||
secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"),
|
secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"),
|
||||||
access_key_id=os.getenv("AWS_ACCESS_KEY_ID"),
|
access_key_id=os.getenv("AWS_ACCESS_KEY_ID"),
|
||||||
region=os.getenv("AWS_REGION"),
|
region=os.getenv("AWS_REGION"),
|
||||||
|
voice_id="tiffany", # matthew, tiffany, amy
|
||||||
)
|
)
|
||||||
|
|
||||||
# Build the pipeline
|
# Build the pipeline
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ class AWSNovaSonicService(LLMService):
|
|||||||
access_key_id: str,
|
access_key_id: str,
|
||||||
region: str,
|
region: str,
|
||||||
model: str = "amazon.nova-sonic-v1:0",
|
model: str = "amazon.nova-sonic-v1:0",
|
||||||
|
voice_id: str = "matthew", # matthew, tiffany, amy
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
@@ -99,6 +100,7 @@ class AWSNovaSonicService(LLMService):
|
|||||||
self._region = region
|
self._region = region
|
||||||
self._model = model
|
self._model = model
|
||||||
self._client: BedrockRuntimeClient = None
|
self._client: BedrockRuntimeClient = None
|
||||||
|
self._voice_id = voice_id
|
||||||
self._stream: DuplexEventStream[
|
self._stream: DuplexEventStream[
|
||||||
InvokeModelWithBidirectionalStreamInput,
|
InvokeModelWithBidirectionalStreamInput,
|
||||||
InvokeModelWithBidirectionalStreamOutput,
|
InvokeModelWithBidirectionalStreamOutput,
|
||||||
@@ -257,7 +259,7 @@ class AWSNovaSonicService(LLMService):
|
|||||||
"sampleRateHertz": 24000,
|
"sampleRateHertz": 24000,
|
||||||
"sampleSizeBits": 16,
|
"sampleSizeBits": 16,
|
||||||
"channelCount": 1,
|
"channelCount": 1,
|
||||||
"voiceId": "matthew",
|
"voiceId": "{self._voice_id}",
|
||||||
"encoding": "base64",
|
"encoding": "base64",
|
||||||
"audioType": "SPEECH"
|
"audioType": "SPEECH"
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user