Files
sdk/model_train_sample_in.go

307 lines
7.9 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 TrainSampleIn type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainSampleIn{}
// TrainSampleIn struct for TrainSampleIn
type TrainSampleIn struct {
// ID names the client.
Id *string `json:"id,omitempty"`
// NumSamples is how many sequences to decode.
NumSamples *int64 `json:"num_samples,omitempty"`
// Prompt is a text prompt; exactly one of prompt and tokens.
Prompt *string `json:"prompt,omitempty"`
SamplingParams interface{} `json:"sampling_params,omitempty"`
// Tokens is a tokenized prompt.
Tokens []int32 `json:"tokens,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainSampleIn TrainSampleIn
// NewTrainSampleIn instantiates a new TrainSampleIn 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 NewTrainSampleIn() *TrainSampleIn {
this := TrainSampleIn{}
return &this
}
// NewTrainSampleInWithDefaults instantiates a new TrainSampleIn 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 NewTrainSampleInWithDefaults() *TrainSampleIn {
this := TrainSampleIn{}
return &this
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *TrainSampleIn) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainSampleIn) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *TrainSampleIn) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *TrainSampleIn) SetId(v string) {
o.Id = &v
}
// GetNumSamples returns the NumSamples field value if set, zero value otherwise.
func (o *TrainSampleIn) GetNumSamples() int64 {
if o == nil || IsNil(o.NumSamples) {
var ret int64
return ret
}
return *o.NumSamples
}
// GetNumSamplesOk returns a tuple with the NumSamples field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainSampleIn) GetNumSamplesOk() (*int64, bool) {
if o == nil || IsNil(o.NumSamples) {
return nil, false
}
return o.NumSamples, true
}
// HasNumSamples returns a boolean if a field has been set.
func (o *TrainSampleIn) HasNumSamples() bool {
if o != nil && !IsNil(o.NumSamples) {
return true
}
return false
}
// SetNumSamples gets a reference to the given int64 and assigns it to the NumSamples field.
func (o *TrainSampleIn) SetNumSamples(v int64) {
o.NumSamples = &v
}
// GetPrompt returns the Prompt field value if set, zero value otherwise.
func (o *TrainSampleIn) GetPrompt() string {
if o == nil || IsNil(o.Prompt) {
var ret string
return ret
}
return *o.Prompt
}
// GetPromptOk returns a tuple with the Prompt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainSampleIn) GetPromptOk() (*string, bool) {
if o == nil || IsNil(o.Prompt) {
return nil, false
}
return o.Prompt, true
}
// HasPrompt returns a boolean if a field has been set.
func (o *TrainSampleIn) HasPrompt() bool {
if o != nil && !IsNil(o.Prompt) {
return true
}
return false
}
// SetPrompt gets a reference to the given string and assigns it to the Prompt field.
func (o *TrainSampleIn) SetPrompt(v string) {
o.Prompt = &v
}
// GetSamplingParams returns the SamplingParams field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *TrainSampleIn) GetSamplingParams() interface{} {
if o == nil {
var ret interface{}
return ret
}
return o.SamplingParams
}
// GetSamplingParamsOk returns a tuple with the SamplingParams field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *TrainSampleIn) GetSamplingParamsOk() (*interface{}, bool) {
if o == nil || IsNil(o.SamplingParams) {
return nil, false
}
return &o.SamplingParams, true
}
// HasSamplingParams returns a boolean if a field has been set.
func (o *TrainSampleIn) HasSamplingParams() bool {
if o != nil && !IsNil(o.SamplingParams) {
return true
}
return false
}
// SetSamplingParams gets a reference to the given interface{} and assigns it to the SamplingParams field.
func (o *TrainSampleIn) SetSamplingParams(v interface{}) {
o.SamplingParams = v
}
// GetTokens returns the Tokens field value if set, zero value otherwise.
func (o *TrainSampleIn) GetTokens() []int32 {
if o == nil || IsNil(o.Tokens) {
var ret []int32
return ret
}
return o.Tokens
}
// GetTokensOk returns a tuple with the Tokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainSampleIn) GetTokensOk() ([]int32, bool) {
if o == nil || IsNil(o.Tokens) {
return nil, false
}
return o.Tokens, true
}
// HasTokens returns a boolean if a field has been set.
func (o *TrainSampleIn) HasTokens() bool {
if o != nil && !IsNil(o.Tokens) {
return true
}
return false
}
// SetTokens gets a reference to the given []int32 and assigns it to the Tokens field.
func (o *TrainSampleIn) SetTokens(v []int32) {
o.Tokens = v
}
func (o TrainSampleIn) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainSampleIn) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.NumSamples) {
toSerialize["num_samples"] = o.NumSamples
}
if !IsNil(o.Prompt) {
toSerialize["prompt"] = o.Prompt
}
if o.SamplingParams != nil {
toSerialize["sampling_params"] = o.SamplingParams
}
if !IsNil(o.Tokens) {
toSerialize["tokens"] = o.Tokens
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainSampleIn) UnmarshalJSON(data []byte) (err error) {
varTrainSampleIn := _TrainSampleIn{}
err = json.Unmarshal(data, &varTrainSampleIn)
if err != nil {
return err
}
*o = TrainSampleIn(varTrainSampleIn)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "id")
delete(additionalProperties, "num_samples")
delete(additionalProperties, "prompt")
delete(additionalProperties, "sampling_params")
delete(additionalProperties, "tokens")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainSampleIn struct {
value *TrainSampleIn
isSet bool
}
func (v NullableTrainSampleIn) Get() *TrainSampleIn {
return v.value
}
func (v *NullableTrainSampleIn) Set(val *TrainSampleIn) {
v.value = val
v.isSet = true
}
func (v NullableTrainSampleIn) IsSet() bool {
return v.isSet
}
func (v *NullableTrainSampleIn) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainSampleIn(val *TrainSampleIn) *NullableTrainSampleIn {
return &NullableTrainSampleIn{value: val, isSet: true}
}
func (v NullableTrainSampleIn) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainSampleIn) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}