Files
sdk/model_openai_chat_completion_choice.go

302 lines
9.1 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 OpenaiChatCompletionChoice type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &OpenaiChatCompletionChoice{}
// OpenaiChatCompletionChoice struct for OpenaiChatCompletionChoice
type OpenaiChatCompletionChoice struct {
ContentFilterResults *OpenaiContentFilterResults `json:"content_filter_results,omitempty"`
FinishReason *string `json:"finish_reason,omitempty"`
Index *int32 `json:"index,omitempty"`
Logprobs *OpenaiLogProbs `json:"logprobs,omitempty"`
Message *OpenaiChatCompletionMessage `json:"message,omitempty"`
AdditionalProperties map[string]interface{}
}
type _OpenaiChatCompletionChoice OpenaiChatCompletionChoice
// NewOpenaiChatCompletionChoice instantiates a new OpenaiChatCompletionChoice 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 NewOpenaiChatCompletionChoice() *OpenaiChatCompletionChoice {
this := OpenaiChatCompletionChoice{}
return &this
}
// NewOpenaiChatCompletionChoiceWithDefaults instantiates a new OpenaiChatCompletionChoice 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 NewOpenaiChatCompletionChoiceWithDefaults() *OpenaiChatCompletionChoice {
this := OpenaiChatCompletionChoice{}
return &this
}
// GetContentFilterResults returns the ContentFilterResults field value if set, zero value otherwise.
func (o *OpenaiChatCompletionChoice) GetContentFilterResults() OpenaiContentFilterResults {
if o == nil || IsNil(o.ContentFilterResults) {
var ret OpenaiContentFilterResults
return ret
}
return *o.ContentFilterResults
}
// GetContentFilterResultsOk returns a tuple with the ContentFilterResults field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiChatCompletionChoice) GetContentFilterResultsOk() (*OpenaiContentFilterResults, bool) {
if o == nil || IsNil(o.ContentFilterResults) {
return nil, false
}
return o.ContentFilterResults, true
}
// HasContentFilterResults returns a boolean if a field has been set.
func (o *OpenaiChatCompletionChoice) HasContentFilterResults() bool {
if o != nil && !IsNil(o.ContentFilterResults) {
return true
}
return false
}
// SetContentFilterResults gets a reference to the given OpenaiContentFilterResults and assigns it to the ContentFilterResults field.
func (o *OpenaiChatCompletionChoice) SetContentFilterResults(v OpenaiContentFilterResults) {
o.ContentFilterResults = &v
}
// GetFinishReason returns the FinishReason field value if set, zero value otherwise.
func (o *OpenaiChatCompletionChoice) GetFinishReason() string {
if o == nil || IsNil(o.FinishReason) {
var ret string
return ret
}
return *o.FinishReason
}
// GetFinishReasonOk returns a tuple with the FinishReason field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiChatCompletionChoice) GetFinishReasonOk() (*string, bool) {
if o == nil || IsNil(o.FinishReason) {
return nil, false
}
return o.FinishReason, true
}
// HasFinishReason returns a boolean if a field has been set.
func (o *OpenaiChatCompletionChoice) HasFinishReason() bool {
if o != nil && !IsNil(o.FinishReason) {
return true
}
return false
}
// SetFinishReason gets a reference to the given string and assigns it to the FinishReason field.
func (o *OpenaiChatCompletionChoice) SetFinishReason(v string) {
o.FinishReason = &v
}
// GetIndex returns the Index field value if set, zero value otherwise.
func (o *OpenaiChatCompletionChoice) GetIndex() int32 {
if o == nil || IsNil(o.Index) {
var ret int32
return ret
}
return *o.Index
}
// GetIndexOk returns a tuple with the Index field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiChatCompletionChoice) GetIndexOk() (*int32, bool) {
if o == nil || IsNil(o.Index) {
return nil, false
}
return o.Index, true
}
// HasIndex returns a boolean if a field has been set.
func (o *OpenaiChatCompletionChoice) HasIndex() bool {
if o != nil && !IsNil(o.Index) {
return true
}
return false
}
// SetIndex gets a reference to the given int32 and assigns it to the Index field.
func (o *OpenaiChatCompletionChoice) SetIndex(v int32) {
o.Index = &v
}
// GetLogprobs returns the Logprobs field value if set, zero value otherwise.
func (o *OpenaiChatCompletionChoice) GetLogprobs() OpenaiLogProbs {
if o == nil || IsNil(o.Logprobs) {
var ret OpenaiLogProbs
return ret
}
return *o.Logprobs
}
// GetLogprobsOk returns a tuple with the Logprobs field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiChatCompletionChoice) GetLogprobsOk() (*OpenaiLogProbs, bool) {
if o == nil || IsNil(o.Logprobs) {
return nil, false
}
return o.Logprobs, true
}
// HasLogprobs returns a boolean if a field has been set.
func (o *OpenaiChatCompletionChoice) HasLogprobs() bool {
if o != nil && !IsNil(o.Logprobs) {
return true
}
return false
}
// SetLogprobs gets a reference to the given OpenaiLogProbs and assigns it to the Logprobs field.
func (o *OpenaiChatCompletionChoice) SetLogprobs(v OpenaiLogProbs) {
o.Logprobs = &v
}
// GetMessage returns the Message field value if set, zero value otherwise.
func (o *OpenaiChatCompletionChoice) GetMessage() OpenaiChatCompletionMessage {
if o == nil || IsNil(o.Message) {
var ret OpenaiChatCompletionMessage
return ret
}
return *o.Message
}
// GetMessageOk returns a tuple with the Message field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiChatCompletionChoice) GetMessageOk() (*OpenaiChatCompletionMessage, bool) {
if o == nil || IsNil(o.Message) {
return nil, false
}
return o.Message, true
}
// HasMessage returns a boolean if a field has been set.
func (o *OpenaiChatCompletionChoice) HasMessage() bool {
if o != nil && !IsNil(o.Message) {
return true
}
return false
}
// SetMessage gets a reference to the given OpenaiChatCompletionMessage and assigns it to the Message field.
func (o *OpenaiChatCompletionChoice) SetMessage(v OpenaiChatCompletionMessage) {
o.Message = &v
}
func (o OpenaiChatCompletionChoice) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o OpenaiChatCompletionChoice) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.ContentFilterResults) {
toSerialize["content_filter_results"] = o.ContentFilterResults
}
if !IsNil(o.FinishReason) {
toSerialize["finish_reason"] = o.FinishReason
}
if !IsNil(o.Index) {
toSerialize["index"] = o.Index
}
if !IsNil(o.Logprobs) {
toSerialize["logprobs"] = o.Logprobs
}
if !IsNil(o.Message) {
toSerialize["message"] = o.Message
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *OpenaiChatCompletionChoice) UnmarshalJSON(data []byte) (err error) {
varOpenaiChatCompletionChoice := _OpenaiChatCompletionChoice{}
err = json.Unmarshal(data, &varOpenaiChatCompletionChoice)
if err != nil {
return err
}
*o = OpenaiChatCompletionChoice(varOpenaiChatCompletionChoice)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "content_filter_results")
delete(additionalProperties, "finish_reason")
delete(additionalProperties, "index")
delete(additionalProperties, "logprobs")
delete(additionalProperties, "message")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableOpenaiChatCompletionChoice struct {
value *OpenaiChatCompletionChoice
isSet bool
}
func (v NullableOpenaiChatCompletionChoice) Get() *OpenaiChatCompletionChoice {
return v.value
}
func (v *NullableOpenaiChatCompletionChoice) Set(val *OpenaiChatCompletionChoice) {
v.value = val
v.isSet = true
}
func (v NullableOpenaiChatCompletionChoice) IsSet() bool {
return v.isSet
}
func (v *NullableOpenaiChatCompletionChoice) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableOpenaiChatCompletionChoice(val *OpenaiChatCompletionChoice) *NullableOpenaiChatCompletionChoice {
return &NullableOpenaiChatCompletionChoice{value: val, isSet: true}
}
func (v NullableOpenaiChatCompletionChoice) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableOpenaiChatCompletionChoice) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}