Interface LexRuntimeV2Client
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
builder() method.
This section contains documentation for the Amazon Lex V2 Runtime V2 API operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue for looking up the service's metadata from theServiceMetadataProvider.static final String -
Method Summary
Modifier and TypeMethodDescriptionstatic LexRuntimeV2ClientBuilderbuilder()Create a builder that can be used to configure and create aLexRuntimeV2Client.static LexRuntimeV2Clientcreate()Create aLexRuntimeV2Clientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.default DeleteSessionResponsedeleteSession(Consumer<DeleteSessionRequest.Builder> deleteSessionRequest) Removes session information for a specified bot, alias, and user ID.default DeleteSessionResponsedeleteSession(DeleteSessionRequest deleteSessionRequest) Removes session information for a specified bot, alias, and user ID.default GetSessionResponsegetSession(Consumer<GetSessionRequest.Builder> getSessionRequest) Returns session information for a specified bot, alias, and user.default GetSessionResponsegetSession(GetSessionRequest getSessionRequest) Returns session information for a specified bot, alias, and user.default ResponseInputStream<PutSessionResponse> putSession(Consumer<PutSessionRequest.Builder> putSessionRequest) Creates a new session or modifies an existing session with an Amazon Lex V2 bot.default PutSessionResponseputSession(Consumer<PutSessionRequest.Builder> putSessionRequest, Path destinationPath) Creates a new session or modifies an existing session with an Amazon Lex V2 bot.default <ReturnT> ReturnTputSession(Consumer<PutSessionRequest.Builder> putSessionRequest, ResponseTransformer<PutSessionResponse, ReturnT> responseTransformer) Creates a new session or modifies an existing session with an Amazon Lex V2 bot.default ResponseInputStream<PutSessionResponse> putSession(PutSessionRequest putSessionRequest) Creates a new session or modifies an existing session with an Amazon Lex V2 bot.default PutSessionResponseputSession(PutSessionRequest putSessionRequest, Path destinationPath) Creates a new session or modifies an existing session with an Amazon Lex V2 bot.default <ReturnT> ReturnTputSession(PutSessionRequest putSessionRequest, ResponseTransformer<PutSessionResponse, ReturnT> responseTransformer) Creates a new session or modifies an existing session with an Amazon Lex V2 bot.default ResponseBytes<PutSessionResponse> putSessionAsBytes(Consumer<PutSessionRequest.Builder> putSessionRequest) Creates a new session or modifies an existing session with an Amazon Lex V2 bot.default ResponseBytes<PutSessionResponse> putSessionAsBytes(PutSessionRequest putSessionRequest) Creates a new session or modifies an existing session with an Amazon Lex V2 bot.default RecognizeTextResponserecognizeText(Consumer<RecognizeTextRequest.Builder> recognizeTextRequest) Sends user input to Amazon Lex V2.default RecognizeTextResponserecognizeText(RecognizeTextRequest recognizeTextRequest) Sends user input to Amazon Lex V2.default RecognizeUtteranceResponserecognizeUtterance(Consumer<RecognizeUtteranceRequest.Builder> recognizeUtteranceRequest, Path sourcePath, Path destinationPath) Sends user input to Amazon Lex V2.default <ReturnT> ReturnTrecognizeUtterance(Consumer<RecognizeUtteranceRequest.Builder> recognizeUtteranceRequest, RequestBody requestBody, ResponseTransformer<RecognizeUtteranceResponse, ReturnT> responseTransformer) Sends user input to Amazon Lex V2.default RecognizeUtteranceResponserecognizeUtterance(RecognizeUtteranceRequest recognizeUtteranceRequest, Path sourcePath, Path destinationPath) Sends user input to Amazon Lex V2.default <ReturnT> ReturnTrecognizeUtterance(RecognizeUtteranceRequest recognizeUtteranceRequest, RequestBody requestBody, ResponseTransformer<RecognizeUtteranceResponse, ReturnT> responseTransformer) Sends user input to Amazon Lex V2.The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfigurationstatic ServiceMetadataMethods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
closeMethods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
Field Details
-
SERVICE_NAME
- See Also:
-
SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider.- See Also:
-
-
Method Details
-
deleteSession
default DeleteSessionResponse deleteSession(DeleteSessionRequest deleteSessionRequest) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.- Parameters:
deleteSessionRequest-- Returns:
- Result of the DeleteSession operation returned by the service.
- See Also:
-
deleteSession
default DeleteSessionResponse deleteSession(Consumer<DeleteSessionRequest.Builder> deleteSessionRequest) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
This is a convenience which creates an instance of the
DeleteSessionRequest.Builderavoiding the need to create one manually viaDeleteSessionRequest.builder()- Parameters:
deleteSessionRequest- AConsumerthat will call methods onDeleteSessionRequest.Builderto create a request.- Returns:
- Result of the DeleteSession operation returned by the service.
- See Also:
-
getSession
default GetSessionResponse getSession(GetSessionRequest getSessionRequest) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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 aBadRequestException.- Parameters:
getSessionRequest-- Returns:
- Result of the GetSession operation returned by the service.
- See Also:
-
getSession
default GetSessionResponse getSession(Consumer<GetSessionRequest.Builder> getSessionRequest) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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 aBadRequestException.
This is a convenience which creates an instance of the
GetSessionRequest.Builderavoiding the need to create one manually viaGetSessionRequest.builder()- Parameters:
getSessionRequest- AConsumerthat will call methods onGetSessionRequest.Builderto create a request.- Returns:
- Result of the GetSession operation returned by the service.
- See Also:
-
putSession
default <ReturnT> ReturnT putSession(PutSessionRequest putSessionRequest, ResponseTransformer<PutSessionResponse, ReturnT> responseTransformer) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2ExceptionCreates 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.
- Parameters:
putSessionRequest-responseTransformer- Functional interface for processing the streamed response content. The unmarshalled PutSessionResponse and an InputStream to the response content are provided as parameters to the callback. The callback may return a transformed type which will be the return value of this method. SeeResponseTransformerfor details on implementing this interface and for links to pre-canned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows 'If the requested content type was audio, the audio version of the message to convey to the user.
'.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
putSession
default <ReturnT> ReturnT putSession(Consumer<PutSessionRequest.Builder> putSessionRequest, ResponseTransformer<PutSessionResponse, ReturnT> responseTransformer) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2ExceptionCreates 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.
This is a convenience which creates an instance of the
PutSessionRequest.Builderavoiding the need to create one manually viaPutSessionRequest.builder()- Parameters:
putSessionRequest- AConsumerthat will call methods onPutSessionRequest.Builderto create a request.responseTransformer- Functional interface for processing the streamed response content. The unmarshalled PutSessionResponse and an InputStream to the response content are provided as parameters to the callback. The callback may return a transformed type which will be the return value of this method. SeeResponseTransformerfor details on implementing this interface and for links to pre-canned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows 'If the requested content type was audio, the audio version of the message to convey to the user.
'.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
putSession
default PutSessionResponse putSession(PutSessionRequest putSessionRequest, Path destinationPath) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
- Parameters:
putSessionRequest-destinationPath-Pathto file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows 'If the requested content type was audio, the audio version of the message to convey to the user.
'.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
putSession
default PutSessionResponse putSession(Consumer<PutSessionRequest.Builder> putSessionRequest, Path destinationPath) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
This is a convenience which creates an instance of the
PutSessionRequest.Builderavoiding the need to create one manually viaPutSessionRequest.builder()- Parameters:
putSessionRequest- AConsumerthat will call methods onPutSessionRequest.Builderto create a request.destinationPath-Pathto file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows 'If the requested content type was audio, the audio version of the message to convey to the user.
'.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
putSession
default ResponseInputStream<PutSessionResponse> putSession(PutSessionRequest putSessionRequest) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
- Parameters:
putSessionRequest-- Returns:
- A
ResponseInputStreamcontaining data streamed from service. Note that this is an unmanaged reference to the underlying HTTP connection so great care must be taken to ensure all data if fully read from the input stream and that it is properly closed. Failure to do so may result in sub-optimal behavior and exhausting connections in the connection pool. The unmarshalled response object can be obtained viaResponseInputStream.response(). The service documentation for the response content is as follows 'If the requested content type was audio, the audio version of the message to convey to the user.
'. - See Also:
-
putSession
default ResponseInputStream<PutSessionResponse> putSession(Consumer<PutSessionRequest.Builder> putSessionRequest) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
This is a convenience which creates an instance of the
PutSessionRequest.Builderavoiding the need to create one manually viaPutSessionRequest.builder()- Parameters:
putSessionRequest- AConsumerthat will call methods onPutSessionRequest.Builderto create a request.- Returns:
- A
ResponseInputStreamcontaining data streamed from service. Note that this is an unmanaged reference to the underlying HTTP connection so great care must be taken to ensure all data if fully read from the input stream and that it is properly closed. Failure to do so may result in sub-optimal behavior and exhausting connections in the connection pool. The unmarshalled response object can be obtained viaResponseInputStream.response(). The service documentation for the response content is as follows 'If the requested content type was audio, the audio version of the message to convey to the user.
'. - See Also:
-
putSessionAsBytes
default ResponseBytes<PutSessionResponse> putSessionAsBytes(PutSessionRequest putSessionRequest) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
- Parameters:
putSessionRequest-- Returns:
- A
ResponseBytesthat loads the data streamed from the service into memory and exposes it in convenient in-memory representations like a byte buffer or string. The unmarshalled response object can be obtained viaResponseBytes.response(). The service documentation for the response content is as follows 'If the requested content type was audio, the audio version of the message to convey to the user.
'. - See Also:
-
putSessionAsBytes
default ResponseBytes<PutSessionResponse> putSessionAsBytes(Consumer<PutSessionRequest.Builder> putSessionRequest) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
This is a convenience which creates an instance of the
PutSessionRequest.Builderavoiding the need to create one manually viaPutSessionRequest.builder()- Parameters:
putSessionRequest- AConsumerthat will call methods onPutSessionRequest.Builderto create a request.- Returns:
- A
ResponseBytesthat loads the data streamed from the service into memory and exposes it in convenient in-memory representations like a byte buffer or string. The unmarshalled response object can be obtained viaResponseBytes.response(). The service documentation for the response content is as follows 'If the requested content type was audio, the audio version of the message to convey to the user.
'. - See Also:
-
recognizeText
default RecognizeTextResponse recognizeText(RecognizeTextRequest recognizeTextRequest) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification.
-
Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.
-
Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.
-
Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.
For more information, see Completion message.
- Parameters:
recognizeTextRequest-- Returns:
- Result of the RecognizeText operation returned by the service.
- See Also:
-
-
recognizeText
default RecognizeTextResponse recognizeText(Consumer<RecognizeTextRequest.Builder> recognizeTextRequest) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification.
-
Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.
-
Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.
-
Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.
For more information, see Completion message.
This is a convenience which creates an instance of the
RecognizeTextRequest.Builderavoiding the need to create one manually viaRecognizeTextRequest.builder()- Parameters:
recognizeTextRequest- AConsumerthat will call methods onRecognizeTextRequest.Builderto create a request.- Returns:
- Result of the RecognizeText operation returned by the service.
- See Also:
-
-
recognizeUtterance
default <ReturnT> ReturnT recognizeUtterance(RecognizeUtteranceRequest recognizeUtteranceRequest, RequestBody requestBody, ResponseTransformer<RecognizeUtteranceResponse, ReturnT> responseTransformer) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2ExceptionSends 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.
If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification.
-
Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.
-
Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.
-
Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.
For more information, see Completion message.
- Parameters:
recognizeUtteranceRequest-requestBody- The content to send to the service. ARequestBodycan be created using one of several factory methods for various sources of data. For example, to create a request body from a file you can do the following.
See documentation inRequestBody.fromFile(new File("myfile.txt"))RequestBodyfor additional details and which sources of data are supported. The service documentation for the request content is as follows 'User input in PCM or Opus audio format or text format as described in the
'requestContentTypeparameter.responseTransformer- Functional interface for processing the streamed response content. The unmarshalled RecognizeUtteranceResponse and an InputStream to the response content are provided as parameters to the callback. The callback may return a transformed type which will be the return value of this method. SeeResponseTransformerfor details on implementing this interface and for links to pre-canned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows '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
'.clarificationPromptconfigured for the bot. If the intent requires confirmation before taking the fulfillment action, it sends theconfirmationPrompt. 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.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
-
recognizeUtterance
default <ReturnT> ReturnT recognizeUtterance(Consumer<RecognizeUtteranceRequest.Builder> recognizeUtteranceRequest, RequestBody requestBody, ResponseTransformer<RecognizeUtteranceResponse, ReturnT> responseTransformer) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2ExceptionSends 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.
If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification.
-
Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.
-
Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.
-
Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.
For more information, see Completion message.
This is a convenience which creates an instance of the
RecognizeUtteranceRequest.Builderavoiding the need to create one manually viaRecognizeUtteranceRequest.builder()- Parameters:
recognizeUtteranceRequest- AConsumerthat will call methods onRecognizeUtteranceRequest.Builderto create a request.requestBody- The content to send to the service. ARequestBodycan be created using one of several factory methods for various sources of data. For example, to create a request body from a file you can do the following.
See documentation inRequestBody.fromFile(new File("myfile.txt"))RequestBodyfor additional details and which sources of data are supported. The service documentation for the request content is as follows 'User input in PCM or Opus audio format or text format as described in the
'requestContentTypeparameter.responseTransformer- Functional interface for processing the streamed response content. The unmarshalled RecognizeUtteranceResponse and an InputStream to the response content are provided as parameters to the callback. The callback may return a transformed type which will be the return value of this method. SeeResponseTransformerfor details on implementing this interface and for links to pre-canned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows '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
'.clarificationPromptconfigured for the bot. If the intent requires confirmation before taking the fulfillment action, it sends theconfirmationPrompt. 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.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
-
recognizeUtterance
default RecognizeUtteranceResponse recognizeUtterance(RecognizeUtteranceRequest recognizeUtteranceRequest, Path sourcePath, Path destinationPath) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification.
-
Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.
-
Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.
-
Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.
For more information, see Completion message.
- Parameters:
recognizeUtteranceRequest-sourcePath-Pathto file containing data to send to the service. File will be read entirely and may be read multiple times in the event of a retry. If the file does not exist or the current user does not have access to read it then an exception will be thrown. The service documentation for the request content is as follows 'User input in PCM or Opus audio format or text format as described in the
'requestContentTypeparameter.destinationPath-Pathto file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows '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
'.clarificationPromptconfigured for the bot. If the intent requires confirmation before taking the fulfillment action, it sends theconfirmationPrompt. 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.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
-
recognizeUtterance
default RecognizeUtteranceResponse recognizeUtterance(Consumer<RecognizeUtteranceRequest.Builder> recognizeUtteranceRequest, Path sourcePath, Path destinationPath) throws AccessDeniedException, ResourceNotFoundException, ValidationException, ThrottlingException, InternalServerException, ConflictException, DependencyFailedException, BadGatewayException, AwsServiceException, SdkClientException, LexRuntimeV2Exception 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.
If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification.
-
Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.
-
Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.
-
Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.
For more information, see Completion message.
This is a convenience which creates an instance of the
RecognizeUtteranceRequest.Builderavoiding the need to create one manually viaRecognizeUtteranceRequest.builder()- Parameters:
recognizeUtteranceRequest- AConsumerthat will call methods onRecognizeUtteranceRequest.Builderto create a request.sourcePath-Pathto file containing data to send to the service. File will be read entirely and may be read multiple times in the event of a retry. If the file does not exist or the current user does not have access to read it then an exception will be thrown. The service documentation for the request content is as follows 'User input in PCM or Opus audio format or text format as described in the
'requestContentTypeparameter.destinationPath-Pathto file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows '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
'.clarificationPromptconfigured for the bot. If the intent requires confirmation before taking the fulfillment action, it sends theconfirmationPrompt. 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.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
-
create
Create aLexRuntimeV2Clientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider. -
builder
Create a builder that can be used to configure and create aLexRuntimeV2Client. -
serviceMetadata
-
serviceClientConfiguration
Description copied from interface:SdkClientThe SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient- Returns:
- SdkServiceClientConfiguration
-