transcribestreaming

package module
v0.0.0-...-68f2935 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Overview

Package transcribestreaming provides the API client, operations, and parameter types for Amazon Transcribe Streaming Service.

Amazon Transcribe streaming offers three main types of real-time transcription: Standard, Medical, and Call Analytics.

  • Standard transcriptions are the most common option. Refer to for details.

  • Medical transcriptions are tailored to medical professionals and incorporate medical terms. A common use case for this service is transcribing doctor-patient dialogue in real time, so doctors can focus on their patient instead of taking notes. Refer to for details.

  • Call Analytics transcriptions are designed for use with call center audio on two different channels; if you're looking for insight into customer service calls, use this option. Refer to for details.

Index

Constants

View Source
const ServiceAPIVersion = "2017-10-26"
View Source
const ServiceID = "Transcribe Streaming"

Variables

This section is empty.

Functions

func NewDefaultEndpointResolver

func NewDefaultEndpointResolver() *internalendpoints.Resolver

NewDefaultEndpointResolver constructs a new service endpoint resolver

func WithAPIOptions

func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options)

WithAPIOptions returns a functional option for setting the Client's APIOptions option.

func WithEndpointResolver deprecated

func WithEndpointResolver(v EndpointResolver) func(*Options)

Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for this field will likely prevent you from using any endpoint-related service features released after the introduction of EndpointResolverV2 and BaseEndpoint.

To migrate an EndpointResolver implementation that uses a custom endpoint, set the client option BaseEndpoint instead.

func WithEndpointResolverV2

func WithEndpointResolverV2(v EndpointResolverV2) func(*Options)

WithEndpointResolverV2 returns a functional option for setting the Client's EndpointResolverV2 option.

func WithSigV4SigningName

func WithSigV4SigningName(name string) func(*Options)

WithSigV4SigningName applies an override to the authentication workflow to use the given signing name for SigV4-authenticated operations.

This is an advanced setting. The value here is FINAL, taking precedence over the resolved signing name from both auth scheme resolution and endpoint resolution.

func WithSigV4SigningRegion

func WithSigV4SigningRegion(region string) func(*Options)

WithSigV4SigningRegion applies an override to the authentication workflow to use the given signing region for SigV4-authenticated operations.

This is an advanced setting. The value here is FINAL, taking precedence over the resolved signing region from both auth scheme resolution and endpoint resolution.

Types

type AudioStreamWriter

type AudioStreamWriter interface {
	Send(context.Context, types.AudioStream) error
	Close() error
	Err() error
}

AudioStreamWriter provides the interface for writing events to a stream.

The writer's Close method must allow multiple concurrent calls.

type AuthResolverParameters

type AuthResolverParameters struct {
	// The name of the operation being invoked.
	Operation string

	// The region in which the operation is being invoked.
	Region string
}

AuthResolverParameters contains the set of inputs necessary for auth scheme resolution.

type AuthSchemeResolver

type AuthSchemeResolver interface {
	ResolveAuthSchemes(context.Context, *AuthResolverParameters) ([]*smithyauth.Option, error)
}

AuthSchemeResolver returns a set of possible authentication options for an operation.

type CallAnalyticsTranscriptResultStreamReader

type CallAnalyticsTranscriptResultStreamReader interface {
	Events() <-chan types.CallAnalyticsTranscriptResultStream
	Close() error
	Err() error
}

CallAnalyticsTranscriptResultStreamReader provides the interface for reading events from a stream.

The writer's Close method must allow multiple concurrent calls.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides the API client to make operations call for Amazon Transcribe Streaming Service.

func New

func New(options Options, optFns ...func(*Options)) *Client

New returns an initialized Client based on the functional options. Provide additional functional options to further configure the behavior of the client, such as changing the client's endpoint or adding custom middleware behavior.

func NewFromConfig

func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client

NewFromConfig returns a new client from the provided config.

func (*Client) Options

func (c *Client) Options() Options

Options returns a copy of the client configuration.

Callers SHOULD NOT perform mutations on any inner structures within client config. Config overrides should instead be made on a per-operation basis through functional options.

func (*Client) StartCallAnalyticsStreamTranscription

func (c *Client) StartCallAnalyticsStreamTranscription(ctx context.Context, params *StartCallAnalyticsStreamTranscriptionInput, optFns ...func(*Options)) (*StartCallAnalyticsStreamTranscriptionOutput, error)

Starts a bidirectional HTTP/2 or WebSocket stream where audio is streamed to Amazon Transcribe and the transcription results are streamed to your application. Use this operation for Call Analyticstranscriptions.

The following parameters are required:

  • language-code

  • media-encoding

  • sample-rate

For more information on streaming with Amazon Transcribe, see Transcribing streaming audio.

func (*Client) StartMedicalStreamTranscription

func (c *Client) StartMedicalStreamTranscription(ctx context.Context, params *StartMedicalStreamTranscriptionInput, optFns ...func(*Options)) (*StartMedicalStreamTranscriptionOutput, error)

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.

func (*Client) StartStreamTranscription

func (c *Client) StartStreamTranscription(ctx context.Context, params *StartStreamTranscriptionInput, optFns ...func(*Options)) (*StartStreamTranscriptionOutput, error)

Starts a bidirectional HTTP/2 or WebSocket stream where audio is streamed to Amazon Transcribe and the transcription results are streamed to your application.

The following parameters are required:

  • language-code or identify-language or identify-multiple-language

  • media-encoding

  • sample-rate

For more information on streaming with Amazon Transcribe, see Transcribing streaming audio.

type EndpointParameters

type EndpointParameters struct {
	// The AWS region used to dispatch the request.
	//
	// Parameter is
	// required.
	//
	// AWS::Region
	Region *string

	// When true, use the dual-stack endpoint. If the configured endpoint does not
	// support dual-stack, dispatching the request MAY return an error.
	//
	// Defaults to
	// false if no value is provided.
	//
	// AWS::UseDualStack
	UseDualStack *bool

	// When true, send this request to the FIPS-compliant regional endpoint. If the
	// configured endpoint does not have a FIPS compliant endpoint, dispatching the
	// request will return an error.
	//
	// Defaults to false if no value is
	// provided.
	//
	// AWS::UseFIPS
	UseFIPS *bool

	// Override the endpoint used to send this request
	//
	// Parameter is
	// required.
	//
	// SDK::Endpoint
	Endpoint *string
}

EndpointParameters provides the parameters that influence how endpoints are resolved.

func (EndpointParameters) ValidateRequired

func (p EndpointParameters) ValidateRequired() error

ValidateRequired validates required parameters are set.

func (EndpointParameters) WithDefaults

func (p EndpointParameters) WithDefaults() EndpointParameters

WithDefaults returns a shallow copy of EndpointParameterswith default values applied to members where applicable.

type EndpointResolver

type EndpointResolver interface {
	ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error)
}

EndpointResolver interface for resolving service endpoints.

func EndpointResolverFromURL

func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver

EndpointResolverFromURL returns an EndpointResolver configured using the provided endpoint url. By default, the resolved endpoint resolver uses the client region as signing region, and the endpoint source is set to EndpointSourceCustom.You can provide functional options to configure endpoint values for the resolved endpoint.

type EndpointResolverFunc

type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error)

EndpointResolverFunc is a helper utility that wraps a function so it satisfies the EndpointResolver interface. This is useful when you want to add additional endpoint resolving logic, or stub out specific endpoints with custom values.

func (EndpointResolverFunc) ResolveEndpoint

func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error)

type EndpointResolverOptions

type EndpointResolverOptions = internalendpoints.Options

EndpointResolverOptions is the service endpoint resolver options

type EndpointResolverV2

type EndpointResolverV2 interface {
	// ResolveEndpoint attempts to resolve the endpoint with the provided options,
	// returning the endpoint if found. Otherwise an error is returned.
	ResolveEndpoint(ctx context.Context, params EndpointParameters) (
		smithyendpoints.Endpoint, error,
	)
}

EndpointResolverV2 provides the interface for resolving service endpoints.

func NewDefaultEndpointResolverV2

func NewDefaultEndpointResolverV2() EndpointResolverV2

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type HTTPSignerV4

type HTTPSignerV4 interface {
	SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error
}

type MedicalTranscriptResultStreamReader

type MedicalTranscriptResultStreamReader interface {
	Events() <-chan types.MedicalTranscriptResultStream
	Close() error
	Err() error
}

MedicalTranscriptResultStreamReader provides the interface for reading events from a stream.

The writer's Close method must allow multiple concurrent calls.

type Options

type Options struct {
	// Set of options to modify how an operation is invoked. These apply to all
	// operations invoked for this client. Use functional options on operation call to
	// modify this list for per operation behavior.
	APIOptions []func(*middleware.Stack) error

	// The optional application specific identifier appended to the User-Agent header.
	AppID string

	// This endpoint will be given as input to an EndpointResolverV2. It is used for
	// providing a custom base endpoint that is subject to modifications by the
	// processing EndpointResolverV2.
	BaseEndpoint *string

	// Configures the events that will be sent to the configured logger.
	ClientLogMode aws.ClientLogMode

	// The credentials object to use when signing requests.
	Credentials aws.CredentialsProvider

	// The configuration DefaultsMode that the SDK should use when constructing the
	// clients initial default settings.
	DefaultsMode aws.DefaultsMode

	// The endpoint options to be used when attempting to resolve an endpoint.
	EndpointOptions EndpointResolverOptions

	// The service endpoint resolver.
	//
	// Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a
	// value for this field will likely prevent you from using any endpoint-related
	// service features released after the introduction of EndpointResolverV2 and
	// BaseEndpoint.
	//
	// To migrate an EndpointResolver implementation that uses a custom endpoint, set
	// the client option BaseEndpoint instead.
	EndpointResolver EndpointResolver

	// Resolves the endpoint used for a particular service operation. This should be
	// used over the deprecated EndpointResolver.
	EndpointResolverV2 EndpointResolverV2

	// Signature Version 4 (SigV4) Signer
	HTTPSignerV4 HTTPSignerV4

	// The logger writer interface to write logging messages to.
	Logger logging.Logger

	// The region to send requests to. (Required)
	Region string

	// RetryMaxAttempts specifies the maximum number attempts an API client will call
	// an operation that fails with a retryable error. A value of 0 is ignored, and
	// will not be used to configure the API client created default retryer, or modify
	// per operation call's retry max attempts.
	//
	// If specified in an operation call's functional options with a value that is
	// different than the constructed client's Options, the Client's Retryer will be
	// wrapped to use the operation's specific RetryMaxAttempts value.
	RetryMaxAttempts int

	// RetryMode specifies the retry mode the API client will be created with, if
	// Retryer option is not also specified.
	//
	// When creating a new API Clients this member will only be used if the Retryer
	// Options member is nil. This value will be ignored if Retryer is not nil.
	//
	// Currently does not support per operation call overrides, may in the future.
	RetryMode aws.RetryMode

	// Retryer guides how HTTP requests should be retried in case of recoverable
	// failures. When nil the API client will use a default retryer. The kind of
	// default retry created by the API client can be changed with the RetryMode
	// option.
	Retryer aws.Retryer

	// The RuntimeEnvironment configuration, only populated if the DefaultsMode is set
	// to DefaultsModeAuto and is initialized using config.LoadDefaultConfig . You
	// should not populate this structure programmatically, or rely on the values here
	// within your applications.
	RuntimeEnvironment aws.RuntimeEnvironment

	// The HTTP client to invoke API calls with. Defaults to client's default HTTP
	// implementation if nil.
	HTTPClient HTTPClient

	// The auth scheme resolver which determines how to authenticate for each
	// operation.
	AuthSchemeResolver AuthSchemeResolver

	// The list of auth schemes supported by the client.
	AuthSchemes []smithyhttp.AuthScheme
	// contains filtered or unexported fields
}

func (Options) Copy

func (o Options) Copy() Options

Copy creates a clone where the APIOptions list is deep copied.

func (Options) GetIdentityResolver

func (o Options) GetIdentityResolver(schemeID string) smithyauth.IdentityResolver

type ResolveEndpoint

type ResolveEndpoint struct {
	Resolver EndpointResolver
	Options  EndpointResolverOptions
}

func (*ResolveEndpoint) HandleSerialize

func (*ResolveEndpoint) ID

func (*ResolveEndpoint) ID() string

type StartCallAnalyticsStreamTranscriptionEventStream

type StartCallAnalyticsStreamTranscriptionEventStream struct {
	// AudioStreamWriter is the EventStream writer for the AudioStream events. This
	// value is automatically set by the SDK when the API call is made Use this member
	// when unit testing your code with the SDK to mock out the EventStream Writer.
	//
	// Must not be nil.
	Writer AudioStreamWriter

	// CallAnalyticsTranscriptResultStreamReader is the EventStream reader for the
	// CallAnalyticsTranscriptResultStream events. This value is automatically set by
	// the SDK when the API call is made Use this member when unit testing your code
	// with the SDK to mock out the EventStream Reader.
	//
	// Must not be nil.
	Reader CallAnalyticsTranscriptResultStreamReader
	// contains filtered or unexported fields
}

StartCallAnalyticsStreamTranscriptionEventStream provides the event stream handling for the StartCallAnalyticsStreamTranscription operation.

For testing and mocking the event stream this type should be initialized via the NewStartCallAnalyticsStreamTranscriptionEventStream constructor function. Using the functional options to pass in nested mock behavior.

func NewStartCallAnalyticsStreamTranscriptionEventStream

func NewStartCallAnalyticsStreamTranscriptionEventStream(optFns ...func(*StartCallAnalyticsStreamTranscriptionEventStream)) *StartCallAnalyticsStreamTranscriptionEventStream

NewStartCallAnalyticsStreamTranscriptionEventStream initializes an StartCallAnalyticsStreamTranscriptionEventStream. This function should only be used for testing and mocking the StartCallAnalyticsStreamTranscriptionEventStream stream within your application.

The Writer member must be set before writing events to the stream.

The Reader member must be set before reading events from the stream.

func (*StartCallAnalyticsStreamTranscriptionEventStream) Close

Close closes the stream. This will also cause the stream to be closed. Close must be called when done using the stream API. Not calling Close may result in resource leaks.

Will close the underlying EventStream writer and reader, and no more events can be sent or received.

func (*StartCallAnalyticsStreamTranscriptionEventStream) Err

Err returns any error that occurred while reading or writing EventStream Events from the service API's response. Returns nil if there were no errors.

func (*StartCallAnalyticsStreamTranscriptionEventStream) Events

Events returns a channel to read events from.

func (*StartCallAnalyticsStreamTranscriptionEventStream) Send

Send writes the event to the stream blocking until the event is written. Returns an error if the event was not written.

type StartCallAnalyticsStreamTranscriptionInput

type StartCallAnalyticsStreamTranscriptionInput struct {

	// Specify the language code that represents the language spoken in your audio.
	//
	// If you're unsure of the language spoken in your audio, consider using
	// IdentifyLanguage to enable automatic language identification.
	//
	// For a list of languages supported with streaming Call Analytics, refer to the [Supported languages]
	// table.
	//
	// [Supported languages]: https://docs.aws.amazon.com/transcribe/latest/dg/supported-languages.html
	//
	// This member is required.
	LanguageCode types.CallAnalyticsLanguageCode

	// Specify the encoding of your 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].
	//
	// [Media formats]: https://docs.aws.amazon.com/transcribe/latest/dg/how-input.html#how-input-audio
	//
	// This member is required.
	MediaEncoding types.MediaEncoding

	// The sample rate of the input audio (in hertz). Low-quality audio, such as
	// telephone audio, is typically around 8,000 Hz. High-quality audio typically
	// ranges from 16,000 Hz to 48,000 Hz. Note that the sample rate you specify must
	// match that of your audio.
	//
	// This member is required.
	MediaSampleRateHertz *int32

	// Labels all personally identifiable information (PII) identified in your
	// transcript.
	//
	// Content identification is performed at the segment level; PII specified in
	// PiiEntityTypes is flagged upon complete transcription of an audio segment.
	//
	// You can’t set ContentIdentificationType and ContentRedactionType in the same
	// request. If you set both, your request returns a BadRequestException .
	//
	// For more information, see [Redacting or identifying personally identifiable information].
	//
	// [Redacting or identifying personally identifiable information]: https://docs.aws.amazon.com/transcribe/latest/dg/pii-redaction.html
	ContentIdentificationType types.ContentIdentificationType

	// Redacts all personally identifiable information (PII) identified in your
	// transcript.
	//
	// Content redaction is performed at the segment level; PII specified in
	// PiiEntityTypes is redacted upon complete transcription of an audio segment.
	//
	// You can’t set ContentRedactionType and ContentIdentificationType in the same
	// request. If you set both, your request returns a BadRequestException .
	//
	// For more information, see [Redacting or identifying personally identifiable information].
	//
	// [Redacting or identifying personally identifiable information]: https://docs.aws.amazon.com/transcribe/latest/dg/pii-redaction.html
	ContentRedactionType types.ContentRedactionType

	// Enables partial result stabilization for your transcription. Partial result
	// stabilization can reduce latency in your output, but may impact accuracy. For
	// more information, see [Partial-result stabilization].
	//
	// [Partial-result stabilization]: https://docs.aws.amazon.com/transcribe/latest/dg/streaming.html#streaming-partial-result-stabilization
	EnablePartialResultsStabilization bool

	// Specify the name of the custom language model that you want to use when
	// processing your transcription. Note that language model names are case
	// sensitive.
	//
	// The language of the specified language model must match the language code you
	// specify in your transcription request. If the languages don't match, the custom
	// language model isn't applied. There are no errors or warnings associated with a
	// language mismatch.
	//
	// For more information, see [Custom language models].
	//
	// [Custom language models]: https://docs.aws.amazon.com/transcribe/latest/dg/custom-language-models.html
	LanguageModelName *string

	// Specify the level of stability to use when you enable partial results
	// stabilization ( EnablePartialResultsStabilization ).
	//
	// Low stability provides the highest accuracy. High stability transcribes faster,
	// but with slightly lower accuracy.
	//
	// For more information, see [Partial-result stabilization].
	//
	// [Partial-result stabilization]: https://docs.aws.amazon.com/transcribe/latest/dg/streaming.html#streaming-partial-result-stabilization
	PartialResultsStability types.PartialResultsStability

	// Specify which types of personally identifiable information (PII) you want to
	// redact in your transcript. You can include as many types as you'd like, or you
	// can select ALL .
	//
	// To include PiiEntityTypes in your Call Analytics request, you must also include
	// either ContentIdentificationType or ContentRedactionType .
	//
	// Values must be comma-separated and can include: BANK_ACCOUNT_NUMBER ,
	// BANK_ROUTING , CREDIT_DEBIT_NUMBER , CREDIT_DEBIT_CVV , CREDIT_DEBIT_EXPIRY ,
	// PIN , EMAIL , ADDRESS , NAME , PHONE , SSN , or ALL .
	PiiEntityTypes *string

	// Specify a name for your Call Analytics transcription session. If you don't
	// include this parameter in your request, Amazon Transcribe generates an ID and
	// returns it in the response.
	//
	// You can use a session ID to retry a streaming session.
	SessionId *string

	// Specify how you want your vocabulary filter applied to your transcript.
	//
	// To replace words with *** , choose mask .
	//
	// To delete words, choose remove .
	//
	// To flag words without changing them, choose tag .
	VocabularyFilterMethod types.VocabularyFilterMethod

	// Specify the name of the custom vocabulary filter that you want to use when
	// processing your transcription. Note that vocabulary filter names are case
	// sensitive.
	//
	// If the language of the specified custom vocabulary filter doesn't match the
	// language identified in your media, the vocabulary filter is not applied to your
	// transcription.
	//
	// For more information, see [Using vocabulary filtering with unwanted words].
	//
	// [Using vocabulary filtering with unwanted words]: https://docs.aws.amazon.com/transcribe/latest/dg/vocabulary-filtering.html
	VocabularyFilterName *string

	// Specify the name of the custom vocabulary that you want to use when processing
	// your transcription. Note that vocabulary names are case sensitive.
	//
	// If the language of the specified custom vocabulary doesn't match the language
	// identified in your media, the custom vocabulary is not applied to your
	// transcription.
	//
	// For more information, see [Custom vocabularies].
	//
	// [Custom vocabularies]: https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html
	VocabularyName *string
	// contains filtered or unexported fields
}

type StartCallAnalyticsStreamTranscriptionOutput

type StartCallAnalyticsStreamTranscriptionOutput struct {

	// Shows whether content identification was enabled for your Call Analytics
	// transcription.
	ContentIdentificationType types.ContentIdentificationType

	// Shows whether content redaction was enabled for your Call Analytics
	// transcription.
	ContentRedactionType types.ContentRedactionType

	// Shows whether partial results stabilization was enabled for your Call Analytics
	// transcription.
	EnablePartialResultsStabilization bool

	// Provides the language code that you specified in your Call Analytics request.
	LanguageCode types.CallAnalyticsLanguageCode

	// Provides the name of the custom language model that you specified in your Call
	// Analytics request.
	LanguageModelName *string

	// Provides the media encoding you specified in your Call Analytics request.
	MediaEncoding types.MediaEncoding

	// Provides the sample rate that you specified in your Call Analytics request.
	MediaSampleRateHertz *int32

	// Provides the stabilization level used for your transcription.
	PartialResultsStability types.PartialResultsStability

	// Lists the PII entity types you specified in your Call Analytics request.
	PiiEntityTypes *string

	// Provides the identifier for your Call Analytics streaming request.
	RequestId *string

	// Provides the identifier for your Call Analytics transcription session.
	SessionId *string

	// Provides the vocabulary filtering method used in your Call Analytics
	// transcription.
	VocabularyFilterMethod types.VocabularyFilterMethod

	// Provides the name of the custom vocabulary filter that you specified in your
	// Call Analytics request.
	VocabularyFilterName *string

	// Provides the name of the custom vocabulary that you specified in your Call
	// Analytics request.
	VocabularyName *string

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
	// contains filtered or unexported fields
}

func (*StartCallAnalyticsStreamTranscriptionOutput) GetStream

GetStream returns the type to interact with the event stream.

type StartMedicalStreamTranscriptionEventStream

type StartMedicalStreamTranscriptionEventStream struct {
	// AudioStreamWriter is the EventStream writer for the AudioStream events. This
	// value is automatically set by the SDK when the API call is made Use this member
	// when unit testing your code with the SDK to mock out the EventStream Writer.
	//
	// Must not be nil.
	Writer AudioStreamWriter

	// MedicalTranscriptResultStreamReader is the EventStream reader for the
	// MedicalTranscriptResultStream events. This value is automatically set by the SDK
	// when the API call is made Use this member when unit testing your code with the
	// SDK to mock out the EventStream Reader.
	//
	// Must not be nil.
	Reader MedicalTranscriptResultStreamReader
	// contains filtered or unexported fields
}

StartMedicalStreamTranscriptionEventStream provides the event stream handling for the StartMedicalStreamTranscription operation.

For testing and mocking the event stream this type should be initialized via the NewStartMedicalStreamTranscriptionEventStream constructor function. Using the functional options to pass in nested mock behavior.

func NewStartMedicalStreamTranscriptionEventStream

func NewStartMedicalStreamTranscriptionEventStream(optFns ...func(*StartMedicalStreamTranscriptionEventStream)) *StartMedicalStreamTranscriptionEventStream

NewStartMedicalStreamTranscriptionEventStream initializes an StartMedicalStreamTranscriptionEventStream. This function should only be used for testing and mocking the StartMedicalStreamTranscriptionEventStream stream within your application.

The Writer member must be set before writing events to the stream.

The Reader member must be set before reading events from the stream.

func (*StartMedicalStreamTranscriptionEventStream) Close

Close closes the stream. This will also cause the stream to be closed. Close must be called when done using the stream API. Not calling Close may result in resource leaks.

Will close the underlying EventStream writer and reader, and no more events can be sent or received.

func (*StartMedicalStreamTranscriptionEventStream) Err

Err returns any error that occurred while reading or writing EventStream Events from the service API's response. Returns nil if there were no errors.

func (*StartMedicalStreamTranscriptionEventStream) Events

Events returns a channel to read events from.

func (*StartMedicalStreamTranscriptionEventStream) Send

Send writes the event to the stream blocking until the event is written. Returns an error if the event was not written.

type StartMedicalStreamTranscriptionInput

type StartMedicalStreamTranscriptionInput struct {

	// Specify the language code that represents the language spoken in your audio.
	//
	// Amazon Transcribe Medical only supports US English ( en-US ).
	//
	// This member is required.
	LanguageCode types.LanguageCode

	// 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].
	//
	// [Media formats]: https://docs.aws.amazon.com/transcribe/latest/dg/how-input.html#how-input-audio
	//
	// This member is required.
	MediaEncoding types.MediaEncoding

	// 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.
	//
	// This member is required.
	MediaSampleRateHertz *int32

	// Specify the medical specialty contained in your audio.
	//
	// This member is required.
	Specialty types.Specialty

	// Specify the type of input audio. For example, choose DICTATION for a provider
	// dictating patient notes and CONVERSATION for a dialogue between a patient and a
	// medical professional.
	//
	// This member is required.
	Type types.Type

	// 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].
	//
	// [Identifying personal health information (PHI) in a transcription]: https://docs.aws.amazon.com/transcribe/latest/dg/phi-id.html
	ContentIdentificationType types.MedicalContentIdentificationType

	// 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.
	//
	// For more information, see [Transcribing multi-channel audio].
	//
	// [Transcribing multi-channel audio]: https://docs.aws.amazon.com/transcribe/latest/dg/channel-id.html
	EnableChannelIdentification bool

	// Specify the number of channels in your audio stream. Up to two channels are
	// supported.
	NumberOfChannels *int32

	// 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.
	//
	// You can use a session ID to retry a streaming session.
	SessionId *string

	// 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)].
	//
	// [Partitioning speakers (diarization)]: https://docs.aws.amazon.com/transcribe/latest/dg/diarization.html
	ShowSpeakerLabel bool

	// Specify the name of the custom vocabulary that you want to use when processing
	// your transcription. Note that vocabulary names are case sensitive.
	VocabularyName *string
	// contains filtered or unexported fields
}

type StartMedicalStreamTranscriptionOutput

type StartMedicalStreamTranscriptionOutput struct {

	// Shows whether content identification was enabled for your transcription.
	ContentIdentificationType types.MedicalContentIdentificationType

	// Shows whether channel identification was enabled for your transcription.
	EnableChannelIdentification bool

	// Provides the language code that you specified in your request. This must be
	// en-US .
	LanguageCode types.LanguageCode

	// Provides the media encoding you specified in your request.
	MediaEncoding types.MediaEncoding

	// Provides the sample rate that you specified in your request.
	MediaSampleRateHertz *int32

	// Provides the number of channels that you specified in your request.
	NumberOfChannels *int32

	// Provides the identifier for your streaming request.
	RequestId *string

	// Provides the identifier for your transcription session.
	SessionId *string

	// Shows whether speaker partitioning was enabled for your transcription.
	ShowSpeakerLabel bool

	// Provides the medical specialty that you specified in your request.
	Specialty types.Specialty

	// Provides the type of audio you specified in your request.
	Type types.Type

	// Provides the name of the custom vocabulary that you specified in your request.
	VocabularyName *string

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
	// contains filtered or unexported fields
}

func (*StartMedicalStreamTranscriptionOutput) GetStream

GetStream returns the type to interact with the event stream.

type StartStreamTranscriptionEventStream

type StartStreamTranscriptionEventStream struct {
	// AudioStreamWriter is the EventStream writer for the AudioStream events. This
	// value is automatically set by the SDK when the API call is made Use this member
	// when unit testing your code with the SDK to mock out the EventStream Writer.
	//
	// Must not be nil.
	Writer AudioStreamWriter

	// TranscriptResultStreamReader is the EventStream reader for the
	// TranscriptResultStream events. This value is automatically set by the SDK when
	// the API call is made Use this member when unit testing your code with the SDK to
	// mock out the EventStream Reader.
	//
	// Must not be nil.
	Reader TranscriptResultStreamReader
	// contains filtered or unexported fields
}

StartStreamTranscriptionEventStream provides the event stream handling for the StartStreamTranscription operation.

For testing and mocking the event stream this type should be initialized via the NewStartStreamTranscriptionEventStream constructor function. Using the functional options to pass in nested mock behavior.

func NewStartStreamTranscriptionEventStream

func NewStartStreamTranscriptionEventStream(optFns ...func(*StartStreamTranscriptionEventStream)) *StartStreamTranscriptionEventStream

NewStartStreamTranscriptionEventStream initializes an StartStreamTranscriptionEventStream. This function should only be used for testing and mocking the StartStreamTranscriptionEventStream stream within your application.

The Writer member must be set before writing events to the stream.

The Reader member must be set before reading events from the stream.

func (*StartStreamTranscriptionEventStream) Close

Close closes the stream. This will also cause the stream to be closed. Close must be called when done using the stream API. Not calling Close may result in resource leaks.

Will close the underlying EventStream writer and reader, and no more events can be sent or received.

func (*StartStreamTranscriptionEventStream) Err

Err returns any error that occurred while reading or writing EventStream Events from the service API's response. Returns nil if there were no errors.

func (*StartStreamTranscriptionEventStream) Events

Events returns a channel to read events from.

func (*StartStreamTranscriptionEventStream) Send

Send writes the event to the stream blocking until the event is written. Returns an error if the event was not written.

type StartStreamTranscriptionInput

type StartStreamTranscriptionInput struct {

	// Specify the encoding of your 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].
	//
	// [Media formats]: https://docs.aws.amazon.com/transcribe/latest/dg/how-input.html#how-input-audio
	//
	// This member is required.
	MediaEncoding types.MediaEncoding

	// The sample rate of the input audio (in hertz). Low-quality audio, such as
	// telephone audio, is typically around 8,000 Hz. High-quality audio typically
	// ranges from 16,000 Hz to 48,000 Hz. Note that the sample rate you specify must
	// match that of your audio.
	//
	// This member is required.
	MediaSampleRateHertz *int32

	// Labels all personally identifiable information (PII) identified in your
	// transcript.
	//
	// Content identification is performed at the segment level; PII specified in
	// PiiEntityTypes is flagged upon complete transcription of an audio segment.
	//
	// You can’t set ContentIdentificationType and ContentRedactionType in the same
	// request. If you set both, your request returns a BadRequestException .
	//
	// For more information, see [Redacting or identifying personally identifiable information].
	//
	// [Redacting or identifying personally identifiable information]: https://docs.aws.amazon.com/transcribe/latest/dg/pii-redaction.html
	ContentIdentificationType types.ContentIdentificationType

	// Redacts all personally identifiable information (PII) identified in your
	// transcript.
	//
	// Content redaction is performed at the segment level; PII specified in
	// PiiEntityTypes is redacted upon complete transcription of an audio segment.
	//
	// You can’t set ContentRedactionType and ContentIdentificationType in the same
	// request. If you set both, your request returns a BadRequestException .
	//
	// For more information, see [Redacting or identifying personally identifiable information].
	//
	// [Redacting or identifying personally identifiable information]: https://docs.aws.amazon.com/transcribe/latest/dg/pii-redaction.html
	ContentRedactionType types.ContentRedactionType

	// 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.
	//
	// For more information, see [Transcribing multi-channel audio].
	//
	// [Transcribing multi-channel audio]: https://docs.aws.amazon.com/transcribe/latest/dg/channel-id.html
	EnableChannelIdentification bool

	// Enables partial result stabilization for your transcription. Partial result
	// stabilization can reduce latency in your output, but may impact accuracy. For
	// more information, see [Partial-result stabilization].
	//
	// [Partial-result stabilization]: https://docs.aws.amazon.com/transcribe/latest/dg/streaming.html#streaming-partial-result-stabilization
	EnablePartialResultsStabilization bool

	// Enables automatic language identification for your transcription.
	//
	// If you include IdentifyLanguage , you can optionally include a list of language
	// codes, using LanguageOptions , that you think may be present in your audio
	// stream. Including language options can improve transcription accuracy.
	//
	// You can also include a preferred language using PreferredLanguage . Adding a
	// preferred language can help Amazon Transcribe identify the language faster than
	// if you omit this parameter.
	//
	// If you have multi-channel audio that contains different languages on each
	// channel, and you've enabled channel identification, automatic language
	// identification identifies the dominant language on each audio channel.
	//
	// Note that you must include either LanguageCode or IdentifyLanguage or
	// IdentifyMultipleLanguages in your request. If you include more than one of these
	// parameters, your transcription job fails.
	//
	// Streaming language identification can't be combined with custom language models
	// or redaction.
	IdentifyLanguage bool

	// Enables automatic multi-language identification in your transcription job
	// request. Use this parameter if your stream contains more than one language. If
	// your stream contains only one language, use IdentifyLanguage instead.
	//
	// If you include IdentifyMultipleLanguages , you can optionally include a list of
	// language codes, using LanguageOptions , that you think may be present in your
	// stream. Including LanguageOptions restricts IdentifyMultipleLanguages to only
	// the language options that you specify, which can improve transcription accuracy.
	//
	// If you want to apply a custom vocabulary or a custom vocabulary filter to your
	// automatic multiple language identification request, include VocabularyNames or
	// VocabularyFilterNames .
	//
	// Note that you must include one of LanguageCode , IdentifyLanguage , or
	// IdentifyMultipleLanguages in your request. If you include more than one of these
	// parameters, your transcription job fails.
	IdentifyMultipleLanguages bool

	// Specify the language code that represents the language spoken in your audio.
	//
	// If you're unsure of the language spoken in your audio, consider using
	// IdentifyLanguage to enable automatic language identification.
	//
	// For a list of languages supported with Amazon Transcribe streaming, refer to
	// the [Supported languages]table.
	//
	// [Supported languages]: https://docs.aws.amazon.com/transcribe/latest/dg/supported-languages.html
	LanguageCode types.LanguageCode

	// Specify the name of the custom language model that you want to use when
	// processing your transcription. Note that language model names are case
	// sensitive.
	//
	// The language of the specified language model must match the language code you
	// specify in your transcription request. If the languages don't match, the custom
	// language model isn't applied. There are no errors or warnings associated with a
	// language mismatch.
	//
	// For more information, see [Custom language models].
	//
	// [Custom language models]: https://docs.aws.amazon.com/transcribe/latest/dg/custom-language-models.html
	LanguageModelName *string

	// Specify two or more language codes that represent the languages you think may
	// be present in your media; including more than five is not recommended. If you're
	// unsure what languages are present, do not include this parameter.
	//
	// Including language options can improve the accuracy of language identification.
	//
	// If you include LanguageOptions in your request, you must also include
	// IdentifyLanguage .
	//
	// For a list of languages supported with Amazon Transcribe streaming, refer to
	// the [Supported languages]table.
	//
	// You can only include one language dialect per language per stream. For example,
	// you cannot include en-US and en-AU in the same request.
	//
	// [Supported languages]: https://docs.aws.amazon.com/transcribe/latest/dg/supported-languages.html
	LanguageOptions *string

	// Specify the number of channels in your audio stream. Up to two channels are
	// supported.
	NumberOfChannels *int32

	// Specify the level of stability to use when you enable partial results
	// stabilization ( EnablePartialResultsStabilization ).
	//
	// Low stability provides the highest accuracy. High stability transcribes faster,
	// but with slightly lower accuracy.
	//
	// For more information, see [Partial-result stabilization].
	//
	// [Partial-result stabilization]: https://docs.aws.amazon.com/transcribe/latest/dg/streaming.html#streaming-partial-result-stabilization
	PartialResultsStability types.PartialResultsStability

	// Specify which types of personally identifiable information (PII) you want to
	// redact in your transcript. You can include as many types as you'd like, or you
	// can select ALL .
	//
	// To include PiiEntityTypes in your request, you must also include either
	// ContentIdentificationType or ContentRedactionType .
	//
	// Values must be comma-separated and can include: BANK_ACCOUNT_NUMBER ,
	// BANK_ROUTING , CREDIT_DEBIT_NUMBER , CREDIT_DEBIT_CVV , CREDIT_DEBIT_EXPIRY ,
	// PIN , EMAIL , ADDRESS , NAME , PHONE , SSN , or ALL .
	PiiEntityTypes *string

	// Specify a preferred language from the subset of languages codes you specified
	// in LanguageOptions .
	//
	// You can only use this parameter if you've included IdentifyLanguage and
	// LanguageOptions in your request.
	PreferredLanguage types.LanguageCode

	// Specify a name for your transcription session. If you don't include this
	// parameter in your request, Amazon Transcribe generates an ID and returns it in
	// the response.
	//
	// You can use a session ID to retry a streaming session.
	SessionId *string

	// 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)].
	//
	// [Partitioning speakers (diarization)]: https://docs.aws.amazon.com/transcribe/latest/dg/diarization.html
	ShowSpeakerLabel bool

	// Specify how you want your vocabulary filter applied to your transcript.
	//
	// To replace words with *** , choose mask .
	//
	// To delete words, choose remove .
	//
	// To flag words without changing them, choose tag .
	VocabularyFilterMethod types.VocabularyFilterMethod

	// Specify the name of the custom vocabulary filter that you want to use when
	// processing your transcription. Note that vocabulary filter names are case
	// sensitive.
	//
	// If the language of the specified custom vocabulary filter doesn't match the
	// language identified in your media, the vocabulary filter is not applied to your
	// transcription.
	//
	// This parameter is not intended for use with the IdentifyLanguage parameter. If
	// you're including IdentifyLanguage in your request and want to use one or more
	// vocabulary filters with your transcription, use the VocabularyFilterNames
	// parameter instead.
	//
	// For more information, see [Using vocabulary filtering with unwanted words].
	//
	// [Using vocabulary filtering with unwanted words]: https://docs.aws.amazon.com/transcribe/latest/dg/vocabulary-filtering.html
	VocabularyFilterName *string

	// Specify the names of the custom vocabulary filters that you want to use when
	// processing your transcription. Note that vocabulary filter names are case
	// sensitive.
	//
	// If none of the languages of the specified custom vocabulary filters match the
	// language identified in your media, your job fails.
	//
	// This parameter is only intended for use with the IdentifyLanguage parameter. If
	// you're not including IdentifyLanguage in your request and want to use a custom
	// vocabulary filter with your transcription, use the VocabularyFilterName
	// parameter instead.
	//
	// For more information, see [Using vocabulary filtering with unwanted words].
	//
	// [Using vocabulary filtering with unwanted words]: https://docs.aws.amazon.com/transcribe/latest/dg/vocabulary-filtering.html
	VocabularyFilterNames *string

	// Specify the name of the custom vocabulary that you want to use when processing
	// your transcription. Note that vocabulary names are case sensitive.
	//
	// If the language of the specified custom vocabulary doesn't match the language
	// identified in your media, the custom vocabulary is not applied to your
	// transcription.
	//
	// This parameter is not intended for use with the IdentifyLanguage parameter. If
	// you're including IdentifyLanguage in your request and want to use one or more
	// custom vocabularies with your transcription, use the VocabularyNames parameter
	// instead.
	//
	// For more information, see [Custom vocabularies].
	//
	// [Custom vocabularies]: https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html
	VocabularyName *string

	// Specify the names of the custom vocabularies that you want to use when
	// processing your transcription. Note that vocabulary names are case sensitive.
	//
	// If none of the languages of the specified custom vocabularies match the
	// language identified in your media, your job fails.
	//
	// This parameter is only intended for use with the IdentifyLanguage parameter. If
	// you're not including IdentifyLanguage in your request and want to use a custom
	// vocabulary with your transcription, use the VocabularyName parameter instead.
	//
	// For more information, see [Custom vocabularies].
	//
	// [Custom vocabularies]: https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html
	VocabularyNames *string
	// contains filtered or unexported fields
}

type StartStreamTranscriptionOutput

type StartStreamTranscriptionOutput struct {

	// Shows whether content identification was enabled for your transcription.
	ContentIdentificationType types.ContentIdentificationType

	// Shows whether content redaction was enabled for your transcription.
	ContentRedactionType types.ContentRedactionType

	// Shows whether channel identification was enabled for your transcription.
	EnableChannelIdentification bool

	// Shows whether partial results stabilization was enabled for your transcription.
	EnablePartialResultsStabilization bool

	// Shows whether automatic language identification was enabled for your
	// transcription.
	IdentifyLanguage bool

	// Shows whether automatic multi-language identification was enabled for your
	// transcription.
	IdentifyMultipleLanguages bool

	// Provides the language code that you specified in your request.
	LanguageCode types.LanguageCode

	// Provides the name of the custom language model that you specified in your
	// request.
	LanguageModelName *string

	// Provides the language codes that you specified in your request.
	LanguageOptions *string

	// Provides the media encoding you specified in your request.
	MediaEncoding types.MediaEncoding

	// Provides the sample rate that you specified in your request.
	MediaSampleRateHertz *int32

	// Provides the number of channels that you specified in your request.
	NumberOfChannels *int32

	// Provides the stabilization level used for your transcription.
	PartialResultsStability types.PartialResultsStability

	// Lists the PII entity types you specified in your request.
	PiiEntityTypes *string

	// Provides the preferred language that you specified in your request.
	PreferredLanguage types.LanguageCode

	// Provides the identifier for your streaming request.
	RequestId *string

	// Provides the identifier for your transcription session.
	SessionId *string

	// Shows whether speaker partitioning was enabled for your transcription.
	ShowSpeakerLabel bool

	// Provides the vocabulary filtering method used in your transcription.
	VocabularyFilterMethod types.VocabularyFilterMethod

	// Provides the name of the custom vocabulary filter that you specified in your
	// request.
	VocabularyFilterName *string

	// Provides the names of the custom vocabulary filters that you specified in your
	// request.
	VocabularyFilterNames *string

	// Provides the name of the custom vocabulary that you specified in your request.
	VocabularyName *string

	// Provides the names of the custom vocabularies that you specified in your
	// request.
	VocabularyNames *string

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
	// contains filtered or unexported fields
}

func (*StartStreamTranscriptionOutput) GetStream

GetStream returns the type to interact with the event stream.

type TranscriptResultStreamReader

type TranscriptResultStreamReader interface {
	Events() <-chan types.TranscriptResultStream
	Close() error
	Err() error
}

TranscriptResultStreamReader provides the interface for reading events from a stream.

The writer's Close method must allow multiple concurrent calls.

type UnknownEventMessageError

type UnknownEventMessageError struct {
	Type    string
	Message *eventstream.Message
}

UnknownEventMessageError provides an error when a message is received from the stream, but the reader is unable to determine what kind of message it is.

func (*UnknownEventMessageError) Error

func (e *UnknownEventMessageError) Error() string

Error retruns the error message string.

Directories

Path Synopsis
internal
testing Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL