diff --git a/assemblyai/__version__.py b/assemblyai/__version__.py index f9a0e54..c7b8c61 100644 --- a/assemblyai/__version__.py +++ b/assemblyai/__version__.py @@ -1 +1 @@ -__version__ = "0.64.32" +__version__ = "0.64.33" diff --git a/assemblyai/types.py b/assemblyai/types.py index e20b1c3..4b44f71 100644 --- a/assemblyai/types.py +++ b/assemblyai/types.py @@ -2259,6 +2259,8 @@ class SentencesResponse(BaseModel): sentences: List[Sentence] confidence: float audio_duration: float + speech_model_used: Optional[str] = None + "The actual speech model that was used for the transcription" class Paragraph(Word): @@ -2273,6 +2275,8 @@ class ParagraphsResponse(BaseModel): paragraphs: List[Paragraph] confidence: float audio_duration: float + speech_model_used: Optional[str] = None + "The actual speech model that was used for the transcription" class BaseTranscript(BaseModel): diff --git a/tests/unit/factories.py b/tests/unit/factories.py index aa1e381..ef684ac 100644 --- a/tests/unit/factories.py +++ b/tests/unit/factories.py @@ -439,6 +439,7 @@ class Meta: sentences = factory.List([factory.SubFactory(SentenceFactory)]) confidence = factory.Faker("pyfloat", min_value=0.0, max_value=1.0) audio_duration = factory.Faker("pyint") + speech_model_used = "universal-2" class ParagraphsResponseFactory(factory.Factory): @@ -448,6 +449,7 @@ class Meta: paragraphs = factory.List([factory.SubFactory(ParagraphFactory)]) confidence = factory.Faker("pyfloat", min_value=0.0, max_value=1.0) audio_duration = factory.Faker("pyint") + speech_model_used = "universal-2" def generate_dict_factory(f: factory.Factory) -> Callable[[], Dict[str, Any]]: diff --git a/tests/unit/test_transcript.py b/tests/unit/test_transcript.py index fec85c7..25f6f6c 100644 --- a/tests/unit/test_transcript.py +++ b/tests/unit/test_transcript.py @@ -267,6 +267,24 @@ def compare_words(lhs: List[aai.Word], rhs: List[Dict[str, Any]]) -> bool: assert len(httpx_mock.get_requests()) == 2 +def test_sentences_and_paragraphs_parse_speech_model_used(): + """ + Tests that speech_model_used is parsed on the sentences and paragraphs responses. + """ + mock_sentences_response = factories.generate_dict_factory( + factories.SentencesResponseFactory + )() + mock_paragraphs_response = factories.generate_dict_factory( + factories.ParagraphsResponseFactory + )() + + sentences_response = aai.types.SentencesResponse(**mock_sentences_response) + paragraphs_response = aai.types.ParagraphsResponse(**mock_paragraphs_response) + + assert sentences_response.speech_model_used == "universal-2" + assert paragraphs_response.speech_model_used == "universal-2" + + def test_get_sentences_and_paragraphs_fails(httpx_mock: HTTPXMock): """ Tests whether getting sentences and paragraphs fails.