-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel_chat_inference_200_response_usage.go
More file actions
270 lines (219 loc) · 7.77 KB
/
model_chat_inference_200_response_usage.go
File metadata and controls
270 lines (219 loc) · 7.77 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/*
QuantCDN API
Unified API for QuantCDN Admin and QuantCloud Platform services
API version: 4.15.8
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package quantadmingo
import (
"encoding/json"
)
// checks if the ChatInference200ResponseUsage type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ChatInference200ResponseUsage{}
// ChatInference200ResponseUsage Token usage and cost for this inference call
type ChatInference200ResponseUsage struct {
// Number of input tokens
InputTokens *int32 `json:"inputTokens,omitempty"`
// Number of output tokens
OutputTokens *int32 `json:"outputTokens,omitempty"`
// Total tokens consumed
TotalTokens *int32 `json:"totalTokens,omitempty"`
// Cost of this inference call in US cents
CostCents *float32 `json:"costCents,omitempty"`
AdditionalProperties map[string]interface{}
}
type _ChatInference200ResponseUsage ChatInference200ResponseUsage
// NewChatInference200ResponseUsage instantiates a new ChatInference200ResponseUsage object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewChatInference200ResponseUsage() *ChatInference200ResponseUsage {
this := ChatInference200ResponseUsage{}
return &this
}
// NewChatInference200ResponseUsageWithDefaults instantiates a new ChatInference200ResponseUsage object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewChatInference200ResponseUsageWithDefaults() *ChatInference200ResponseUsage {
this := ChatInference200ResponseUsage{}
return &this
}
// GetInputTokens returns the InputTokens field value if set, zero value otherwise.
func (o *ChatInference200ResponseUsage) GetInputTokens() int32 {
if o == nil || IsNil(o.InputTokens) {
var ret int32
return ret
}
return *o.InputTokens
}
// GetInputTokensOk returns a tuple with the InputTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ChatInference200ResponseUsage) GetInputTokensOk() (*int32, bool) {
if o == nil || IsNil(o.InputTokens) {
return nil, false
}
return o.InputTokens, true
}
// HasInputTokens returns a boolean if a field has been set.
func (o *ChatInference200ResponseUsage) HasInputTokens() bool {
if o != nil && !IsNil(o.InputTokens) {
return true
}
return false
}
// SetInputTokens gets a reference to the given int32 and assigns it to the InputTokens field.
func (o *ChatInference200ResponseUsage) SetInputTokens(v int32) {
o.InputTokens = &v
}
// GetOutputTokens returns the OutputTokens field value if set, zero value otherwise.
func (o *ChatInference200ResponseUsage) GetOutputTokens() int32 {
if o == nil || IsNil(o.OutputTokens) {
var ret int32
return ret
}
return *o.OutputTokens
}
// GetOutputTokensOk returns a tuple with the OutputTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ChatInference200ResponseUsage) GetOutputTokensOk() (*int32, bool) {
if o == nil || IsNil(o.OutputTokens) {
return nil, false
}
return o.OutputTokens, true
}
// HasOutputTokens returns a boolean if a field has been set.
func (o *ChatInference200ResponseUsage) HasOutputTokens() bool {
if o != nil && !IsNil(o.OutputTokens) {
return true
}
return false
}
// SetOutputTokens gets a reference to the given int32 and assigns it to the OutputTokens field.
func (o *ChatInference200ResponseUsage) SetOutputTokens(v int32) {
o.OutputTokens = &v
}
// GetTotalTokens returns the TotalTokens field value if set, zero value otherwise.
func (o *ChatInference200ResponseUsage) GetTotalTokens() int32 {
if o == nil || IsNil(o.TotalTokens) {
var ret int32
return ret
}
return *o.TotalTokens
}
// GetTotalTokensOk returns a tuple with the TotalTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ChatInference200ResponseUsage) GetTotalTokensOk() (*int32, bool) {
if o == nil || IsNil(o.TotalTokens) {
return nil, false
}
return o.TotalTokens, true
}
// HasTotalTokens returns a boolean if a field has been set.
func (o *ChatInference200ResponseUsage) HasTotalTokens() bool {
if o != nil && !IsNil(o.TotalTokens) {
return true
}
return false
}
// SetTotalTokens gets a reference to the given int32 and assigns it to the TotalTokens field.
func (o *ChatInference200ResponseUsage) SetTotalTokens(v int32) {
o.TotalTokens = &v
}
// GetCostCents returns the CostCents field value if set, zero value otherwise.
func (o *ChatInference200ResponseUsage) GetCostCents() float32 {
if o == nil || IsNil(o.CostCents) {
var ret float32
return ret
}
return *o.CostCents
}
// GetCostCentsOk returns a tuple with the CostCents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ChatInference200ResponseUsage) GetCostCentsOk() (*float32, bool) {
if o == nil || IsNil(o.CostCents) {
return nil, false
}
return o.CostCents, true
}
// HasCostCents returns a boolean if a field has been set.
func (o *ChatInference200ResponseUsage) HasCostCents() bool {
if o != nil && !IsNil(o.CostCents) {
return true
}
return false
}
// SetCostCents gets a reference to the given float32 and assigns it to the CostCents field.
func (o *ChatInference200ResponseUsage) SetCostCents(v float32) {
o.CostCents = &v
}
func (o ChatInference200ResponseUsage) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ChatInference200ResponseUsage) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.InputTokens) {
toSerialize["inputTokens"] = o.InputTokens
}
if !IsNil(o.OutputTokens) {
toSerialize["outputTokens"] = o.OutputTokens
}
if !IsNil(o.TotalTokens) {
toSerialize["totalTokens"] = o.TotalTokens
}
if !IsNil(o.CostCents) {
toSerialize["costCents"] = o.CostCents
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *ChatInference200ResponseUsage) UnmarshalJSON(data []byte) (err error) {
varChatInference200ResponseUsage := _ChatInference200ResponseUsage{}
err = json.Unmarshal(data, &varChatInference200ResponseUsage)
if err != nil {
return err
}
*o = ChatInference200ResponseUsage(varChatInference200ResponseUsage)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "inputTokens")
delete(additionalProperties, "outputTokens")
delete(additionalProperties, "totalTokens")
delete(additionalProperties, "costCents")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableChatInference200ResponseUsage struct {
value *ChatInference200ResponseUsage
isSet bool
}
func (v NullableChatInference200ResponseUsage) Get() *ChatInference200ResponseUsage {
return v.value
}
func (v *NullableChatInference200ResponseUsage) Set(val *ChatInference200ResponseUsage) {
v.value = val
v.isSet = true
}
func (v NullableChatInference200ResponseUsage) IsSet() bool {
return v.isSet
}
func (v *NullableChatInference200ResponseUsage) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableChatInference200ResponseUsage(val *ChatInference200ResponseUsage) *NullableChatInference200ResponseUsage {
return &NullableChatInference200ResponseUsage{value: val, isSet: true}
}
func (v NullableChatInference200ResponseUsage) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableChatInference200ResponseUsage) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}