lexruntimev2

package module
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: Apache-2.0 Imports: 28 Imported by: 6

Documentation

Overview

Package lexruntimev2 provides the API client, operations, and parameter types for Amazon Lex Runtime V2.

Index

Constants

View Source
const ServiceAPIVersion = "2020-08-07"
View Source
const ServiceID = "Lex Runtime V2"

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 Client

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

Client provides the API client to make operations call for Amazon Lex Runtime V2.

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

func (c *Client) DeleteSession(ctx context.Context, params *DeleteSessionInput, optFns ...func(*Options)) (*DeleteSessionOutput, error)

Removes session information for a specified bot, alias, and user ID. You can use this operation to restart a conversation with a bot. When you remove a session, the entire history of the session is removed so that you can start again. You don't need to delete a session. Sessions have a time limit and will expire. Set the session time limit when you create the bot. The default is 5 minutes, but you can specify anything between 1 minute and 24 hours. If you specify a bot or alias ID that doesn't exist, you receive a BadRequestException. If the locale doesn't exist in the bot, or if the locale hasn't been enables for the alias, you receive a BadRequestException.

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context, params *GetSessionInput, optFns ...func(*Options)) (*GetSessionOutput, error)

Returns session information for a specified bot, alias, and user. For example, you can use this operation to retrieve session information for a user that has left a long-running session in use. If the bot, alias, or session identifier doesn't exist, Amazon Lex V2 returns a BadRequestException. If the locale doesn't exist or is not enabled for the alias, you receive a BadRequestException.

func (*Client) PutSession

func (c *Client) PutSession(ctx context.Context, params *PutSessionInput, optFns ...func(*Options)) (*PutSessionOutput, error)

Creates a new session or modifies an existing session with an Amazon Lex V2 bot. Use this operation to enable your application to set the state of the bot.

func (*Client) RecognizeText

func (c *Client) RecognizeText(ctx context.Context, params *RecognizeTextInput, optFns ...func(*Options)) (*RecognizeTextOutput, error)

Sends user input to Amazon Lex V2. Client applications use this API to send requests to Amazon Lex V2 at runtime. Amazon Lex V2 then interprets the user input using the machine learning model that it build for the bot. In response, Amazon Lex V2 returns the next message to convey to the user and an optional response card to display.

func (*Client) RecognizeUtterance

func (c *Client) RecognizeUtterance(ctx context.Context, params *RecognizeUtteranceInput, optFns ...func(*Options)) (*RecognizeUtteranceOutput, error)

Sends user input to Amazon Lex V2. You can send text or speech. Clients use this API to send text and audio requests to Amazon Lex V2 at runtime. Amazon Lex V2 interprets the user input using the machine learning model built for the bot. The following request fields must be compressed with gzip and then base64 encoded before you send them to Amazon Lex V2.

* requestAttributes

* sessionState

The following response fields are compressed using gzip and then base64 encoded by Amazon Lex V2. Before you can use these fields, you must decode and decompress them.

* inputTranscript

* interpretations

* messages

* requestAttributes

* sessionState

The example contains a Java application that compresses and encodes a Java object to send to Amazon Lex V2, and a second that decodes and decompresses a response from Amazon Lex V2.

type DeleteSessionInput

type DeleteSessionInput struct {

	// The alias identifier in use for the bot that contains the session data.
	//
	// This member is required.
	BotAliasId *string

	// The identifier of the bot that contains the session data.
	//
	// This member is required.
	BotId *string

	// The locale where the session is in use.
	//
	// This member is required.
	LocaleId *string

	// The identifier of the session to delete.
	//
	// This member is required.
	SessionId *string
	// contains filtered or unexported fields
}

type DeleteSessionOutput

type DeleteSessionOutput struct {

	// The alias identifier in use for the bot that contained the session data.
	BotAliasId *string

	// The identifier of the bot that contained the session data.
	BotId *string

	// The locale where the session was used.
	LocaleId *string

	// The identifier of the deleted session.
	SessionId *string

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

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 GetSessionInput

type GetSessionInput struct {

	// The alias identifier in use for the bot that contains the session data.
	//
	// This member is required.
	BotAliasId *string

	// The identifier of the bot that contains the session data.
	//
	// This member is required.
	BotId *string

	// The locale where the session is in use.
	//
	// This member is required.
	LocaleId *string

	// The identifier of the session to return.
	//
	// This member is required.
	SessionId *string
	// contains filtered or unexported fields
}

type GetSessionOutput

type GetSessionOutput struct {

	// A list of intents that Amazon Lex V2 determined might satisfy the user's
	// utterance. Each interpretation includes the intent, a score that indicates how
	// confident Amazon Lex V2 is that the interpretation is the correct one, and an
	// optional sentiment response that indicates the sentiment expressed in the
	// utterance.
	Interpretations []types.Interpretation

	// A list of messages that were last sent to the user. The messages are ordered
	// based on the order that your returned the messages from your Lambda function or
	// the order that messages are defined in the bot.
	Messages []types.Message

	// The identifier of the returned session.
	SessionId *string

	// Represents the current state of the dialog between the user and the bot. You can
	// use this to determine the progress of the conversation and what the next action
	// might be.
	SessionState *types.SessionState

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

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

type PutSessionInput struct {

	// The alias identifier of the bot that receives the session data.
	//
	// This member is required.
	BotAliasId *string

	// The identifier of the bot that receives the session data.
	//
	// This member is required.
	BotId *string

	// The locale where the session is in use.
	//
	// This member is required.
	LocaleId *string

	// The identifier of the session that receives the session data.
	//
	// This member is required.
	SessionId *string

	// Sets the state of the session with the user. You can use this to set the current
	// intent, attributes, context, and dialog action. Use the dialog action to
	// determine the next step that Amazon Lex V2 should use in the conversation with
	// the user.
	//
	// This member is required.
	SessionState *types.SessionState

	// A list of messages to send to the user. Messages are sent in the order that they
	// are defined in the list.
	Messages []types.Message

	// Request-specific information passed between Amazon Lex V2 and the client
	// application. The namespace x-amz-lex: is reserved for special attributes. Don't
	// create any request attributes with the prefix x-amz-lex:.
	RequestAttributes map[string]string

	// The message that Amazon Lex V2 returns in the response can be either text or
	// speech depending on the value of this parameter.
	//
	// * If the value is text/plain;
	// charset=utf-8, Amazon Lex V2 returns text in the response.
	ResponseContentType *string
	// contains filtered or unexported fields
}

type PutSessionOutput

type PutSessionOutput struct {

	// If the requested content type was audio, the audio version of the message to
	// convey to the user.
	AudioStream io.ReadCloser

	// The type of response. Same as the type specified in the responseContentType
	// field in the request.
	ContentType *string

	// A list of messages that were last sent to the user. The messages are ordered
	// based on how you return the messages from you Lambda function or the order that
	// the messages are defined in the bot.
	Messages *string

	// Request-specific information passed between the client application and Amazon
	// Lex V2. These are the same as the requestAttribute parameter in the call to the
	// PutSession operation.
	RequestAttributes *string

	// The identifier of the session that received the data.
	SessionId *string

	// Represents the current state of the dialog between the user and the bot. Use
	// this to determine the progress of the conversation and what the next action may
	// be.
	SessionState *string

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

type RecognizeTextInput

type RecognizeTextInput struct {

	// The alias identifier in use for the bot that processes the request.
	//
	// This member is required.
	BotAliasId *string

	// The identifier of the bot that processes the request.
	//
	// This member is required.
	BotId *string

	// The locale where the session is in use.
	//
	// This member is required.
	LocaleId *string

	// The identifier of the user session that is having the conversation.
	//
	// This member is required.
	SessionId *string

	// The text that the user entered. Amazon Lex V2 interprets this text.
	//
	// This member is required.
	Text *string

	// Request-specific information passed between the client application and Amazon
	// Lex V2 The namespace x-amz-lex: is reserved for special attributes. Don't create
	// any request attributes with the prefix x-amz-lex:.
	RequestAttributes map[string]string

	// The current state of the dialog between the user and the bot.
	SessionState *types.SessionState
	// contains filtered or unexported fields
}

type RecognizeTextOutput

type RecognizeTextOutput struct {

	// A list of intents that Amazon Lex V2 determined might satisfy the user's
	// utterance. Each interpretation includes the intent, a score that indicates now
	// confident Amazon Lex V2 is that the interpretation is the correct one, and an
	// optional sentiment response that indicates the sentiment expressed in the
	// utterance.
	Interpretations []types.Interpretation

	// A list of messages last sent to the user. The messages are ordered based on the
	// order that you returned the messages from your Lambda function or the order that
	// the messages are defined in the bot.
	Messages []types.Message

	// The attributes sent in the request.
	RequestAttributes map[string]string

	// The identifier of the session in use.
	SessionId *string

	// Represents the current state of the dialog between the user and the bot. Use
	// this to determine the progress of the conversation and what the next action may
	// be.
	SessionState *types.SessionState

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

type RecognizeUtteranceInput

type RecognizeUtteranceInput struct {

	// The alias identifier in use for the bot that should receive the request.
	//
	// This member is required.
	BotAliasId *string

	// The identifier of the bot that should receive the request.
	//
	// This member is required.
	BotId *string

	// The locale where the session is in use.
	//
	// This member is required.
	LocaleId *string

	// Indicates the format for audio input or that the content is text. The header
	// must start with one of the following prefixes:
	//
	// * PCM format, audio data must be
	// in little-endian byte order.
	//
	// * audio/l16; rate=16000; channels=1
	//
	// *
	// audio/x-l16; sample-rate=16000; channel-count=1
	//
	// * audio/lpcm; sample-rate=8000;
	// sample-size-bits=16; channel-count=1; is-big-endian=false
	//
	// * Opus format
	//
	// *
	// audio/x-cbr-opus-with-preamble;preamble-size=0;bit-rate=256000;frame-size-milliseconds=4
	//
	// *
	// Text format
	//
	// * text/plain; charset=utf-8
	//
	// This member is required.
	RequestContentType *string

	// The identifier of the session in use.
	//
	// This member is required.
	SessionId *string

	// User input in PCM or Opus audio format or text format as described in the
	// requestContentType parameter.
	InputStream io.Reader

	// Request-specific information passed between the client application and Amazon
	// Lex V2 The namespace x-amz-lex: is reserved for special attributes. Don't create
	// any request attributes for prefix x-amz-lex:. The requestAttributes field must
	// be compressed using gzip and then base64 encoded before sending to Amazon Lex
	// V2.
	RequestAttributes *string

	// The message that Amazon Lex V2 returns in the response can be either text or
	// speech based on the responseContentType value.
	//
	// * If the value is
	// text/plain;charset=utf-8, Amazon Lex V2 returns text in the response.
	//
	// * If the
	// value begins with audio/, Amazon Lex V2 returns speech in the response. Amazon
	// Lex V2 uses Amazon Polly to generate the speech using the configuration that you
	// specified in the requestContentType parameter. For example, if you specify
	// audio/mpeg as the value, Amazon Lex V2 returns speech in the MPEG format.
	//
	// * If
	// the value is audio/pcm, the speech returned is audio/pcm at 16 KHz in 16-bit,
	// little-endian format.
	//
	// * The following are the accepted values:
	//
	// * audio/mpeg
	//
	// *
	// audio/ogg
	//
	// * audio/pcm (16 KHz)
	//
	// * audio/* (defaults to mpeg)
	//
	// * text/plain;
	// charset=utf-8
	ResponseContentType *string

	// Sets the state of the session with the user. You can use this to set the current
	// intent, attributes, context, and dialog action. Use the dialog action to
	// determine the next step that Amazon Lex V2 should use in the conversation with
	// the user. The sessionState field must be compressed using gzip and then base64
	// encoded before sending to Amazon Lex V2.
	SessionState *string
	// contains filtered or unexported fields
}

type RecognizeUtteranceOutput

type RecognizeUtteranceOutput struct {

	// The prompt or statement to send to the user. This is based on the bot
	// configuration and context. For example, if Amazon Lex V2 did not understand the
	// user intent, it sends the clarificationPrompt configured for the bot. If the
	// intent requires confirmation before taking the fulfillment action, it sends the
	// confirmationPrompt. Another example: Suppose that the Lambda function
	// successfully fulfilled the intent, and sent a message to convey to the user.
	// Then Amazon Lex V2 sends that message in the response.
	AudioStream io.ReadCloser

	// Content type as specified in the responseContentType in the request.
	ContentType *string

	// Indicates whether the input mode to the operation was text or speech.
	InputMode *string

	// The text used to process the request. If the input was an audio stream, the
	// inputTranscript field contains the text extracted from the audio stream. This is
	// the text that is actually processed to recognize intents and slot values. You
	// can use this information to determine if Amazon Lex V2 is correctly processing
	// the audio that you send. The inputTranscript field is compressed with gzip and
	// then base64 encoded. Before you can use the contents of the field, you must
	// decode and decompress the contents. See the example for a simple function to
	// decode and decompress the contents.
	InputTranscript *string

	// A list of intents that Amazon Lex V2 determined might satisfy the user's
	// utterance. Each interpretation includes the intent, a score that indicates how
	// confident Amazon Lex V2 is that the interpretation is the correct one, and an
	// optional sentiment response that indicates the sentiment expressed in the
	// utterance. The interpretations field is compressed with gzip and then base64
	// encoded. Before you can use the contents of the field, you must decode and
	// decompress the contents. See the example for a simple function to decode and
	// decompress the contents.
	Interpretations *string

	// A list of messages that were last sent to the user. The messages are ordered
	// based on the order that you returned the messages from your Lambda function or
	// the order that the messages are defined in the bot. The messages field is
	// compressed with gzip and then base64 encoded. Before you can use the contents of
	// the field, you must decode and decompress the contents. See the example for a
	// simple function to decode and decompress the contents.
	Messages *string

	// The attributes sent in the request. The requestAttributes field is compressed
	// with gzip and then base64 encoded. Before you can use the contents of the field,
	// you must decode and decompress the contents.
	RequestAttributes *string

	// The identifier of the session in use.
	SessionId *string

	// Represents the current state of the dialog between the user and the bot. Use
	// this to determine the progress of the conversation and what the next action
	// might be. The sessionState field is compressed with gzip and then base64
	// encoded. Before you can use the contents of the field, you must decode and
	// decompress the contents. See the example for a simple function to decode and
	// decompress the contents.
	SessionState *string

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

type ResolveEndpoint

type ResolveEndpoint struct {
	Resolver EndpointResolver
	Options  EndpointResolverOptions
}

func (*ResolveEndpoint) HandleSerialize

func (*ResolveEndpoint) ID

func (*ResolveEndpoint) ID() string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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