diff --git a/assemblyai/types.py b/assemblyai/types.py index e20b1c3..fd1aa30 100644 --- a/assemblyai/types.py +++ b/assemblyai/types.py @@ -829,6 +829,12 @@ class SpeakerOptions(BaseModel): None, description="Enable or disable two-stage clustering for speaker diarization", ) + short_file_diarization_method: Optional[ + Literal["deliberate", "balanced", "conservative", "aggressive"] + ] = Field( + None, + description="Diarization method for short files. Options: deliberate (default), balanced, conservative, aggressive", + ) long_file_diarization_method: Optional[Literal["standard", "experimental"]] = Field( None, description="Diarization method for long files. Options: standard (default), experimental", diff --git a/tests/unit/test_speaker_options.py b/tests/unit/test_speaker_options.py index 46bd427..3fe937e 100644 --- a/tests/unit/test_speaker_options.py +++ b/tests/unit/test_speaker_options.py @@ -129,6 +129,30 @@ def test_transcription_config_with_two_stage_clustering(): assert config.speaker_options.use_two_stage_clustering is False +def test_speaker_options_short_file_diarization_method(): + """Test that SpeakerOptions can be created with short_file_diarization_method.""" + speaker_options = aai.SpeakerOptions(short_file_diarization_method="deliberate") + assert speaker_options.short_file_diarization_method == "deliberate" + + +def test_speaker_options_short_file_diarization_all_methods(): + """Test all valid values for short_file_diarization_method.""" + methods = ["deliberate", "balanced", "conservative", "aggressive"] + for method in methods: + speaker_options = aai.SpeakerOptions(short_file_diarization_method=method) + assert speaker_options.short_file_diarization_method == method + + +def test_speaker_options_with_diarization_methods(): + """Test that SpeakerOptions can be created with both diarization methods.""" + speaker_options = aai.SpeakerOptions( + short_file_diarization_method="balanced", + long_file_diarization_method="experimental", + ) + assert speaker_options.short_file_diarization_method == "balanced" + assert speaker_options.long_file_diarization_method == "experimental" + + def test_speaker_options_long_file_diarization_method(): """Test that SpeakerOptions can be created with long_file_diarization_method.""" speaker_options = aai.SpeakerOptions(long_file_diarization_method="experimental") @@ -164,6 +188,7 @@ def test_transcription_config_with_all_speaker_options(): min_speakers_expected=2, max_speakers_expected=5, use_two_stage_clustering=False, + short_file_diarization_method="conservative", long_file_diarization_method="experimental", ) @@ -175,4 +200,5 @@ def test_transcription_config_with_all_speaker_options(): assert config.speaker_options.min_speakers_expected == 2 assert config.speaker_options.max_speakers_expected == 5 assert config.speaker_options.use_two_stage_clustering is False + assert config.speaker_options.short_file_diarization_method == "conservative" assert config.speaker_options.long_file_diarization_method == "experimental"