Interface LexRuntimeV2AsyncClient

All Superinterfaces:
AutoCloseable, AwsClient, SdkAutoCloseable, SdkClient

@Generated("software.amazon.awssdk:codegen") @ThreadSafe public interface LexRuntimeV2AsyncClient extends AwsClient
Service client for accessing Lex Runtime V2 asynchronously. This can be created using the static builder() method.The asynchronous client performs non-blocking I/O when configured with any SdkAsyncHttpClient supported in the SDK. However, full non-blocking is not guaranteed as the async client may perform blocking calls in some cases such as credentials retrieval and endpoint discovery as part of the async API call.

This section contains documentation for the Amazon Lex V2 Runtime V2 API operations.

  • Field Details

  • Method Details

    • deleteSession

      default CompletableFuture<DeleteSessionResponse> deleteSession(DeleteSessionRequest deleteSessionRequest)

      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:
      A Java Future containing the result of the DeleteSession operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • deleteSession

      default CompletableFuture<DeleteSessionResponse> deleteSession(Consumer<DeleteSessionRequest.Builder> deleteSessionRequest)

      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.Builder avoiding the need to create one manually via DeleteSessionRequest.builder()

      Parameters:
      deleteSessionRequest - A Consumer that will call methods on DeleteSessionRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the DeleteSession operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • getSession

      default CompletableFuture<GetSessionResponse> getSession(GetSessionRequest getSessionRequest)

      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.

      Parameters:
      getSessionRequest -
      Returns:
      A Java Future containing the result of the GetSession operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • getSession

      default CompletableFuture<GetSessionResponse> getSession(Consumer<GetSessionRequest.Builder> getSessionRequest)

      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.


      This is a convenience which creates an instance of the GetSessionRequest.Builder avoiding the need to create one manually via GetSessionRequest.builder()

      Parameters:
      getSessionRequest - A Consumer that will call methods on GetSessionRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the GetSession operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • putSession

      default <ReturnT> CompletableFuture<ReturnT> putSession(PutSessionRequest putSessionRequest, AsyncResponseTransformer<PutSessionResponse,ReturnT> asyncResponseTransformer)

      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 -
      asyncResponseTransformer - The response transformer for processing the streaming response in a non-blocking manner. See AsyncResponseTransformer for details on how this callback should be implemented and for links to precanned 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:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • DependencyFailedException
      • BadGatewayException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • putSession

      default <ReturnT> CompletableFuture<ReturnT> putSession(Consumer<PutSessionRequest.Builder> putSessionRequest, AsyncResponseTransformer<PutSessionResponse,ReturnT> asyncResponseTransformer)

      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.Builder avoiding the need to create one manually via PutSessionRequest.builder()

      Parameters:
      putSessionRequest - A Consumer that will call methods on PutSessionRequest.Builder to create a request.
      asyncResponseTransformer - The response transformer for processing the streaming response in a non-blocking manner. See AsyncResponseTransformer for details on how this callback should be implemented and for links to precanned 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:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • DependencyFailedException
      • BadGatewayException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • putSession

      default CompletableFuture<PutSessionResponse> putSession(PutSessionRequest putSessionRequest, Path destinationPath)

      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 - Path to 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:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • DependencyFailedException
      • BadGatewayException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • putSession

      default CompletableFuture<PutSessionResponse> putSession(Consumer<PutSessionRequest.Builder> putSessionRequest, Path destinationPath)

      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.Builder avoiding the need to create one manually via PutSessionRequest.builder()

      Parameters:
      putSessionRequest - A Consumer that will call methods on PutSessionRequest.Builder to create a request.
      destinationPath - Path to 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:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • DependencyFailedException
      • BadGatewayException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • recognizeText

      default CompletableFuture<RecognizeTextResponse> recognizeText(RecognizeTextRequest recognizeTextRequest)

      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:
      A Java Future containing the result of the RecognizeText operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • DependencyFailedException
      • BadGatewayException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • recognizeText

      default CompletableFuture<RecognizeTextResponse> recognizeText(Consumer<RecognizeTextRequest.Builder> recognizeTextRequest)

      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.Builder avoiding the need to create one manually via RecognizeTextRequest.builder()

      Parameters:
      recognizeTextRequest - A Consumer that will call methods on RecognizeTextRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the RecognizeText operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • DependencyFailedException
      • BadGatewayException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • recognizeUtterance

      default <ReturnT> CompletableFuture<ReturnT> recognizeUtterance(RecognizeUtteranceRequest recognizeUtteranceRequest, AsyncRequestBody requestBody, AsyncResponseTransformer<RecognizeUtteranceResponse,ReturnT> asyncResponseTransformer)

      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 -
      requestBody - Functional interface that can be implemented to produce the request content in a non-blocking manner. The size of the content is expected to be known up front. See AsyncRequestBody for specific details on implementing this interface as well as links to precanned implementations for common scenarios like uploading from a file. 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 requestContentType parameter.

      '
      asyncResponseTransformer - The response transformer for processing the streaming response in a non-blocking manner. See AsyncResponseTransformer for details on how this callback should be implemented and for links to precanned 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 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.

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • DependencyFailedException
      • BadGatewayException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • recognizeUtterance

      default <ReturnT> CompletableFuture<ReturnT> recognizeUtterance(Consumer<RecognizeUtteranceRequest.Builder> recognizeUtteranceRequest, AsyncRequestBody requestBody, AsyncResponseTransformer<RecognizeUtteranceResponse,ReturnT> asyncResponseTransformer)

      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.Builder avoiding the need to create one manually via RecognizeUtteranceRequest.builder()

      Parameters:
      recognizeUtteranceRequest - A Consumer that will call methods on RecognizeUtteranceRequest.Builder to create a request.
      requestBody - Functional interface that can be implemented to produce the request content in a non-blocking manner. The size of the content is expected to be known up front. See AsyncRequestBody for specific details on implementing this interface as well as links to precanned implementations for common scenarios like uploading from a file. 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 requestContentType parameter.

      '
      asyncResponseTransformer - The response transformer for processing the streaming response in a non-blocking manner. See AsyncResponseTransformer for details on how this callback should be implemented and for links to precanned 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 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.

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • DependencyFailedException
      • BadGatewayException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • recognizeUtterance

      default CompletableFuture<RecognizeUtteranceResponse> recognizeUtterance(RecognizeUtteranceRequest recognizeUtteranceRequest, Path sourcePath, Path destinationPath)

      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 - Path to 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 requestContentType parameter.

      '
      destinationPath - Path to 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 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.

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • DependencyFailedException
      • BadGatewayException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • recognizeUtterance

      default CompletableFuture<RecognizeUtteranceResponse> recognizeUtterance(Consumer<RecognizeUtteranceRequest.Builder> recognizeUtteranceRequest, Path sourcePath, Path destinationPath)

      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.Builder avoiding the need to create one manually via RecognizeUtteranceRequest.builder()

      Parameters:
      recognizeUtteranceRequest - A Consumer that will call methods on RecognizeUtteranceRequest.Builder to create a request.
      sourcePath - Path to 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 requestContentType parameter.

      '
      destinationPath - Path to 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 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.

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ResourceNotFoundException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • ConflictException
      • DependencyFailedException
      • BadGatewayException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • startConversation

      default CompletableFuture<Void> startConversation(StartConversationRequest startConversationRequest, org.reactivestreams.Publisher<StartConversationRequestEventStream> requestStream, StartConversationResponseHandler asyncResponseHandler)

      Starts an HTTP/2 bidirectional event stream that enables you to send audio, text, or DTMF input in real time. After your application starts a conversation, users send input to Amazon Lex V2 as a stream of events. Amazon Lex V2 processes the incoming events and responds with streaming text or audio events.

      Audio input must be in the following format: audio/lpcm sample-rate=8000 sample-size-bits=16 channel-count=1; is-big-endian=false.

      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.

      If the optional update message is configured, it is played at the specified frequency while the Lambda function is running and the update message state is active. If the fulfillment update message is not active, the Lambda function runs with a 30 second timeout.

      For more information, see Update message

      The StartConversation operation is supported only in the following SDKs:

      Parameters:
      startConversationRequest -
      Returns:
      A Java Future containing the result of the StartConversation operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • startConversation

      default CompletableFuture<Void> startConversation(Consumer<StartConversationRequest.Builder> startConversationRequest, org.reactivestreams.Publisher<StartConversationRequestEventStream> requestStream, StartConversationResponseHandler asyncResponseHandler)

      Starts an HTTP/2 bidirectional event stream that enables you to send audio, text, or DTMF input in real time. After your application starts a conversation, users send input to Amazon Lex V2 as a stream of events. Amazon Lex V2 processes the incoming events and responds with streaming text or audio events.

      Audio input must be in the following format: audio/lpcm sample-rate=8000 sample-size-bits=16 channel-count=1; is-big-endian=false.

      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.

      If the optional update message is configured, it is played at the specified frequency while the Lambda function is running and the update message state is active. If the fulfillment update message is not active, the Lambda function runs with a 30 second timeout.

      For more information, see Update message

      The StartConversation operation is supported only in the following SDKs:


      This is a convenience which creates an instance of the StartConversationRequest.Builder avoiding the need to create one manually via StartConversationRequest.builder()

      Parameters:
      startConversationRequest - A Consumer that will call methods on StartConversationRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the StartConversation operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • AccessDeniedException
      • ValidationException
      • ThrottlingException
      • InternalServerException
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • LexRuntimeV2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • serviceClientConfiguration

      default LexRuntimeV2ServiceClientConfiguration serviceClientConfiguration()
      Description copied from interface: SdkClient
      The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration
      Specified by:
      serviceClientConfiguration in interface AwsClient
      Specified by:
      serviceClientConfiguration in interface SdkClient
      Returns:
      SdkServiceClientConfiguration
    • create

      static LexRuntimeV2AsyncClient create()
      Create a LexRuntimeV2AsyncClient with the region loaded from the DefaultAwsRegionProviderChain and credentials loaded from the DefaultCredentialsProvider.
    • builder

      Create a builder that can be used to configure and create a LexRuntimeV2AsyncClient.