Class: Aws::LexRuntimeV2::AsyncClient
- Inherits:
-
Seahorse::Client::AsyncBase
- Object
- Seahorse::Client::AsyncBase
- Aws::LexRuntimeV2::AsyncClient
- Includes:
- AsyncClientStubs
- Defined in:
- lib/aws-sdk-lexruntimev2/async_client.rb
Overview
An API async client for LexRuntimeV2. To construct an async client, you need to configure a ‘:region` and `:credentials`.
async_client = Aws::LexRuntimeV2::AsyncClient.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
-
#start_conversation(params = {}) ⇒ Types::StartConversationResponse
Starts an HTTP/2 bidirectional event stream that enables you to send audio, text, or DTMF input in real time.
Class Method Summary collapse
- .errors_module ⇒ Object private
Instance Method Summary collapse
- #build_request(operation_name, params = {}) ⇒ Object private
-
#initialize(options) ⇒ AsyncClient
constructor
A new instance of AsyncClient.
Constructor Details
#initialize(options) ⇒ AsyncClient
Returns a new instance of AsyncClient.
398 399 400 401 402 403 |
# File 'lib/aws-sdk-lexruntimev2/async_client.rb', line 398 def initialize(*args) unless Kernel.const_defined?("HTTP2") raise "Must include http/2 gem to use AsyncClient instances." end 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.
843 844 845 |
# File 'lib/aws-sdk-lexruntimev2/async_client.rb', line 843 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.
846 847 848 |
# File 'lib/aws-sdk-lexruntimev2/async_client.rb', line 846 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.
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 |
# File 'lib/aws-sdk-lexruntimev2/async_client.rb', line 806 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, http_response: Seahorse::Client::Http::AsyncResponse.new, config: config, tracer: tracer ) context[:gem_name] = 'aws-sdk-lexruntimev2' context[:gem_version] = '1.52.0' Seahorse::Client::Request.new(handlers, context) end |
#start_conversation(params = {}) ⇒ Types::StartConversationResponse
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 ][3]
The ‘StartConversation` operation is supported only in the following SDKs:
- AWS SDK for C++][4
- AWS SDK for Java V2][5
- AWS SDK for Ruby V3][6
[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 [3]: docs.aws.amazon.com/lexv2/latest/dg/streaming-progress.html#progress-update.html [4]: docs.aws.amazon.com/goto/SdkForCpp/runtime.lex.v2-2020-08-07/StartConversation [5]: docs.aws.amazon.com/goto/SdkForJavaV2/runtime.lex.v2-2020-08-07/StartConversation [6]: docs.aws.amazon.com/goto/SdkForRubyV3/runtime.lex.v2-2020-08-07/StartConversation
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 |
# File 'lib/aws-sdk-lexruntimev2/async_client.rb', line 777 def start_conversation(params = {}, = {}, &block) params = params.dup input_event_stream_handler = _event_stream_handler( :input, params.delete(:input_event_stream_handler), EventStreams::StartConversationRequestEventStream ) output_event_stream_handler = _event_stream_handler( :output, params.delete(:output_event_stream_handler) || params.delete(:event_stream_handler), EventStreams::StartConversationResponseEventStream ) yield(output_event_stream_handler) if block_given? req = build_request(:start_conversation, params) req.context[:input_event_stream_handler] = input_event_stream_handler req.handlers.add(Aws::Binary::EncodeHandler, priority: 55) req.context[:output_event_stream_handler] = output_event_stream_handler req.handlers.add(Aws::Binary::DecodeHandler, priority: 55) req.send_request(, &block) end |