Class: Aws::LexRuntimeV2::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::LexRuntimeV2::Client
- Includes:
- ClientStubs
- Defined in:
- lib/aws-sdk-lexruntimev2/client.rb
Overview
An API client for LexRuntimeV2. To construct a client, you need to configure a ‘:region` and `:credentials`.
client = Aws::LexRuntimeV2::Client.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
See #initialize for a full list of supported configuration options.
Class Attribute Summary collapse
- .identifier ⇒ Object readonly private
API Operations collapse
-
#delete_session(params = {}) ⇒ Types::DeleteSessionResponse
Removes session information for a specified bot, alias, and user ID.
-
#get_session(params = {}) ⇒ Types::GetSessionResponse
Returns session information for a specified bot, alias, and user.
-
#put_session(params = {}) ⇒ Types::PutSessionResponse
Creates a new session or modifies an existing session with an Amazon Lex V2 bot.
-
#recognize_text(params = {}) ⇒ Types::RecognizeTextResponse
Sends user input to Amazon Lex V2.
-
#recognize_utterance(params = {}) ⇒ Types::RecognizeUtteranceResponse
Sends user input to Amazon Lex V2.
Class Method Summary collapse
- .errors_module ⇒ Object private
Instance Method Summary collapse
- #build_request(operation_name, params = {}) ⇒ Object private
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
- #waiter_names ⇒ Object deprecated private Deprecated.
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
455 456 457 |
# File 'lib/aws-sdk-lexruntimev2/client.rb', line 455 def initialize(*args) super end |
Class Attribute Details
.identifier ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1247 1248 1249 |
# File 'lib/aws-sdk-lexruntimev2/client.rb', line 1247 def identifier @identifier end |
Class Method Details
.errors_module ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1250 1251 1252 |
# File 'lib/aws-sdk-lexruntimev2/client.rb', line 1250 def errors_module Errors end |
Instance Method Details
#build_request(operation_name, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 |
# File 'lib/aws-sdk-lexruntimev2/client.rb', line 1220 def build_request(operation_name, params = {}) handlers = @handlers.for(operation_name) tracer = config.telemetry_provider.tracer_provider.tracer( Aws::Telemetry.module_to_tracer_name('Aws::LexRuntimeV2') ) context = Seahorse::Client::RequestContext.new( operation_name: operation_name, operation: config.api.operation(operation_name), client: self, params: params, config: config, tracer: tracer ) context[:gem_name] = 'aws-sdk-lexruntimev2' context[:gem_version] = '1.46.0' Seahorse::Client::Request.new(handlers, context) end |
#delete_session(params = {}) ⇒ Types::DeleteSessionResponse
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`.
518 519 520 521 |
# File 'lib/aws-sdk-lexruntimev2/client.rb', line 518 def delete_session(params = {}, = {}) req = build_request(:delete_session, params) req.send_request() end |
#get_session(params = {}) ⇒ Types::GetSessionResponse
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`.
629 630 631 632 |
# File 'lib/aws-sdk-lexruntimev2/client.rb', line 629 def get_session(params = {}, = {}) req = build_request(:get_session, params) req.send_request() end |
#put_session(params = {}) ⇒ Types::PutSessionResponse
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.
796 797 798 799 |
# File 'lib/aws-sdk-lexruntimev2/client.rb', line 796 def put_session(params = {}, = {}, &block) req = build_request(:put_session, params) req.send_request(, &block) end |
#recognize_text(params = {}) ⇒ Types::RecognizeTextResponse
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].
[1]: docs.aws.amazon.com/lexv2/latest/dg/API_PostFulfillmentStatusSpecification.html [2]: docs.aws.amazon.com/lexv2/latest/dg/streaming-progress.html#progress-complete.html
1020 1021 1022 1023 |
# File 'lib/aws-sdk-lexruntimev2/client.rb', line 1020 def recognize_text(params = {}, = {}) req = build_request(:recognize_text, params) req.send_request() end |
#recognize_utterance(params = {}) ⇒ Types::RecognizeUtteranceResponse
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].
[1]: docs.aws.amazon.com/lexv2/latest/dg/API_PostFulfillmentStatusSpecification.html [2]: docs.aws.amazon.com/lexv2/latest/dg/streaming-progress.html#progress-complete.html
1211 1212 1213 1214 |
# File 'lib/aws-sdk-lexruntimev2/client.rb', line 1211 def recognize_utterance(params = {}, = {}, &block) req = build_request(:recognize_utterance, params) req.send_request(, &block) end |
#waiter_names ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1240 1241 1242 |
# File 'lib/aws-sdk-lexruntimev2/client.rb', line 1240 def waiter_names [] end |