From 8506c0e92948bf5a19b8a6dba1182f5275abb7cd Mon Sep 17 00:00:00 2001 From: Carter Campbell Date: Tue, 28 Jul 2026 17:17:28 -0400 Subject: [PATCH 1/2] feat(types): add short_file_diarization_method to SpeakerOptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exposes the short-file diarization method API parameter (deliberate | balanced | conservative | aggressive), completing the pair started in PR #161 — its long_file_diarization_method half already landed via the #162 sync, which is also what left #161 conflicted. Field definition and tests carried over from #161. Supersedes and closes #161. Co-Authored-By: zack Co-Authored-By: Claude Fable 5 --- assemblyai/types.py | 6 ++++++ tests/unit/test_speaker_options.py | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/assemblyai/types.py b/assemblyai/types.py index e20b1c36..fd1aa30b 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 46bd4277..3fe937ec 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" From 349ad6dba403c7330bf5df90fdb25a169109958d Mon Sep 17 00:00:00 2001 From: Carter Campbell Date: Wed, 2 Sep 2026 12:42:56 -0600 Subject: [PATCH 2/2] chore: bump version to 1.2.0 Co-Authored-By: Claude Fable 5.1 --- assemblyai/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assemblyai/__version__.py b/assemblyai/__version__.py index 6849410a..c68196d1 100644 --- a/assemblyai/__version__.py +++ b/assemblyai/__version__.py @@ -1 +1 @@ -__version__ = "1.1.0" +__version__ = "1.2.0"