@@ -127,3 +127,68 @@ def test_set_language_detection_disable():
127127 assert config .language_detection is None
128128 assert config .language_confidence_threshold is None
129129 assert config .language_detection_options is None
130+
131+
132+ def test_language_detection_options_with_on_low_language_confidence ():
133+ """Test that LanguageDetectionOptions accepts on_low_language_confidence parameter."""
134+ options = aai .LanguageDetectionOptions (
135+ expected_languages = ["en" , "es" ],
136+ fallback_language = "en" ,
137+ on_low_language_confidence = "fallback" ,
138+ )
139+ assert options .expected_languages == ["en" , "es" ]
140+ assert options .fallback_language == "en"
141+ assert options .on_low_language_confidence == "fallback"
142+
143+
144+ def test_language_detection_options_on_low_confidence_only ():
145+ """Test that LanguageDetectionOptions can be created with only on_low_language_confidence."""
146+ options = aai .LanguageDetectionOptions (on_low_language_confidence = "error" )
147+ assert options .expected_languages is None
148+ assert options .fallback_language is None
149+ assert options .on_low_language_confidence == "error"
150+
151+
152+ def test_set_language_detection_with_on_low_confidence ():
153+ """Test the set_language_detection method with on_low_language_confidence."""
154+ config = aai .TranscriptionConfig ().set_language_detection (
155+ confidence_threshold = 0.8 ,
156+ expected_languages = ["en" , "fr" ],
157+ fallback_language = "en" ,
158+ on_low_language_confidence = "fallback" ,
159+ )
160+
161+ assert config .language_detection is True
162+ assert config .language_confidence_threshold == 0.8
163+ assert config .language_detection_options .expected_languages == ["en" , "fr" ]
164+ assert config .language_detection_options .fallback_language == "en"
165+ assert config .language_detection_options .on_low_language_confidence == "fallback"
166+
167+
168+ def test_set_language_detection_on_low_confidence_only ():
169+ """Test set_language_detection with only on_low_language_confidence parameter."""
170+ config = aai .TranscriptionConfig ().set_language_detection (
171+ on_low_language_confidence = "error"
172+ )
173+
174+ assert config .language_detection is True
175+ assert config .language_detection_options is not None
176+ assert config .language_detection_options .on_low_language_confidence == "error"
177+
178+
179+ def test_transcription_config_with_on_low_confidence_in_options ():
180+ """Test that TranscriptionConfig properly handles on_low_language_confidence in options."""
181+ options = aai .LanguageDetectionOptions (
182+ fallback_language = "en" , on_low_language_confidence = "fallback"
183+ )
184+
185+ config = aai .TranscriptionConfig (
186+ language_detection = True ,
187+ language_confidence_threshold = 0.9 ,
188+ language_detection_options = options ,
189+ )
190+
191+ assert config .language_detection is True
192+ assert config .language_confidence_threshold == 0.9
193+ assert config .language_detection_options .fallback_language == "en"
194+ assert config .language_detection_options .on_low_language_confidence == "fallback"
0 commit comments