Skip to content

Commit 0e70efd

Browse files
shiftudavidzhao
andauthored
feat: Azure.STT support profanity_option (#1540)
Co-authored-by: David Zhao <dz@livekit.io>
1 parent 0458e2c commit 0e70efd

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.changeset/lemon-eagles-glow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"livekit-plugins-azure": patch
3+
---
4+
5+
feat: Azure.STT support profanity_option

livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/stt.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class STTOptions:
4242
str
4343
] # see https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=stt
4444
speech_endpoint: str | None = None
45+
profanity: speechsdk.enums.ProfanityOption | None = None
4546

4647

4748
class STT(stt.STT):
@@ -61,6 +62,7 @@ def __init__(
6162
languages: list[str] = ["en-US"],
6263
# for compatibility with other STT plugins
6364
language: str | None = None,
65+
profanity: speechsdk.enums.ProfanityOption | None = None,
6466
):
6567
"""
6668
Create a new instance of Azure STT.
@@ -102,6 +104,7 @@ def __init__(
102104
segmentation_silence_timeout_ms=segmentation_silence_timeout_ms,
103105
segmentation_max_time_ms=segmentation_max_time_ms,
104106
segmentation_strategy=segmentation_strategy,
107+
profanity=profanity,
105108
)
106109
self._streams = weakref.WeakSet[SpeechStream]()
107110

@@ -330,6 +333,8 @@ def _create_speech_recognizer(
330333
speechsdk.enums.PropertyId.Speech_SegmentationStrategy,
331334
str(config.segmentation_strategy),
332335
)
336+
if config.profanity is not None:
337+
speech_config.set_profanity(config.profanity)
333338

334339
auto_detect_source_language_config = None
335340
if config.languages and len(config.languages) >= 1:

0 commit comments

Comments
 (0)