start_medical_scribe_stream
async
¶
start_medical_scribe_stream(
language_code: MedicalScribeLanguageCode,
media_sample_rate_hertz: MedicalScribeMediaSampleRateHertz,
media_encoding: MedicalScribeMediaEncoding,
input_stream: AsyncIterator[_MedicalScribeInputStream] | _MedicalScribeInputStream,
*,
config_overrides: Optional[AsyncTranscribeStreamingClientConfig] = None,
session_id: Optional[SessionId] = None,
) -> AsyncGenerator[StartMedicalScribeStreamResponse]
Starts a bidirectional HTTP/2 stream, where audio is streamed to Amazon Web Services HealthScribe and the transcription results are streamed to your application.
When you start a stream, you first specify the stream configuration in a MedicalScribeConfigurationEvent. This event includes channel definitions, encryption settings, medical scribe context, and post-stream analytics settings, such as the output configuration for aggregated transcript and clinical note generation. These are additional streaming session configurations beyond those provided in your initial start request headers. Whether you are starting a new session or resuming an existing session, your first event must be a MedicalScribeConfigurationEvent.
After you send a MedicalScribeConfigurationEvent, you start AudioEvents and Amazon Web Services HealthScribe responds with real-time transcription results. When you are finished, to start processing the results with the post-stream analytics, send a MedicalScribeSessionControlEvent with a Type of END_OF_SESSION and Amazon Web Services HealthScribe starts the analytics.
You can pause or resume streaming. To pause streaming, complete the input stream without sending the MedicalScribeSessionControlEvent. To resume streaming, call the StartMedicalScribeStream and specify the same SessionId you used to start the stream.
The following parameters are required:
-
language-code -
media-encoding -
media-sample-rate-hertz
For more information on streaming with Amazon Web Services HealthScribe, see Amazon Web Services HealthScribe.
Parameters:
-
session_id(Optional[SessionId], default:None) –Specify an identifier for your streaming session (in UUID format). If you don't include a SessionId in your request, Amazon Web Services HealthScribe generates an ID and returns it in the response.
-
language_code(MedicalScribeLanguageCode) –Specify the language code for your HealthScribe streaming session.
-
media_sample_rate_hertz(MedicalScribeMediaSampleRateHertz) –Specify the sample rate of the input audio (in hertz). Amazon Web Services HealthScribe supports a range from 16,000 Hz to 48,000 Hz. The sample rate you specify must match that of your audio.
-
media_encoding(MedicalScribeMediaEncoding) –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.
-
-
input_stream(AsyncIterator[_MedicalScribeInputStream] | _MedicalScribeInputStream) –Specify the input stream where you will send events in real time.
The first element of the input stream must be a
MedicalScribeConfigurationEvent.
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/async_transcribe_streaming.py
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | |