transcribestreaming

package module
v1.6.12 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 36 Imported by: 6

Documentation

Overview

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

Operations and objects for transcribing streaming speech to text.

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

func WithEndpointResolver(v EndpointResolver) func(*Options)

WithEndpointResolver returns a functional option for setting the Client's EndpointResolver option.

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 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) StartMedicalStreamTranscription

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

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

func (*Client) StartStreamTranscription

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

Starts a bidirectional HTTP/2 stream where audio is streamed to Amazon Transcribe and the transcription results are streamed to your application. The following are encoded as HTTP/2 headers:

* x-amzn-transcribe-language-code

* x-amzn-transcribe-media-encoding

* x-amzn-transcribe-sample-rate

* x-amzn-transcribe-session-id

See the SDK for Go API Reference (https://docs.aws.amazon.com/sdk-for-go/api/service/transcribestreamingservice/#TranscribeStreamingService.StartStreamTranscription) for more detail.

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 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

	// 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.
	EndpointResolver EndpointResolver

	// 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. 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. 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
	// contains filtered or unexported fields
}

func (Options) Copy

func (o Options) Copy() Options

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

type ResolveEndpoint

type ResolveEndpoint struct {
	Resolver EndpointResolver
	Options  EndpointResolverOptions
}

func (*ResolveEndpoint) HandleSerialize

func (*ResolveEndpoint) ID

func (*ResolveEndpoint) ID() string

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 {

	// Indicates the source language used in the input audio stream. For Amazon
	// Transcribe Medical, this is US English (en-US).
	//
	// This member is required.
	LanguageCode types.LanguageCode

	// The encoding used for the 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

	// The medical specialty of the clinician or provider.
	//
	// This member is required.
	Specialty types.Specialty

	// The type of input audio. Choose DICTATION for a provider dictating patient
	// notes. Choose CONVERSATION for a dialogue between a patient and one or more
	// medical professionanls.
	//
	// This member is required.
	Type types.Type

	// Set this field to PHI to identify personal health information in the
	// transcription output.
	ContentIdentificationType types.MedicalContentIdentificationType

	// When true, instructs Amazon Transcribe Medical to process each audio channel
	// separately and then merge the transcription output of each channel into a single
	// transcription. Amazon Transcribe Medical also produces a transcription of each
	// item. An item includes the start time, end time, and any alternative
	// transcriptions. You can't set both ShowSpeakerLabel and
	// EnableChannelIdentification in the same request. If you set both, your request
	// returns a BadRequestException.
	EnableChannelIdentification bool

	// The number of channels that are in your audio stream.
	NumberOfChannels *int32

	// Optional. An identifier for the transcription session. If you don't provide a
	// session ID, Amazon Transcribe generates one for you and returns it in the
	// response.
	SessionId *string

	// When true, enables speaker identification in your real-time stream.
	ShowSpeakerLabel bool

	// The name of the medical custom vocabulary to use when processing the real-time
	// stream.
	VocabularyName *string
	// contains filtered or unexported fields
}

type StartMedicalStreamTranscriptionOutput

type StartMedicalStreamTranscriptionOutput struct {

	// If the value is PHI, indicates that you've configured your stream to identify
	// personal health information.
	ContentIdentificationType types.MedicalContentIdentificationType

	// Shows whether channel identification has been enabled in the stream.
	EnableChannelIdentification bool

	// The language code for the response transcript. For Amazon Transcribe Medical,
	// this is US English (en-US).
	LanguageCode types.LanguageCode

	// The encoding used for the input audio stream.
	MediaEncoding types.MediaEncoding

	// The sample rate of the input audio, in Hertz (Hz).
	MediaSampleRateHertz *int32

	// The number of channels identified in the stream.
	NumberOfChannels *int32

	// An identifier for the streaming transcription.
	RequestId *string

	// Optional. An identifier for the transcription session. If you don't provide a
	// session ID, Amazon Transcribe generates one for you and returns it in the
	// response.
	SessionId *string

	// Shows whether speaker identification was enabled in the stream.
	ShowSpeakerLabel bool

	// The specialty in the medical domain.
	Specialty types.Specialty

	// The type of audio that was transcribed.
	Type types.Type

	// The name of the vocabulary used when processing the stream.
	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 {

	// The encoding used for the 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

	// Set this field to PII to identify personally identifiable information (PII) in
	// the transcription output. Content identification is performed only upon complete
	// transcription of the audio segments. You can’t set both
	// ContentIdentificationType and ContentRedactionType in the same request. If you
	// set both, your request returns a BadRequestException.
	ContentIdentificationType types.ContentIdentificationType

	// Set this field to PII to redact personally identifiable information (PII) in the
	// transcription output. Content redaction is performed only upon complete
	// transcription of the audio segments. You can’t set both ContentRedactionType and
	// ContentIdentificationType in the same request. If you set both, your request
	// returns a BadRequestException.
	ContentRedactionType types.ContentRedactionType

	// When true, instructs Amazon Transcribe to process each audio channel separately,
	// then merges the transcription output of each channel into a single
	// transcription. Amazon Transcribe also produces a transcription of each item. An
	// item includes the start time, end time, and any alternative transcriptions.
	EnableChannelIdentification bool

	// When true, instructs Amazon Transcribe to present transcription results that
	// have the partial results stabilized. Normally, any word or phrase from one
	// partial result can change in a subsequent partial result. With partial results
	// stabilization enabled, only the last few words of one partial result can change
	// in another partial result.
	EnablePartialResultsStabilization bool

	// Optional. Set this value to true to enable language identification for your
	// media stream.
	IdentifyLanguage bool

	// The language code of the input audio stream.
	LanguageCode types.LanguageCode

	// The name of the language model you want to use.
	LanguageModelName *string

	// An object containing a list of languages that might be present in your audio.
	// You must provide two or more language codes to help Amazon Transcribe identify
	// the correct language of your media stream with the highest possible accuracy.
	// You can only select one variant per language; for example, you can't include
	// both en-US and en-UK in the same request. You can only use this parameter if
	// you've set IdentifyLanguage to truein your request.
	LanguageOptions *string

	// The number of channels that are in your audio stream.
	NumberOfChannels *int32

	// You can use this field to set the stability level of the transcription results.
	// A higher stability level means that the transcription results are less likely to
	// change. Higher stability levels can come with lower overall transcription
	// accuracy.
	PartialResultsStability types.PartialResultsStability

	// List the PII entity types you want to identify or redact. In order to specify
	// entity types, you must have either ContentIdentificationType or
	// ContentRedactionType enabled. PIIEntityTypes must be comma-separated; the
	// available values are: BANK_ACCOUNT_NUMBER, BANK_ROUTING, CREDIT_DEBIT_NUMBER,
	// CREDIT_DEBIT_CVV, CREDIT_DEBIT_EXPIRY, PIN, EMAIL, ADDRESS, NAME, PHONE, SSN,
	// and ALL. PiiEntityTypes is an optional parameter with a default value of ALL.
	PiiEntityTypes *string

	// Optional. From the subset of languages codes you provided for LanguageOptions,
	// you can select one preferred language for your transcription. You can only use
	// this parameter if you've set IdentifyLanguage to truein your request.
	PreferredLanguage types.LanguageCode

	// A identifier for the transcription session. Use this parameter when you want to
	// retry a session. If you don't provide a session ID, Amazon Transcribe will
	// generate one for you and return it in the response.
	SessionId *string

	// When true, enables speaker identification in your media stream.
	ShowSpeakerLabel bool

	// The manner in which you use your vocabulary filter to filter words in your
	// transcript. Remove removes filtered words from your transcription results. Mask
	// masks filtered words with a *** in your transcription results. Tag keeps the
	// filtered words in your transcription results and tags them. The tag appears as
	// VocabularyFilterMatch equal to True.
	VocabularyFilterMethod types.VocabularyFilterMethod

	// The name of the vocabulary filter you want to use with your transcription. This
	// operation is not intended for use in conjunction with the IdentifyLanguage
	// operation. If you're using IdentifyLanguage in your request and want to use one
	// or more vocabulary filters with your transcription, use the
	// VocabularyFilterNames operation instead.
	VocabularyFilterName *string

	// The names of the vocabulary filters you want to use with your transcription.
	// Note that if the vocabulary filters you specify are in languages that don't
	// match the language identified in your media, your job fails. This operation is
	// only intended for use in conjunction with the IdentifyLanguage operation. If
	// you're not using IdentifyLanguage in your request and want to use a vocabulary
	// filter with your transcription, use the VocabularyFilterName operation instead.
	VocabularyFilterNames *string

	// The name of the custom vocabulary you want to use with your transcription. This
	// operation is not intended for use in conjunction with the IdentifyLanguage
	// operation. If you're using IdentifyLanguage in your request and want to use one
	// or more custom vocabularies with your transcription, use the VocabularyNames
	// operation instead.
	VocabularyName *string

	// The names of the custom vocabularies you want to use with your transcription.
	// Note that if the custom vocabularies you specify are in languages that don't
	// match the language identified in your media, your job fails. This operation is
	// only intended for use in conjunction with the IdentifyLanguage operation. If
	// you're not using IdentifyLanguage in your request and want to use a custom
	// vocabulary with your transcription, use the VocabularyName operation instead.
	VocabularyNames *string
	// contains filtered or unexported fields
}

type StartStreamTranscriptionOutput

type StartStreamTranscriptionOutput struct {

	// Shows whether content identification was enabled in this stream.
	ContentIdentificationType types.ContentIdentificationType

	// Shows whether content redaction was enabled in this stream.
	ContentRedactionType types.ContentRedactionType

	// Shows whether channel identification was enabled in the stream.
	EnableChannelIdentification bool

	// Shows whether partial results stabilization was enabled in the transcription.
	EnablePartialResultsStabilization bool

	// The language code of the language identified in your media stream.
	IdentifyLanguage bool

	// The language code of the input audio stream.
	LanguageCode types.LanguageCode

	// The name of the custom language model used in the transcription.
	LanguageModelName *string

	// The language codes used in the identification of your media stream's predominant
	// language.
	LanguageOptions *string

	// The encoding used for the input audio stream.
	MediaEncoding types.MediaEncoding

	// The sample rate, in Hertz (Hz), for the input audio stream.
	MediaSampleRateHertz *int32

	// The number of channels identified in the stream.
	NumberOfChannels *int32

	// If partial results stabilization has been enabled in the stream, shows the
	// stability level.
	PartialResultsStability types.PartialResultsStability

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

	// The preferred language you specified in your request.
	PreferredLanguage types.LanguageCode

	// An identifier for the transcription.
	RequestId *string

	// An identifier for a specific transcription session.
	SessionId *string

	// Shows whether speaker identification was enabled in the transcription.
	ShowSpeakerLabel bool

	// The vocabulary filtering method used when processing the stream.
	VocabularyFilterMethod types.VocabularyFilterMethod

	// The name of the vocabulary filter used when processing the stream.
	VocabularyFilterName *string

	// The name of the vocabulary filter used when processing the stream.
	VocabularyFilterNames *string

	// The name of the custom vocabulary used when processing the stream.
	VocabularyName *string

	// The name of the custom vocabulary used when processing the stream.
	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