@@ -876,6 +876,8 @@ class RawTranscriptionConfig(BaseModel):
876876 "The list of PII Redaction policies to enable."
877877 redact_pii_sub : Optional [PIISubstitutionPolicy ] = None
878878 "The replacement logic for detected PII."
879+ redact_pii_return_unredacted : Optional [bool ] = None
880+ "If `redact_pii` is enabled, also return the unredacted text/words/utterances alongside the redacted fields."
879881
880882 speaker_labels : Optional [bool ] = None
881883 "Enable Speaker Diarization."
@@ -1008,6 +1010,7 @@ def __init__(
10081010 redact_pii_audio_options : Optional [RedactPiiAudioOptions ] = None ,
10091011 redact_pii_policies : Optional [List [PIIRedactionPolicy ]] = None ,
10101012 redact_pii_sub : Optional [PIISubstitutionPolicy ] = None ,
1013+ redact_pii_return_unredacted : Optional [bool ] = None ,
10111014 speaker_labels : Optional [bool ] = None ,
10121015 speakers_expected : Optional [int ] = None ,
10131016 speaker_options : Optional [SpeakerOptions ] = None ,
@@ -1060,6 +1063,7 @@ def __init__(
10601063 redact_pii_audio_options: Options for controlling PII audio redaction behavior (e.g., override the redaction method to silence).
10611064 redact_pii_policies: The list of PII Redaction policies to enable.
10621065 redact_pii_sub: The replacement logic for detected PII.
1066+ redact_pii_return_unredacted: If `redact_pii` is enabled, also return the unredacted text/words/utterances on the transcript response. Requires `redact_pii=True`.
10631067 speaker_labels: Enable Speaker Diarization.
10641068 speakers_expected: The number of speakers you expect to hear in your audio file. Up to 10 speakers are supported.
10651069 speaker_options: Advanced options for controlling speaker diarization parameters, including min and max speakers expected.
@@ -1117,6 +1121,7 @@ def __init__(
11171121 redact_pii_audio_options ,
11181122 redact_pii_policies ,
11191123 redact_pii_sub ,
1124+ redact_pii_return_unredacted ,
11201125 )
11211126 self .set_speaker_diarization (speaker_labels , speakers_expected , speaker_options )
11221127 self .set_content_safety (content_safety , content_safety_confidence )
@@ -1397,6 +1402,12 @@ def redact_pii_sub(self) -> Optional[PIISubstitutionPolicy]:
13971402
13981403 return self ._raw_transcription_config .redact_pii_sub
13991404
1405+ @property
1406+ def redact_pii_return_unredacted (self ) -> Optional [bool ]:
1407+ "Returns whether the unredacted text/words/utterances should also be returned alongside redacted fields."
1408+
1409+ return self ._raw_transcription_config .redact_pii_return_unredacted
1410+
14001411 @property
14011412 def speaker_labels (self ) -> Optional [bool ]:
14021413 "Returns the status of the Speaker Diarization feature."
@@ -1797,6 +1808,7 @@ def set_redact_pii(
17971808 redact_audio_options : Optional [RedactPiiAudioOptions ] = None ,
17981809 policies : Optional [List [PIIRedactionPolicy ]] = None ,
17991810 substitution : Optional [PIISubstitutionPolicy ] = None ,
1811+ return_unredacted : Optional [bool ] = None ,
18001812 ) -> Self :
18011813 """
18021814 Enables Personal Identifiable Information (PII) Redaction feature.
@@ -1808,6 +1820,7 @@ def set_redact_pii(
18081820 redact_audio_options: Options for controlling PII audio redaction behavior (e.g., override the redaction method to silence).
18091821 policies: A list of PII redaction policies to enable.
18101822 substitution: The replacement logic for detected PII (`PIISubstutionPolicy.hash` by default).
1823+ return_unredacted: Also return the unredacted text/words/utterances on the transcript response. Only valid when redaction is enabled.
18111824 """
18121825
18131826 if not enable :
@@ -1817,6 +1830,7 @@ def set_redact_pii(
18171830 self ._raw_transcription_config .redact_pii_audio_options = None
18181831 self ._raw_transcription_config .redact_pii_policies = None
18191832 self ._raw_transcription_config .redact_pii_sub = None
1833+ self ._raw_transcription_config .redact_pii_return_unredacted = None
18201834
18211835 return self
18221836
@@ -1829,6 +1843,7 @@ def set_redact_pii(
18291843 self ._raw_transcription_config .redact_pii_audio_options = redact_audio_options
18301844 self ._raw_transcription_config .redact_pii_policies = policies
18311845 self ._raw_transcription_config .redact_pii_sub = substitution
1846+ self ._raw_transcription_config .redact_pii_return_unredacted = return_unredacted
18321847
18331848 return self
18341849
@@ -2280,6 +2295,8 @@ class BaseTranscript(BaseModel):
22802295 "The list of PII Redaction policies to enable."
22812296 redact_pii_sub : Optional [PIISubstitutionPolicy ] = None
22822297 "The replacement logic for detected PII."
2298+ redact_pii_return_unredacted : Optional [bool ] = None
2299+ "If `redact_pii` is enabled, also return the unredacted text/words/utterances alongside the redacted fields."
22832300
22842301 speaker_labels : Optional [bool ] = None
22852302 "Enable Speaker Diarization."
@@ -2424,6 +2441,15 @@ class TranscriptResponse(BaseTranscript):
24242441 utterances : Optional [List [Utterance ]] = None
24252442 "When `dual_channel`, `multichannel`, or `speaker_labels` is enabled, a list of turn-by-turn utterances"
24262443
2444+ unredacted_text : Optional [str ] = None
2445+ "The unredacted transcript text. Returned only when `redact_pii_return_unredacted` was set with `redact_pii`."
2446+
2447+ unredacted_words : Optional [List [Word ]] = None
2448+ "The unredacted list of individual words. Returned only when `redact_pii_return_unredacted` was set with `redact_pii`."
2449+
2450+ unredacted_utterances : Optional [List [Utterance ]] = None
2451+ "The unredacted list of utterances. Returned only when `redact_pii_return_unredacted` was set with `redact_pii` and channel/speaker modes are enabled."
2452+
24272453 confidence : Optional [float ] = None
24282454 "The confidence our model has in the transcribed text, between 0.0 and 1.0"
24292455
0 commit comments