#[non_exhaustive]pub struct PostTextOutput {Show 14 fields
pub intent_name: Option<String>,
pub nlu_intent_confidence: Option<IntentConfidence>,
pub alternative_intents: Option<Vec<PredictedIntent>>,
pub slots: Option<HashMap<String, String>>,
pub session_attributes: Option<HashMap<String, String>>,
pub message: Option<String>,
pub sentiment_response: Option<SentimentResponse>,
pub message_format: Option<MessageFormatType>,
pub dialog_state: Option<DialogState>,
pub slot_to_elicit: Option<String>,
pub response_card: Option<ResponseCard>,
pub session_id: Option<String>,
pub bot_version: Option<String>,
pub active_contexts: Option<Vec<ActiveContext>>,
/* private fields */
}
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.intent_name: Option<String>
The current user intent that Amazon Lex is aware of.
nlu_intent_confidence: Option<IntentConfidence>
Provides a score that indicates how confident Amazon Lex is that the returned intent is the one that matches the user's intent. The score is between 0.0 and 1.0. For more information, see Confidence Scores.
The score is a relative score, not an absolute score. The score may change based on improvements to Amazon Lex.
alternative_intents: Option<Vec<PredictedIntent>>
One to four alternative intents that may be applicable to the user's intent.
Each alternative includes a score that indicates how confident Amazon Lex is that the intent matches the user's intent. The intents are sorted by the confidence score.
slots: Option<HashMap<String, String>>
The intent slots that Amazon Lex detected from the user input in the conversation.
Amazon Lex creates a resolution list containing likely values for a slot. The value that it returns is determined by the valueSelectionStrategy
selected when the slot type was created or updated. If valueSelectionStrategy
is set to ORIGINAL_VALUE
, the value provided by the user is returned, if the user value is similar to the slot values. If valueSelectionStrategy
is set to TOP_RESOLUTION
Amazon Lex returns the first value in the resolution list or, if there is no resolution list, null. If you don't specify a valueSelectionStrategy
, the default is ORIGINAL_VALUE
.
session_attributes: Option<HashMap<String, String>>
A map of key-value pairs representing the session-specific context information.
message: Option<String>
The message to convey to the user. The message can come from the bot's configuration or from a Lambda function.
If the intent is not configured with a Lambda function, or if the Lambda function returned Delegate
as the dialogAction.type
its response, Amazon Lex decides on the next course of action and selects an appropriate message from the bot's configuration based on the current interaction context. For example, if Amazon Lex isn't able to understand user input, it uses a clarification prompt message.
When you create an intent you can assign messages to groups. When messages are assigned to groups Amazon Lex returns one message from each group in the response. The message field is an escaped JSON string containing the messages. For more information about the structure of the JSON string returned, see msg-prompts-formats
.
If the Lambda function returns a message, Amazon Lex passes it to the client in its response.
sentiment_response: Option<SentimentResponse>
The sentiment expressed in and utterance.
When the bot is configured to send utterances to Amazon Comprehend for sentiment analysis, this field contains the result of the analysis.
message_format: Option<MessageFormatType>
The format of the response message. One of the following values:
-
PlainText
- The message contains plain UTF-8 text. -
CustomPayload
- The message is a custom format defined by the Lambda function. -
SSML
- The message contains text formatted for voice output. -
Composite
- The message contains an escaped JSON object containing one or more messages from the groups that messages were assigned to when the intent was created.
dialog_state: Option<DialogState>
Identifies the current state of the user interaction. Amazon Lex returns one of the following values as dialogState
. The client can optionally use this information to customize the user interface.
-
ElicitIntent
- Amazon Lex wants to elicit user intent.For example, a user might utter an intent ("I want to order a pizza"). If Amazon Lex cannot infer the user intent from this utterance, it will return this dialogState.
-
ConfirmIntent
- Amazon Lex is expecting a "yes" or "no" response.For example, Amazon Lex wants user confirmation before fulfilling an intent.
Instead of a simple "yes" or "no," a user might respond with additional information. For example, "yes, but make it thick crust pizza" or "no, I want to order a drink". Amazon Lex can process such additional information (in these examples, update the crust type slot value, or change intent from OrderPizza to OrderDrink).
-
ElicitSlot
- Amazon Lex is expecting a slot value for the current intent.For example, suppose that in the response Amazon Lex sends this message: "What size pizza would you like?". A user might reply with the slot value (e.g., "medium"). The user might also provide additional information in the response (e.g., "medium thick crust pizza"). Amazon Lex can process such additional information appropriately.
-
Fulfilled
- Conveys that the Lambda function configured for the intent has successfully fulfilled the intent. -
ReadyForFulfillment
- Conveys that the client has to fulfill the intent. -
Failed
- Conveys that the conversation with the user failed.This can happen for various reasons including that the user did not provide an appropriate response to prompts from the service (you can configure how many times Amazon Lex can prompt a user for specific information), or the Lambda function failed to fulfill the intent.
slot_to_elicit: Option<String>
If the dialogState
value is ElicitSlot
, returns the name of the slot for which Amazon Lex is eliciting a value.
response_card: Option<ResponseCard>
Represents the options that the user has to respond to the current prompt. Response Card can come from the bot configuration (in the Amazon Lex console, choose the settings button next to a slot) or from a code hook (Lambda function).
session_id: Option<String>
A unique identifier for the session.
bot_version: Option<String>
The version of the bot that responded to the conversation. You can use this information to help determine if one version of a bot is performing better than another version.
active_contexts: Option<Vec<ActiveContext>>
A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the PostContent
, PostText
, or PutSession
operation.
You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.
Implementations§
Source§impl PostTextOutput
impl PostTextOutput
Sourcepub fn intent_name(&self) -> Option<&str>
pub fn intent_name(&self) -> Option<&str>
The current user intent that Amazon Lex is aware of.
Sourcepub fn nlu_intent_confidence(&self) -> Option<&IntentConfidence>
pub fn nlu_intent_confidence(&self) -> Option<&IntentConfidence>
Provides a score that indicates how confident Amazon Lex is that the returned intent is the one that matches the user's intent. The score is between 0.0 and 1.0. For more information, see Confidence Scores.
The score is a relative score, not an absolute score. The score may change based on improvements to Amazon Lex.
Sourcepub fn alternative_intents(&self) -> &[PredictedIntent]
pub fn alternative_intents(&self) -> &[PredictedIntent]
One to four alternative intents that may be applicable to the user's intent.
Each alternative includes a score that indicates how confident Amazon Lex is that the intent matches the user's intent. The intents are sorted by the confidence score.
If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use .alternative_intents.is_none()
.
Sourcepub fn slots(&self) -> Option<&HashMap<String, String>>
pub fn slots(&self) -> Option<&HashMap<String, String>>
The intent slots that Amazon Lex detected from the user input in the conversation.
Amazon Lex creates a resolution list containing likely values for a slot. The value that it returns is determined by the valueSelectionStrategy
selected when the slot type was created or updated. If valueSelectionStrategy
is set to ORIGINAL_VALUE
, the value provided by the user is returned, if the user value is similar to the slot values. If valueSelectionStrategy
is set to TOP_RESOLUTION
Amazon Lex returns the first value in the resolution list or, if there is no resolution list, null. If you don't specify a valueSelectionStrategy
, the default is ORIGINAL_VALUE
.
Sourcepub fn session_attributes(&self) -> Option<&HashMap<String, String>>
pub fn session_attributes(&self) -> Option<&HashMap<String, String>>
A map of key-value pairs representing the session-specific context information.
Sourcepub fn message(&self) -> Option<&str>
pub fn message(&self) -> Option<&str>
The message to convey to the user. The message can come from the bot's configuration or from a Lambda function.
If the intent is not configured with a Lambda function, or if the Lambda function returned Delegate
as the dialogAction.type
its response, Amazon Lex decides on the next course of action and selects an appropriate message from the bot's configuration based on the current interaction context. For example, if Amazon Lex isn't able to understand user input, it uses a clarification prompt message.
When you create an intent you can assign messages to groups. When messages are assigned to groups Amazon Lex returns one message from each group in the response. The message field is an escaped JSON string containing the messages. For more information about the structure of the JSON string returned, see msg-prompts-formats
.
If the Lambda function returns a message, Amazon Lex passes it to the client in its response.
Sourcepub fn sentiment_response(&self) -> Option<&SentimentResponse>
pub fn sentiment_response(&self) -> Option<&SentimentResponse>
The sentiment expressed in and utterance.
When the bot is configured to send utterances to Amazon Comprehend for sentiment analysis, this field contains the result of the analysis.
Sourcepub fn message_format(&self) -> Option<&MessageFormatType>
pub fn message_format(&self) -> Option<&MessageFormatType>
The format of the response message. One of the following values:
-
PlainText
- The message contains plain UTF-8 text. -
CustomPayload
- The message is a custom format defined by the Lambda function. -
SSML
- The message contains text formatted for voice output. -
Composite
- The message contains an escaped JSON object containing one or more messages from the groups that messages were assigned to when the intent was created.
Sourcepub fn dialog_state(&self) -> Option<&DialogState>
pub fn dialog_state(&self) -> Option<&DialogState>
Identifies the current state of the user interaction. Amazon Lex returns one of the following values as dialogState
. The client can optionally use this information to customize the user interface.
-
ElicitIntent
- Amazon Lex wants to elicit user intent.For example, a user might utter an intent ("I want to order a pizza"). If Amazon Lex cannot infer the user intent from this utterance, it will return this dialogState.
-
ConfirmIntent
- Amazon Lex is expecting a "yes" or "no" response.For example, Amazon Lex wants user confirmation before fulfilling an intent.
Instead of a simple "yes" or "no," a user might respond with additional information. For example, "yes, but make it thick crust pizza" or "no, I want to order a drink". Amazon Lex can process such additional information (in these examples, update the crust type slot value, or change intent from OrderPizza to OrderDrink).
-
ElicitSlot
- Amazon Lex is expecting a slot value for the current intent.For example, suppose that in the response Amazon Lex sends this message: "What size pizza would you like?". A user might reply with the slot value (e.g., "medium"). The user might also provide additional information in the response (e.g., "medium thick crust pizza"). Amazon Lex can process such additional information appropriately.
-
Fulfilled
- Conveys that the Lambda function configured for the intent has successfully fulfilled the intent. -
ReadyForFulfillment
- Conveys that the client has to fulfill the intent. -
Failed
- Conveys that the conversation with the user failed.This can happen for various reasons including that the user did not provide an appropriate response to prompts from the service (you can configure how many times Amazon Lex can prompt a user for specific information), or the Lambda function failed to fulfill the intent.
Sourcepub fn slot_to_elicit(&self) -> Option<&str>
pub fn slot_to_elicit(&self) -> Option<&str>
If the dialogState
value is ElicitSlot
, returns the name of the slot for which Amazon Lex is eliciting a value.
Sourcepub fn response_card(&self) -> Option<&ResponseCard>
pub fn response_card(&self) -> Option<&ResponseCard>
Represents the options that the user has to respond to the current prompt. Response Card can come from the bot configuration (in the Amazon Lex console, choose the settings button next to a slot) or from a code hook (Lambda function).
Sourcepub fn session_id(&self) -> Option<&str>
pub fn session_id(&self) -> Option<&str>
A unique identifier for the session.
Sourcepub fn bot_version(&self) -> Option<&str>
pub fn bot_version(&self) -> Option<&str>
The version of the bot that responded to the conversation. You can use this information to help determine if one version of a bot is performing better than another version.
Sourcepub fn active_contexts(&self) -> &[ActiveContext]
pub fn active_contexts(&self) -> &[ActiveContext]
A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the PostContent
, PostText
, or PutSession
operation.
You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.
If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use .active_contexts.is_none()
.
Source§impl PostTextOutput
impl PostTextOutput
Sourcepub fn builder() -> PostTextOutputBuilder
pub fn builder() -> PostTextOutputBuilder
Creates a new builder-style object to manufacture PostTextOutput
.
Trait Implementations§
Source§impl Clone for PostTextOutput
impl Clone for PostTextOutput
Source§fn clone(&self) -> PostTextOutput
fn clone(&self) -> PostTextOutput
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PostTextOutput
impl Debug for PostTextOutput
Source§impl PartialEq for PostTextOutput
impl PartialEq for PostTextOutput
Source§impl RequestId for PostTextOutput
impl RequestId for PostTextOutput
Source§fn request_id(&self) -> Option<&str>
fn request_id(&self) -> Option<&str>
None
if the service could not be reached.impl StructuralPartialEq for PostTextOutput
Auto Trait Implementations§
impl Freeze for PostTextOutput
impl RefUnwindSafe for PostTextOutput
impl Send for PostTextOutput
impl Sync for PostTextOutput
impl Unpin for PostTextOutput
impl UnwindSafe for PostTextOutput
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);