Skip to content

feat(types): add four documented transcript options the SDK could not send - #314

Open
mayankbohradev wants to merge 1 commit into
AssemblyAI:masterfrom
mayankbohradev:feat/transcript-request-option-parity
Open

mayankbohradev wants to merge 1 commit into
AssemblyAI:masterfrom
mayankbohradev:feat/transcript-request-option-parity

Conversation

@mayankbohradev

Copy link
Copy Markdown
Contributor

What

Adds four options that the /v2/transcript API documents but this SDK could not send: speaker_options.include_speaker_confidence, language_detection_options.on_no_speech_detected, redact_pii_audio_options.return_redacted_no_speech_audio and redact_static_entities.

Why

The option models ignore unknown fields, so each of these was dropped from the request with no error.

  • A caller who set on_no_speech_detected="fallback" still got a failed transcript on silent audio.
  • speaker_confidence in a response was discarded, and was missing from json_response too.
  • redact_static_entities could not be set at all.

How

  • SpeakerOptions.include_speaker_confidence, and speaker_confidence on Word, so words and utterances carry it.
  • LanguageDetectionOptions.on_no_speech_detected, also a keyword of set_language_detection.
  • RedactPiiAudioOptions.return_redacted_no_speech_audio.
  • redact_static_entities on TranscriptionConfig: constructor, property, and set_redact_pii(static_entities=...). Disabling redaction clears it, like the other redaction options, because the API rejects it without redact_pii.
  • Each new parameter is last in its signature, so no positional argument shifts.

Testing

  • 15 new test cases. 14 fail on master; the other one guards that the field stays absent by default. Eight assert the captured request body.
  • They pass on Python 3.9, 3.11, 3.12 and 3.13, on pydantic 1.10, on pydantic 2 with pydantic-settings, and on the httpx 0.22 and 0.24 floors.
  • Full unit suite: 1048 passed. test_a_forked_child_does_not_share_the_parents_tts_connections fails on macOS on master too.
  • ruff 0.3.5 and mypy 1.5.1 pass as CI runs them.

Notes for reviewers

… send

The option models ignore unknown fields, so these were dropped from the
request with no error:

- speaker_options.include_speaker_confidence, with speaker_confidence
  on words and utterances in the response
- language_detection_options.on_no_speech_detected
- redact_pii_audio_options.return_redacted_no_speech_audio
- redact_static_entities

Each new parameter is last in its signature.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant