Files
sdk/model_openai_log_prob.go

265 lines
6.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 OpenaiLogProb type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &OpenaiLogProb{}
// OpenaiLogProb struct for OpenaiLogProb
type OpenaiLogProb struct {
Bytes *string `json:"bytes,omitempty"`
Logprob *float32 `json:"logprob,omitempty"`
Token *string `json:"token,omitempty"`
TopLogprobs []OpenaiTopLogProbs `json:"top_logprobs,omitempty"`
AdditionalProperties map[string]interface{}
}
type _OpenaiLogProb OpenaiLogProb
// NewOpenaiLogProb instantiates a new OpenaiLogProb 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 NewOpenaiLogProb() *OpenaiLogProb {
this := OpenaiLogProb{}
return &this
}
// NewOpenaiLogProbWithDefaults instantiates a new OpenaiLogProb 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 NewOpenaiLogProbWithDefaults() *OpenaiLogProb {
this := OpenaiLogProb{}
return &this
}
// GetBytes returns the Bytes field value if set, zero value otherwise.
func (o *OpenaiLogProb) GetBytes() string {
if o == nil || IsNil(o.Bytes) {
var ret string
return ret
}
return *o.Bytes
}
// GetBytesOk returns a tuple with the Bytes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiLogProb) GetBytesOk() (*string, bool) {
if o == nil || IsNil(o.Bytes) {
return nil, false
}
return o.Bytes, true
}
// HasBytes returns a boolean if a field has been set.
func (o *OpenaiLogProb) HasBytes() bool {
if o != nil && !IsNil(o.Bytes) {
return true
}
return false
}
// SetBytes gets a reference to the given string and assigns it to the Bytes field.
func (o *OpenaiLogProb) SetBytes(v string) {
o.Bytes = &v
}
// GetLogprob returns the Logprob field value if set, zero value otherwise.
func (o *OpenaiLogProb) GetLogprob() float32 {
if o == nil || IsNil(o.Logprob) {
var ret float32
return ret
}
return *o.Logprob
}
// GetLogprobOk returns a tuple with the Logprob field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiLogProb) GetLogprobOk() (*float32, bool) {
if o == nil || IsNil(o.Logprob) {
return nil, false
}
return o.Logprob, true
}
// HasLogprob returns a boolean if a field has been set.
func (o *OpenaiLogProb) HasLogprob() bool {
if o != nil && !IsNil(o.Logprob) {
return true
}
return false
}
// SetLogprob gets a reference to the given float32 and assigns it to the Logprob field.
func (o *OpenaiLogProb) SetLogprob(v float32) {
o.Logprob = &v
}
// GetToken returns the Token field value if set, zero value otherwise.
func (o *OpenaiLogProb) GetToken() string {
if o == nil || IsNil(o.Token) {
var ret string
return ret
}
return *o.Token
}
// GetTokenOk returns a tuple with the Token field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiLogProb) GetTokenOk() (*string, bool) {
if o == nil || IsNil(o.Token) {
return nil, false
}
return o.Token, true
}
// HasToken returns a boolean if a field has been set.
func (o *OpenaiLogProb) HasToken() bool {
if o != nil && !IsNil(o.Token) {
return true
}
return false
}
// SetToken gets a reference to the given string and assigns it to the Token field.
func (o *OpenaiLogProb) SetToken(v string) {
o.Token = &v
}
// GetTopLogprobs returns the TopLogprobs field value if set, zero value otherwise.
func (o *OpenaiLogProb) GetTopLogprobs() []OpenaiTopLogProbs {
if o == nil || IsNil(o.TopLogprobs) {
var ret []OpenaiTopLogProbs
return ret
}
return o.TopLogprobs
}
// GetTopLogprobsOk returns a tuple with the TopLogprobs field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiLogProb) GetTopLogprobsOk() ([]OpenaiTopLogProbs, bool) {
if o == nil || IsNil(o.TopLogprobs) {
return nil, false
}
return o.TopLogprobs, true
}
// HasTopLogprobs returns a boolean if a field has been set.
func (o *OpenaiLogProb) HasTopLogprobs() bool {
if o != nil && !IsNil(o.TopLogprobs) {
return true
}
return false
}
// SetTopLogprobs gets a reference to the given []OpenaiTopLogProbs and assigns it to the TopLogprobs field.
func (o *OpenaiLogProb) SetTopLogprobs(v []OpenaiTopLogProbs) {
o.TopLogprobs = v
}
func (o OpenaiLogProb) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o OpenaiLogProb) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Bytes) {
toSerialize["bytes"] = o.Bytes
}
if !IsNil(o.Logprob) {
toSerialize["logprob"] = o.Logprob
}
if !IsNil(o.Token) {
toSerialize["token"] = o.Token
}
if !IsNil(o.TopLogprobs) {
toSerialize["top_logprobs"] = o.TopLogprobs
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *OpenaiLogProb) UnmarshalJSON(data []byte) (err error) {
varOpenaiLogProb := _OpenaiLogProb{}
err = json.Unmarshal(data, &varOpenaiLogProb)
if err != nil {
return err
}
*o = OpenaiLogProb(varOpenaiLogProb)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "bytes")
delete(additionalProperties, "logprob")
delete(additionalProperties, "token")
delete(additionalProperties, "top_logprobs")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableOpenaiLogProb struct {
value *OpenaiLogProb
isSet bool
}
func (v NullableOpenaiLogProb) Get() *OpenaiLogProb {
return v.value
}
func (v *NullableOpenaiLogProb) Set(val *OpenaiLogProb) {
v.value = val
v.isSet = true
}
func (v NullableOpenaiLogProb) IsSet() bool {
return v.isSet
}
func (v *NullableOpenaiLogProb) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableOpenaiLogProb(val *OpenaiLogProb) *NullableOpenaiLogProb {
return &NullableOpenaiLogProb{value: val, isSet: true}
}
func (v NullableOpenaiLogProb) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableOpenaiLogProb) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}