dialog

package
v1.12.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package dialog provides functionality for creating custom voice assistant applications and managing the related interaction flow

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityReceivedEventArgs

type ActivityReceivedEventArgs struct {
	Activity string
	// contains filtered or unexported fields
}

func NewActivityReceivedEventArgsFromHandle

func NewActivityReceivedEventArgsFromHandle(handle common.SPXHandle) (*ActivityReceivedEventArgs, error)

NewSpeechRecognitionCanceledEventArgsFromHandle creates the object from the handle (for internal use)

func (ActivityReceivedEventArgs) Close

func (event ActivityReceivedEventArgs) Close()

Close releases the underlying resources

func (ActivityReceivedEventArgs) GetAudio

GetAudio gets the audio associated with the event.

func (ActivityReceivedEventArgs) HasAudio

func (event ActivityReceivedEventArgs) HasAudio() bool

HasAudio checks if the event contains audio

type ActivityReceivedEventHandler

type ActivityReceivedEventHandler func(event ActivityReceivedEventArgs)

type BotFrameworkConfig

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

BotFrameworkConfig defines configurations for the dialog service connector object for using a Bot Framework backend.

func NewBotFrameworkConfigFromAuthorizationToken

func NewBotFrameworkConfigFromAuthorizationToken(authorizationToken string, region string) (*BotFrameworkConfig, error)

NewBotFrameworkConfigFromAuthorizationToken creates a bot framework service config instance with the specified authorization token and region. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. As configuration values are copied when creating a new connector, the new token value will not apply to connectors that have already been created. For connectors that have been created before, you need to set authorization token of the corresponding connector to refresh the token. Otherwise, the connectors will encounter errors during operation.

func NewBotFrameworkConfigFromAuthorizationTokenAndBotID

func NewBotFrameworkConfigFromAuthorizationTokenAndBotID(authorizationToken string, region string, botID string) (*BotFrameworkConfig, error)

NewBotFrameworkConfigFromAuthorizationTokenAndBotID creates a bot framework service config instance with the specified authorization token and region and botID. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. As configuration values are copied when creating a new connector, the new token value will not apply to connectors that have already been created. For connectors that have been created before, you need to set authorization token of the corresponding connector to refresh the token. Otherwise, the connectors will encounter errors during operation.

func NewBotFrameworkConfigFromSubscription

func NewBotFrameworkConfigFromSubscription(subscriptionKey string, region string) (*BotFrameworkConfig, error)

NewBotFrameworkConfigFromSubscription creates a bot framework service config instance with the specified subscription key and region.

func NewBotFrameworkConfigFromSubscriptionAndBotID

func NewBotFrameworkConfigFromSubscriptionAndBotID(subscriptionKey string, region string, botID string) (*BotFrameworkConfig, error)

NewBotFrameworkConfigFromSubscriptionAndBotID creates a bot framework service config instance with the specified subscription key, region, and botID .

func (*BotFrameworkConfig) Close

func (config *BotFrameworkConfig) Close()

Close disposes the associated resources.

func (*BotFrameworkConfig) GetProperty

func (config *BotFrameworkConfig) GetProperty(id common.PropertyID) string

GetProperty gets a property value by ID.

func (*BotFrameworkConfig) GetPropertyByString

func (config *BotFrameworkConfig) GetPropertyByString(name string) string

GetPropertyByString gets a property value by name.

func (*BotFrameworkConfig) Language

func (config *BotFrameworkConfig) Language() string

Language is the input language to the connector. The language is specified in BCP-47 format.

func (*BotFrameworkConfig) SetLanguage

func (config *BotFrameworkConfig) SetLanguage(lang string) error

SetLanguage sets the input language to the connector. The language is specified in BCP-47 format.

func (*BotFrameworkConfig) SetProperty

func (config *BotFrameworkConfig) SetProperty(id common.PropertyID, value string) error

SetProperty sets a property value by ID.

func (*BotFrameworkConfig) SetPropertyByString

func (config *BotFrameworkConfig) SetPropertyByString(name string, value string) error

SetPropertyByString sets a property value by name.

func (*BotFrameworkConfig) SetProxy

func (config *BotFrameworkConfig) SetProxy(hostname string, port uint64) error

SetProxy sets proxy configuration

Note: Proxy functionality is not available on macOS. This function will have no effect on this platform.

func (*BotFrameworkConfig) SetProxyWithUsernameAndPassword

func (config *BotFrameworkConfig) SetProxyWithUsernameAndPassword(hostname string, port uint64, username string, password string) error

SetProxyWithUsernameAndPassword sets proxy configuration with username and password

Note: Proxy functionality is not available on macOS. This function will have no effect on this platform.

func (*BotFrameworkConfig) SetServiceProperty

func (config *BotFrameworkConfig) SetServiceProperty(name string, value string, channel common.ServicePropertyChannel) error

SetServiceProperty sets a property value that will be passed to service using the specified channel.

type CustomCommandsConfig

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

CustomCommandsConfig defines configurations for the dialog service connector object for using a CustomCommands backend.

func NewCustomCommandsConfigFromAuthorizationToken

func NewCustomCommandsConfigFromAuthorizationToken(applicationID string, authorizationToken string, region string) (*CustomCommandsConfig, error)

NewCustomCommandsConfigFromAuthorizationToken creates a Custom Commands config instance with the specified application id authorization token and region. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. As configuration values are copied when creating a new connector, the new token value will not apply to connectors that have already been created. For connectors that have been created before, you need to set authorization token of the corresponding connector to refresh the token. Otherwise, the connectors will encounter errors during operation.

func NewCustomCommandsConfigFromSubscription

func NewCustomCommandsConfigFromSubscription(applicationID string, subscriptionKey string, region string) (*CustomCommandsConfig, error)

NewCustomCommandsConfigFromSubscription creates a Custom Commands config instance with the specified application id, subscription key and region.

func (*CustomCommandsConfig) ApplicationID

func (config *CustomCommandsConfig) ApplicationID() string

ApplicationID is the corresponding backend application identifier.

func (*CustomCommandsConfig) Close

func (config *CustomCommandsConfig) Close()

Close disposes the associated resources.

func (*CustomCommandsConfig) GetProperty

func (config *CustomCommandsConfig) GetProperty(id common.PropertyID) string

GetProperty gets a property value by ID.

func (*CustomCommandsConfig) GetPropertyByString

func (config *CustomCommandsConfig) GetPropertyByString(name string) string

GetPropertyByString gets a property value by name.

func (*CustomCommandsConfig) Language

func (config *CustomCommandsConfig) Language() string

Language is the input language to the connector. The language is specified in BCP-47 format.

func (*CustomCommandsConfig) SetApplicationID

func (config *CustomCommandsConfig) SetApplicationID(appID string) error

SetApplicationID sets the corresponding backend application identifier.

func (*CustomCommandsConfig) SetLanguage

func (config *CustomCommandsConfig) SetLanguage(lang string) error

SetLanguage sets the input language to the connector. The language is specified in BCP-47 format.

func (*CustomCommandsConfig) SetProperty

func (config *CustomCommandsConfig) SetProperty(id common.PropertyID, value string) error

SetProperty sets a property value by ID.

func (*CustomCommandsConfig) SetPropertyByString

func (config *CustomCommandsConfig) SetPropertyByString(name string, value string) error

SetPropertyByString sets a property value by name.

func (*CustomCommandsConfig) SetProxy

func (config *CustomCommandsConfig) SetProxy(hostname string, port uint64) error

SetProxy sets proxy configuration

Note: Proxy functionality is not available on macOS. This function will have no effect on this platform.

func (*CustomCommandsConfig) SetProxyWithUsernameAndPassword

func (config *CustomCommandsConfig) SetProxyWithUsernameAndPassword(hostname string, port uint64, username string, password string) error

SetProxyWithUsernameAndPassword sets proxy configuration with username and password

Note: Proxy functionality is not available on macOS. This function will have no effect on this platform.

func (*CustomCommandsConfig) SetServiceProperty

func (config *CustomCommandsConfig) SetServiceProperty(name string, value string, channel common.ServicePropertyChannel) error

SetServiceProperty sets a property value that will be passed to service using the specified channel.

type DialogServiceConfig

type DialogServiceConfig interface {
	SetProperty(id common.PropertyID, value string) error
	GetProperty(id common.PropertyID) string
	SetPropertyByString(name string, value string) error
	GetPropertyByString(name string) string
	SetServiceProperty(name string, value string, channel common.ServicePropertyChannel) error
	SetProxy(hostname string, port uint64) error
	SetProxyWithUsernameAndPassword(hostname string, port uint64, username string, password string) error
	SetLanguage(lang string) error
	Language() string
	Close()
	// contains filtered or unexported methods
}

DialogServiceConfig defines base configurations for the dialog service connector object.

type DialogServiceConnector

type DialogServiceConnector struct {
	Properties common.PropertyCollection
	// contains filtered or unexported fields
}

DialogServiceConnector connects to a speech enabled dialog backend.

func NewDialogServiceConnectorFromConfig

func NewDialogServiceConnectorFromConfig(config DialogServiceConfig, audioConfig *audio.AudioConfig) (*DialogServiceConnector, error)

NewDialogServiceConnectorFromConfig creates a dialog service connector from a dialog service config and an audio config. Users should use this function to create a dialog service connector.

func (DialogServiceConnector) ActivityReceived

func (connector DialogServiceConnector) ActivityReceived(handler ActivityReceivedEventHandler)

ActivityReceived signals that an activity was received from the backend.

func (DialogServiceConnector) AuthorizationToken

func (connector DialogServiceConnector) AuthorizationToken() string

AuthorizationToken is the authorization token.

func (DialogServiceConnector) Canceled

Canceled signals events relating to the cancellation of an interaction. The event indicates if the reason is a direct cancellation or an error.

func (DialogServiceConnector) Close

func (connector DialogServiceConnector) Close()

Close performs cleanup of resources.

func (DialogServiceConnector) ConnectAsync

func (connector DialogServiceConnector) ConnectAsync() chan error

ConnectAsync connects with the back end.

func (DialogServiceConnector) DisconnectAsync

func (connector DialogServiceConnector) DisconnectAsync() chan error

DisconnectAsync disconnects from the back end.

func (DialogServiceConnector) ListenOnceAsync

func (connector DialogServiceConnector) ListenOnceAsync() <-chan speech.SpeechRecognitionOutcome

ListenOnceAsync starts a listening session that will terminate after the first utterance.

func (DialogServiceConnector) Recognized

func (connector DialogServiceConnector) Recognized(handler speech.SpeechRecognitionEventHandler)

Recognized signals events containing speech recognition results.

func (DialogServiceConnector) Recognizing

func (connector DialogServiceConnector) Recognizing(handler speech.SpeechRecognitionEventHandler)

Recognizing signals events containing intermediate recognition results.

func (DialogServiceConnector) SendActivityAsync

func (connector DialogServiceConnector) SendActivityAsync(message string) chan SendActivityOutcome

SendActivityAsync sends an activity to the backing dialog.

func (DialogServiceConnector) SessionStarted

func (connector DialogServiceConnector) SessionStarted(handler speech.SessionEventHandler)

SessionStarted signals the start of a listening session.

func (DialogServiceConnector) SessionStopped

func (connector DialogServiceConnector) SessionStopped(handler speech.SessionEventHandler)

SessionStopped signals the end of a listening session.

func (DialogServiceConnector) SetAuthorizationToken

func (connector DialogServiceConnector) SetAuthorizationToken(token string) error

SetAuthorizationToken sets the authorization token that will be used for connecting to the service. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. Otherwise, the connector will encounter errors during its operation.

func (DialogServiceConnector) SetSpeechActivityTemplate

func (connector DialogServiceConnector) SetSpeechActivityTemplate(activityTemplate string) error

SetSpeechActivityTemplate sets the speech activity template. It is used to stamp properties from the template on the service generated activty for speech.

func (DialogServiceConnector) SpeechActivityTemplate

func (connector DialogServiceConnector) SpeechActivityTemplate() string

SpeechActivityTemplate is the used to stamp properties from the template on the service generated activities.

func (DialogServiceConnector) StartKeywordRecognitionAsync

func (connector DialogServiceConnector) StartKeywordRecognitionAsync(model *speech.KeywordRecognitionModel) chan error

StartKeywordRecognitionAsync initiates keyword recognition.

func (DialogServiceConnector) StopKeywordRecognitionAsync

func (connector DialogServiceConnector) StopKeywordRecognitionAsync() chan error

StopKeywordRecognitionAsync stops keyword recognition.

type SendActivityOutcome

type SendActivityOutcome struct {
	common.OperationOutcome

	// InteractionID is the identifier associated with the interaction
	InteractionID string
}

Jump to

Keyboard shortcuts

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