aws_sdk_lexmodelsv2/types/
_runtime_hints.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>You can provide Amazon Lex with hints to the phrases that a customer is likely to use for a slot. When a slot with hints is resolved, the phrases in the runtime hints are preferred in the resolution. You can provide hints for a maximum of 100 intents. You can provide a maximum of 100 slots.</p>
4/// <p>Before you can use runtime hints with an existing bot, you must first rebuild the bot.</p>
5/// <p>For more information, see <a href="https://docs.aws.amazon.com/lexv2/latest/dg/using-hints.html">Using runtime hints to improve recognition of slot values</a>.</p>
6#[non_exhaustive]
7#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
8pub struct RuntimeHints {
9    /// <p>A list of the slots in the intent that should have runtime hints added, and the phrases that should be added for each slot.</p>
10    /// <p>The first level of the <code>slotHints</code> map is the name of the intent. The second level is the name of the slot within the intent. For more information, see <a href="https://docs.aws.amazon.com/lexv2/latest/dg/using-hints.html">Using hints to improve accuracy</a>.</p>
11    /// <p>The intent name and slot name must exist.</p>
12    pub slot_hints: ::std::option::Option<
13        ::std::collections::HashMap<::std::string::String, ::std::collections::HashMap<::std::string::String, crate::types::RuntimeHintDetails>>,
14    >,
15}
16impl RuntimeHints {
17    /// <p>A list of the slots in the intent that should have runtime hints added, and the phrases that should be added for each slot.</p>
18    /// <p>The first level of the <code>slotHints</code> map is the name of the intent. The second level is the name of the slot within the intent. For more information, see <a href="https://docs.aws.amazon.com/lexv2/latest/dg/using-hints.html">Using hints to improve accuracy</a>.</p>
19    /// <p>The intent name and slot name must exist.</p>
20    pub fn slot_hints(
21        &self,
22    ) -> ::std::option::Option<
23        &::std::collections::HashMap<::std::string::String, ::std::collections::HashMap<::std::string::String, crate::types::RuntimeHintDetails>>,
24    > {
25        self.slot_hints.as_ref()
26    }
27}
28impl RuntimeHints {
29    /// Creates a new builder-style object to manufacture [`RuntimeHints`](crate::types::RuntimeHints).
30    pub fn builder() -> crate::types::builders::RuntimeHintsBuilder {
31        crate::types::builders::RuntimeHintsBuilder::default()
32    }
33}
34
35/// A builder for [`RuntimeHints`](crate::types::RuntimeHints).
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
37#[non_exhaustive]
38pub struct RuntimeHintsBuilder {
39    pub(crate) slot_hints: ::std::option::Option<
40        ::std::collections::HashMap<::std::string::String, ::std::collections::HashMap<::std::string::String, crate::types::RuntimeHintDetails>>,
41    >,
42}
43impl RuntimeHintsBuilder {
44    /// Adds a key-value pair to `slot_hints`.
45    ///
46    /// To override the contents of this collection use [`set_slot_hints`](Self::set_slot_hints).
47    ///
48    /// <p>A list of the slots in the intent that should have runtime hints added, and the phrases that should be added for each slot.</p>
49    /// <p>The first level of the <code>slotHints</code> map is the name of the intent. The second level is the name of the slot within the intent. For more information, see <a href="https://docs.aws.amazon.com/lexv2/latest/dg/using-hints.html">Using hints to improve accuracy</a>.</p>
50    /// <p>The intent name and slot name must exist.</p>
51    pub fn slot_hints(
52        mut self,
53        k: impl ::std::convert::Into<::std::string::String>,
54        v: ::std::collections::HashMap<::std::string::String, crate::types::RuntimeHintDetails>,
55    ) -> Self {
56        let mut hash_map = self.slot_hints.unwrap_or_default();
57        hash_map.insert(k.into(), v);
58        self.slot_hints = ::std::option::Option::Some(hash_map);
59        self
60    }
61    /// <p>A list of the slots in the intent that should have runtime hints added, and the phrases that should be added for each slot.</p>
62    /// <p>The first level of the <code>slotHints</code> map is the name of the intent. The second level is the name of the slot within the intent. For more information, see <a href="https://docs.aws.amazon.com/lexv2/latest/dg/using-hints.html">Using hints to improve accuracy</a>.</p>
63    /// <p>The intent name and slot name must exist.</p>
64    pub fn set_slot_hints(
65        mut self,
66        input: ::std::option::Option<
67            ::std::collections::HashMap<::std::string::String, ::std::collections::HashMap<::std::string::String, crate::types::RuntimeHintDetails>>,
68        >,
69    ) -> Self {
70        self.slot_hints = input;
71        self
72    }
73    /// <p>A list of the slots in the intent that should have runtime hints added, and the phrases that should be added for each slot.</p>
74    /// <p>The first level of the <code>slotHints</code> map is the name of the intent. The second level is the name of the slot within the intent. For more information, see <a href="https://docs.aws.amazon.com/lexv2/latest/dg/using-hints.html">Using hints to improve accuracy</a>.</p>
75    /// <p>The intent name and slot name must exist.</p>
76    pub fn get_slot_hints(
77        &self,
78    ) -> &::std::option::Option<
79        ::std::collections::HashMap<::std::string::String, ::std::collections::HashMap<::std::string::String, crate::types::RuntimeHintDetails>>,
80    > {
81        &self.slot_hints
82    }
83    /// Consumes the builder and constructs a [`RuntimeHints`](crate::types::RuntimeHints).
84    pub fn build(self) -> crate::types::RuntimeHints {
85        crate::types::RuntimeHints { slot_hints: self.slot_hints }
86    }
87}