transcribestreaming

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2021 License: Apache-2.0 Imports: 34 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 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

	// Retryer guides how HTTP requests should be retried in case of recoverable
	// failures. When nil the API client will use a default retryer.
	Retryer aws.Retryer

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

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

	// Indicates the source language used in the input audio stream.
	//
	// This member is required.
	LanguageCode types.LanguageCode

	// The encoding used for the input audio.
	//
	// This member is required.
	MediaEncoding types.MediaEncoding

	// The sample rate, in Hertz, of the input audio. We suggest that you use 8,000 Hz
	// for low quality audio and 16,000 Hz for high quality 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
	// and then merge 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. You
	// can't set both ShowSpeakerLabel and EnableChannelIdentification in the same
	// request. If you set both, your request returns a BadRequestException.
	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

	// The name of the language model you want to use.
	LanguageModelName *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 is an optional parameter with a
	// default value of ALL.
	PiiEntityTypes *string

	// 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 real-time 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've created that is unique to your account.
	// Provide the name in this field to successfully use it in a stream.
	VocabularyFilterName *string

	// The name of the vocabulary to use when processing the transcription job.
	VocabularyName *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 has been enabled in the stream.
	EnableChannelIdentification bool

	// Shows whether partial results stabilization has been enabled in the stream.
	EnablePartialResultsStabilization bool

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

	LanguageModelName *string

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

	// The sample rate for the input audio stream. Use 8,000 Hz for low quality audio
	// and 16,000 Hz for high quality audio.
	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

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

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

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

	// The vocabulary filtering method used in the real-time stream.
	VocabularyFilterMethod types.VocabularyFilterMethod

	// The name of the vocabulary filter used in your real-time stream.
	VocabularyFilterName *string

	// 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 (*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