mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
302 lines
8.8 KiB
Go
302 lines
8.8 KiB
Go
/*
|
|
Hanzo Cloud API
|
|
|
|
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
|
|
API version: v1
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package hanzoai
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// checks if the OpenaiUsage type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &OpenaiUsage{}
|
|
|
|
// OpenaiUsage struct for OpenaiUsage
|
|
type OpenaiUsage struct {
|
|
CompletionTokens *int32 `json:"completion_tokens,omitempty"`
|
|
CompletionTokensDetails *OpenaiCompletionTokensDetails `json:"completion_tokens_details,omitempty"`
|
|
PromptTokens *int32 `json:"prompt_tokens,omitempty"`
|
|
PromptTokensDetails *OpenaiPromptTokensDetails `json:"prompt_tokens_details,omitempty"`
|
|
TotalTokens *int32 `json:"total_tokens,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _OpenaiUsage OpenaiUsage
|
|
|
|
// NewOpenaiUsage instantiates a new OpenaiUsage 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 NewOpenaiUsage() *OpenaiUsage {
|
|
this := OpenaiUsage{}
|
|
return &this
|
|
}
|
|
|
|
// NewOpenaiUsageWithDefaults instantiates a new OpenaiUsage 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 NewOpenaiUsageWithDefaults() *OpenaiUsage {
|
|
this := OpenaiUsage{}
|
|
return &this
|
|
}
|
|
|
|
// GetCompletionTokens returns the CompletionTokens field value if set, zero value otherwise.
|
|
func (o *OpenaiUsage) GetCompletionTokens() int32 {
|
|
if o == nil || IsNil(o.CompletionTokens) {
|
|
var ret int32
|
|
return ret
|
|
}
|
|
return *o.CompletionTokens
|
|
}
|
|
|
|
// GetCompletionTokensOk returns a tuple with the CompletionTokens field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *OpenaiUsage) GetCompletionTokensOk() (*int32, bool) {
|
|
if o == nil || IsNil(o.CompletionTokens) {
|
|
return nil, false
|
|
}
|
|
return o.CompletionTokens, true
|
|
}
|
|
|
|
// HasCompletionTokens returns a boolean if a field has been set.
|
|
func (o *OpenaiUsage) HasCompletionTokens() bool {
|
|
if o != nil && !IsNil(o.CompletionTokens) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCompletionTokens gets a reference to the given int32 and assigns it to the CompletionTokens field.
|
|
func (o *OpenaiUsage) SetCompletionTokens(v int32) {
|
|
o.CompletionTokens = &v
|
|
}
|
|
|
|
// GetCompletionTokensDetails returns the CompletionTokensDetails field value if set, zero value otherwise.
|
|
func (o *OpenaiUsage) GetCompletionTokensDetails() OpenaiCompletionTokensDetails {
|
|
if o == nil || IsNil(o.CompletionTokensDetails) {
|
|
var ret OpenaiCompletionTokensDetails
|
|
return ret
|
|
}
|
|
return *o.CompletionTokensDetails
|
|
}
|
|
|
|
// GetCompletionTokensDetailsOk returns a tuple with the CompletionTokensDetails field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *OpenaiUsage) GetCompletionTokensDetailsOk() (*OpenaiCompletionTokensDetails, bool) {
|
|
if o == nil || IsNil(o.CompletionTokensDetails) {
|
|
return nil, false
|
|
}
|
|
return o.CompletionTokensDetails, true
|
|
}
|
|
|
|
// HasCompletionTokensDetails returns a boolean if a field has been set.
|
|
func (o *OpenaiUsage) HasCompletionTokensDetails() bool {
|
|
if o != nil && !IsNil(o.CompletionTokensDetails) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCompletionTokensDetails gets a reference to the given OpenaiCompletionTokensDetails and assigns it to the CompletionTokensDetails field.
|
|
func (o *OpenaiUsage) SetCompletionTokensDetails(v OpenaiCompletionTokensDetails) {
|
|
o.CompletionTokensDetails = &v
|
|
}
|
|
|
|
// GetPromptTokens returns the PromptTokens field value if set, zero value otherwise.
|
|
func (o *OpenaiUsage) GetPromptTokens() int32 {
|
|
if o == nil || IsNil(o.PromptTokens) {
|
|
var ret int32
|
|
return ret
|
|
}
|
|
return *o.PromptTokens
|
|
}
|
|
|
|
// GetPromptTokensOk returns a tuple with the PromptTokens field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *OpenaiUsage) GetPromptTokensOk() (*int32, bool) {
|
|
if o == nil || IsNil(o.PromptTokens) {
|
|
return nil, false
|
|
}
|
|
return o.PromptTokens, true
|
|
}
|
|
|
|
// HasPromptTokens returns a boolean if a field has been set.
|
|
func (o *OpenaiUsage) HasPromptTokens() bool {
|
|
if o != nil && !IsNil(o.PromptTokens) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetPromptTokens gets a reference to the given int32 and assigns it to the PromptTokens field.
|
|
func (o *OpenaiUsage) SetPromptTokens(v int32) {
|
|
o.PromptTokens = &v
|
|
}
|
|
|
|
// GetPromptTokensDetails returns the PromptTokensDetails field value if set, zero value otherwise.
|
|
func (o *OpenaiUsage) GetPromptTokensDetails() OpenaiPromptTokensDetails {
|
|
if o == nil || IsNil(o.PromptTokensDetails) {
|
|
var ret OpenaiPromptTokensDetails
|
|
return ret
|
|
}
|
|
return *o.PromptTokensDetails
|
|
}
|
|
|
|
// GetPromptTokensDetailsOk returns a tuple with the PromptTokensDetails field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *OpenaiUsage) GetPromptTokensDetailsOk() (*OpenaiPromptTokensDetails, bool) {
|
|
if o == nil || IsNil(o.PromptTokensDetails) {
|
|
return nil, false
|
|
}
|
|
return o.PromptTokensDetails, true
|
|
}
|
|
|
|
// HasPromptTokensDetails returns a boolean if a field has been set.
|
|
func (o *OpenaiUsage) HasPromptTokensDetails() bool {
|
|
if o != nil && !IsNil(o.PromptTokensDetails) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetPromptTokensDetails gets a reference to the given OpenaiPromptTokensDetails and assigns it to the PromptTokensDetails field.
|
|
func (o *OpenaiUsage) SetPromptTokensDetails(v OpenaiPromptTokensDetails) {
|
|
o.PromptTokensDetails = &v
|
|
}
|
|
|
|
// GetTotalTokens returns the TotalTokens field value if set, zero value otherwise.
|
|
func (o *OpenaiUsage) 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 *OpenaiUsage) 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 *OpenaiUsage) 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 *OpenaiUsage) SetTotalTokens(v int32) {
|
|
o.TotalTokens = &v
|
|
}
|
|
|
|
func (o OpenaiUsage) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o OpenaiUsage) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.CompletionTokens) {
|
|
toSerialize["completion_tokens"] = o.CompletionTokens
|
|
}
|
|
if !IsNil(o.CompletionTokensDetails) {
|
|
toSerialize["completion_tokens_details"] = o.CompletionTokensDetails
|
|
}
|
|
if !IsNil(o.PromptTokens) {
|
|
toSerialize["prompt_tokens"] = o.PromptTokens
|
|
}
|
|
if !IsNil(o.PromptTokensDetails) {
|
|
toSerialize["prompt_tokens_details"] = o.PromptTokensDetails
|
|
}
|
|
if !IsNil(o.TotalTokens) {
|
|
toSerialize["total_tokens"] = o.TotalTokens
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *OpenaiUsage) UnmarshalJSON(data []byte) (err error) {
|
|
varOpenaiUsage := _OpenaiUsage{}
|
|
|
|
err = json.Unmarshal(data, &varOpenaiUsage)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = OpenaiUsage(varOpenaiUsage)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "completion_tokens")
|
|
delete(additionalProperties, "completion_tokens_details")
|
|
delete(additionalProperties, "prompt_tokens")
|
|
delete(additionalProperties, "prompt_tokens_details")
|
|
delete(additionalProperties, "total_tokens")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableOpenaiUsage struct {
|
|
value *OpenaiUsage
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableOpenaiUsage) Get() *OpenaiUsage {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableOpenaiUsage) Set(val *OpenaiUsage) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableOpenaiUsage) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableOpenaiUsage) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableOpenaiUsage(val *OpenaiUsage) *NullableOpenaiUsage {
|
|
return &NullableOpenaiUsage{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableOpenaiUsage) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableOpenaiUsage) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|