Unflatten LiveOptions back into a single live_options field on DeepgramSTTSettings and DeepgramSageMakerSTTSettings; add apply_update override with delta-merge semantics and from_mapping override for backward-compatible dict-style updates
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
from deepgram import LiveOptions
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
|
||||
@@ -106,10 +107,16 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
||||
messages.append({"role": "system", "content": "Please introduce yourself to the user."})
|
||||
await task.queue_frames([LLMRunFrame()])
|
||||
|
||||
# NOTE: after this change, the bot will only respond if you speak Spanish
|
||||
await asyncio.sleep(10)
|
||||
logger.info("Updating Deepgram SageMaker STT settings: language=es")
|
||||
logger.info("Updating Deepgram SageMaker STT settings: language=es, punctuate=False")
|
||||
await task.queue_frame(
|
||||
STTUpdateSettingsFrame(delta=DeepgramSageMakerSTTSettings(language=Language.ES))
|
||||
STTUpdateSettingsFrame(
|
||||
delta=DeepgramSageMakerSTTSettings(
|
||||
language=Language.ES,
|
||||
live_options=LiveOptions(punctuate=False),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
# Old-style dict update (for backward-compat testing):
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
from deepgram import LiveOptions
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
|
||||
@@ -100,10 +101,16 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
||||
messages.append({"role": "system", "content": "Please introduce yourself to the user."})
|
||||
await task.queue_frames([LLMRunFrame()])
|
||||
|
||||
# NOTE: after this change, the bot will only respond if you speak Spanish
|
||||
await asyncio.sleep(10)
|
||||
logger.info("Updating Deepgram STT settings: language=es")
|
||||
logger.info("Updating Deepgram STT settings: language=es, punctuate=False")
|
||||
await task.queue_frame(
|
||||
STTUpdateSettingsFrame(delta=DeepgramSTTSettings(language=Language.ES))
|
||||
STTUpdateSettingsFrame(
|
||||
delta=DeepgramSTTSettings(
|
||||
language=Language.ES,
|
||||
live_options=LiveOptions(punctuate=False),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
# Old-style dict update (for backward-compat testing):
|
||||
|
||||
Reference in New Issue
Block a user