start_medical_stream_transcription
¶
start_medical_stream_transcription(
language_code: LanguageCode,
media_sample_rate_hertz: MediaSampleRateHertz,
media_encoding: MediaEncoding,
specialty: Specialty,
type: Type,
audio_stream: Iterator[_AudioStream] | _AudioStream,
*,
config_overrides: Optional[TranscribeStreamingClientConfig] = None,
vocabulary_name: Optional[VocabularyName] = None,
show_speaker_label: Optional[Boolean] = None,
session_id: Optional[SessionId] = None,
enable_channel_identification: Optional[Boolean] = None,
number_of_channels: Optional[NumberOfChannels] = None,
content_identification_type: Optional[MedicalContentIdentificationType] = None,
) -> Generator[StartMedicalStreamTranscriptionResponse]
Starts a bidirectional HTTP/2 or WebSocket stream where audio is streamed to Amazon Transcribe Medical and the transcription results are streamed to your application.
The following parameters are required:
-
language-code -
media-encoding -
sample-rate
For more information on streaming with Amazon Transcribe Medical, see Transcribing streaming audio.
Parameters:
-
language_code(LanguageCode) –Specify the language code that represents the language spoken in your audio.
Amazon Transcribe Medical only supports US English (
en-US). -
media_sample_rate_hertz(MediaSampleRateHertz) –The sample rate of the input audio (in hertz). Amazon Transcribe Medical supports a range from 16,000 Hz to 48,000 Hz. Note that the sample rate you specify must match that of your audio.
-
media_encoding(MediaEncoding) –Specify the encoding used for the input audio. Supported formats are:
-
FLAC
-
OPUS-encoded audio in an Ogg container
-
PCM (only signed 16-bit little-endian audio formats, which does not include WAV)
For more information, see Media formats.
-
-
vocabulary_name(Optional[VocabularyName], default:None) –Specify the name of the custom vocabulary that you want to use when processing your transcription. Note that vocabulary names are case sensitive.
-
specialty(Specialty) –Specify the medical specialty contained in your audio.
-
type(Type) –Specify the type of input audio. For example, choose
DICTATIONfor a provider dictating patient notes andCONVERSATIONfor a dialogue between a patient and a medical professional. -
show_speaker_label(Optional[Boolean], default:None) –Enables speaker partitioning (diarization) in your transcription output. Speaker partitioning labels the speech from individual speakers in your media file.
For more information, see Partitioning speakers (diarization).
-
session_id(Optional[SessionId], default:None) –Specify a name for your transcription session. If you don't include this parameter in your request, Amazon Transcribe Medical generates an ID and returns it in the response.
-
enable_channel_identification(Optional[Boolean], default:None) –Enables channel identification in multi-channel audio.
Channel identification transcribes the audio on each channel independently, then appends the output for each channel into one transcript.
If you have multi-channel audio and do not enable channel identification, your audio is transcribed in a continuous manner and your transcript is not separated by channel.
If you include
EnableChannelIdentificationin your request, you must also includeNumberOfChannels.For more information, see Transcribing multi-channel audio.
-
number_of_channels(Optional[NumberOfChannels], default:None) –Specify the number of channels in your audio stream. This value must be
2, as only two channels are supported. If your audio doesn't contain multiple channels, do not include this parameter in your request.If you include
NumberOfChannelsin your request, you must also includeEnableChannelIdentification. -
content_identification_type(Optional[MedicalContentIdentificationType], default:None) –Labels all personal health information (PHI) identified in your transcript.
Content identification is performed at the segment level; PHI is flagged upon complete transcription of an audio segment.
For more information, see Identifying personal health information (PHI) in a transcription.
Raises:
-
BadRequestException–One or more arguments to the
StartStreamTranscription,StartMedicalStreamTranscription, orStartCallAnalyticsStreamTranscriptionoperation was not valid. For example,MediaEncodingorLanguageCodeused unsupported values. Check the specified parameters and try your request again. -
ConflictException–A new stream started with the same session ID. The current stream has been terminated.
-
InternalFailureException–A problem occurred while processing the audio. Amazon Transcribe terminated processing.
-
LimitExceededException–Your client has exceeded one of the Amazon Transcribe limits, typically the concurrent stream service quota. This error can also occur if a stream exceeds the maximum session duration. In rare cases, this error can also occur if you increase your number of concurrent streams too quickly. Reduce your number of concurrent streams and try your request again using an exponential backoff strategy.
-
ServiceUnavailableException–The service is currently unavailable. Try your request later.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_transcribe_streaming/_services/transcribe_streaming.py
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |