transports(daily): add DailyTranscriptionSettings to update settings easier
This commit is contained in:
@@ -80,21 +80,23 @@ class WebRTCVADAnalyzer(VADAnalyzer):
|
|||||||
return confidence
|
return confidence
|
||||||
|
|
||||||
|
|
||||||
|
class DailyTranscriptionSettings(BaseModel):
|
||||||
|
language: str = "en"
|
||||||
|
tier: str = "nova"
|
||||||
|
model: str = "2-conversationalai"
|
||||||
|
profanity_filter: bool = True
|
||||||
|
redact: bool = False
|
||||||
|
endpointing: bool = True
|
||||||
|
punctuate: bool = True
|
||||||
|
includeRawResponse: bool = True
|
||||||
|
extra: Mapping[str, Any] = {
|
||||||
|
"interim_results": True
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class DailyParams(TransportParams):
|
class DailyParams(TransportParams):
|
||||||
transcription_enabled: bool = False
|
transcription_enabled: bool = False
|
||||||
transcription_settings: Mapping[str, Any] = {
|
transcription_settings: DailyTranscriptionSettings = DailyTranscriptionSettings()
|
||||||
"language": "en",
|
|
||||||
"tier": "nova",
|
|
||||||
"model": "2-conversationalai",
|
|
||||||
"profanity_filter": True,
|
|
||||||
"redact": False,
|
|
||||||
"endpointing": True,
|
|
||||||
"punctuate": True,
|
|
||||||
"includeRawResponse": True,
|
|
||||||
"extra": {
|
|
||||||
"interim_results": True,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class DailyCallbacks(BaseModel):
|
class DailyCallbacks(BaseModel):
|
||||||
@@ -265,7 +267,8 @@ class DailySession(EventHandler):
|
|||||||
if self._token and self._params.transcription_enabled:
|
if self._token and self._params.transcription_enabled:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Enabling transcription with settings {self._params.transcription_settings}")
|
f"Enabling transcription with settings {self._params.transcription_settings}")
|
||||||
self._client.start_transcription(self._params.transcription_settings)
|
self._client.start_transcription(
|
||||||
|
self._params.transcription_settings.model_dump())
|
||||||
|
|
||||||
self._callbacks.on_joined(data["participants"]["local"])
|
self._callbacks.on_joined(data["participants"]["local"])
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user