1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CountTokensInput {
/// <p>The unique identifier or ARN of the foundation model to use for token counting. Each model processes tokens differently, so the token count is specific to the model you specify.</p>
pub model_id: ::std::option::Option<::std::string::String>,
/// <p>The input for which to count tokens. The structure of this parameter depends on whether you're counting tokens for an <code>InvokeModel</code> or <code>Converse</code> request:</p>
/// <ul>
/// <li>
/// <p>For <code>InvokeModel</code> requests, provide the request body in the <code>invokeModel</code> field</p></li>
/// <li>
/// <p>For <code>Converse</code> requests, provide the messages and system content in the <code>converse</code> field</p></li>
/// </ul>
/// <p>The input format must be compatible with the model specified in the <code>modelId</code> parameter.</p>
pub input: ::std::option::Option<crate::types::CountTokensInput>,
}
impl CountTokensInput {
/// <p>The unique identifier or ARN of the foundation model to use for token counting. Each model processes tokens differently, so the token count is specific to the model you specify.</p>
pub fn model_id(&self) -> ::std::option::Option<&str> {
self.model_id.as_deref()
}
/// <p>The input for which to count tokens. The structure of this parameter depends on whether you're counting tokens for an <code>InvokeModel</code> or <code>Converse</code> request:</p>
/// <ul>
/// <li>
/// <p>For <code>InvokeModel</code> requests, provide the request body in the <code>invokeModel</code> field</p></li>
/// <li>
/// <p>For <code>Converse</code> requests, provide the messages and system content in the <code>converse</code> field</p></li>
/// </ul>
/// <p>The input format must be compatible with the model specified in the <code>modelId</code> parameter.</p>
pub fn input(&self) -> ::std::option::Option<&crate::types::CountTokensInput> {
self.input.as_ref()
}
}
impl CountTokensInput {
/// Creates a new builder-style object to manufacture [`CountTokensInput`](crate::operation::count_tokens::CountTokensInput).
pub fn builder() -> crate::operation::count_tokens::builders::CountTokensInputBuilder {
crate::operation::count_tokens::builders::CountTokensInputBuilder::default()
}
}
/// A builder for [`CountTokensInput`](crate::operation::count_tokens::CountTokensInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CountTokensInputBuilder {
pub(crate) model_id: ::std::option::Option<::std::string::String>,
pub(crate) input: ::std::option::Option<crate::types::CountTokensInput>,
}
impl CountTokensInputBuilder {
/// <p>The unique identifier or ARN of the foundation model to use for token counting. Each model processes tokens differently, so the token count is specific to the model you specify.</p>
/// This field is required.
pub fn model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.model_id = ::std::option::Option::Some(input.into());
self
}
/// <p>The unique identifier or ARN of the foundation model to use for token counting. Each model processes tokens differently, so the token count is specific to the model you specify.</p>
pub fn set_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.model_id = input;
self
}
/// <p>The unique identifier or ARN of the foundation model to use for token counting. Each model processes tokens differently, so the token count is specific to the model you specify.</p>
pub fn get_model_id(&self) -> &::std::option::Option<::std::string::String> {
&self.model_id
}
/// <p>The input for which to count tokens. The structure of this parameter depends on whether you're counting tokens for an <code>InvokeModel</code> or <code>Converse</code> request:</p>
/// <ul>
/// <li>
/// <p>For <code>InvokeModel</code> requests, provide the request body in the <code>invokeModel</code> field</p></li>
/// <li>
/// <p>For <code>Converse</code> requests, provide the messages and system content in the <code>converse</code> field</p></li>
/// </ul>
/// <p>The input format must be compatible with the model specified in the <code>modelId</code> parameter.</p>
/// This field is required.
pub fn input(mut self, input: crate::types::CountTokensInput) -> Self {
self.input = ::std::option::Option::Some(input);
self
}
/// <p>The input for which to count tokens. The structure of this parameter depends on whether you're counting tokens for an <code>InvokeModel</code> or <code>Converse</code> request:</p>
/// <ul>
/// <li>
/// <p>For <code>InvokeModel</code> requests, provide the request body in the <code>invokeModel</code> field</p></li>
/// <li>
/// <p>For <code>Converse</code> requests, provide the messages and system content in the <code>converse</code> field</p></li>
/// </ul>
/// <p>The input format must be compatible with the model specified in the <code>modelId</code> parameter.</p>
pub fn set_input(mut self, input: ::std::option::Option<crate::types::CountTokensInput>) -> Self {
self.input = input;
self
}
/// <p>The input for which to count tokens. The structure of this parameter depends on whether you're counting tokens for an <code>InvokeModel</code> or <code>Converse</code> request:</p>
/// <ul>
/// <li>
/// <p>For <code>InvokeModel</code> requests, provide the request body in the <code>invokeModel</code> field</p></li>
/// <li>
/// <p>For <code>Converse</code> requests, provide the messages and system content in the <code>converse</code> field</p></li>
/// </ul>
/// <p>The input format must be compatible with the model specified in the <code>modelId</code> parameter.</p>
pub fn get_input(&self) -> &::std::option::Option<crate::types::CountTokensInput> {
&self.input
}
/// Consumes the builder and constructs a [`CountTokensInput`](crate::operation::count_tokens::CountTokensInput).
pub fn build(self) -> ::std::result::Result<crate::operation::count_tokens::CountTokensInput, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::operation::count_tokens::CountTokensInput {
model_id: self.model_id,
input: self.input,
})
}
}