Files
sdk/model_eval_score_req.go

472 lines
12 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"
"fmt"
)
// checks if the EvalScoreReq type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &EvalScoreReq{}
// EvalScoreReq struct for EvalScoreReq
type EvalScoreReq struct {
// Comment is the grader's reasoning, truncated at 2000 characters.
Comment *string `json:"comment,omitempty"`
// DataType is NUMERIC, CATEGORICAL or BOOLEAN. A declared rubric overrides it — a caller cannot claim a type the org's rubric contradicts.
DataType *string `json:"dataType,omitempty"`
// ItemID attaches the score to one graded example.
DatasetItemId *string `json:"datasetItemId,omitempty"`
// Dataset attaches the score to one dataset.
DatasetName *string `json:"datasetName,omitempty"`
// Name is the score name. A rubric of the same name, if the org has declared one, decides this score's type and the values it may take.
Name string `json:"name"`
// RunName attaches the score to one run.
RunName *string `json:"runName,omitempty"`
// StringValue is the label of a CATEGORICAL score, which must be one the rubric allows.
StringValue *string `json:"stringValue,omitempty"`
// TraceID attaches the score to one model call.
TraceId *string `json:"traceId,omitempty"`
// Value is the numeric score, which must be finite: NaN and Inf are refused. A BOOLEAN score takes 0 or 1.
Value *float64 `json:"value,omitempty"`
AdditionalProperties map[string]interface{}
}
type _EvalScoreReq EvalScoreReq
// NewEvalScoreReq instantiates a new EvalScoreReq 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 NewEvalScoreReq(name string) *EvalScoreReq {
this := EvalScoreReq{}
this.Name = name
return &this
}
// NewEvalScoreReqWithDefaults instantiates a new EvalScoreReq 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 NewEvalScoreReqWithDefaults() *EvalScoreReq {
this := EvalScoreReq{}
return &this
}
// GetComment returns the Comment field value if set, zero value otherwise.
func (o *EvalScoreReq) GetComment() string {
if o == nil || IsNil(o.Comment) {
var ret string
return ret
}
return *o.Comment
}
// GetCommentOk returns a tuple with the Comment field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EvalScoreReq) GetCommentOk() (*string, bool) {
if o == nil || IsNil(o.Comment) {
return nil, false
}
return o.Comment, true
}
// HasComment returns a boolean if a field has been set.
func (o *EvalScoreReq) HasComment() bool {
if o != nil && !IsNil(o.Comment) {
return true
}
return false
}
// SetComment gets a reference to the given string and assigns it to the Comment field.
func (o *EvalScoreReq) SetComment(v string) {
o.Comment = &v
}
// GetDataType returns the DataType field value if set, zero value otherwise.
func (o *EvalScoreReq) GetDataType() string {
if o == nil || IsNil(o.DataType) {
var ret string
return ret
}
return *o.DataType
}
// GetDataTypeOk returns a tuple with the DataType field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EvalScoreReq) GetDataTypeOk() (*string, bool) {
if o == nil || IsNil(o.DataType) {
return nil, false
}
return o.DataType, true
}
// HasDataType returns a boolean if a field has been set.
func (o *EvalScoreReq) HasDataType() bool {
if o != nil && !IsNil(o.DataType) {
return true
}
return false
}
// SetDataType gets a reference to the given string and assigns it to the DataType field.
func (o *EvalScoreReq) SetDataType(v string) {
o.DataType = &v
}
// GetDatasetItemId returns the DatasetItemId field value if set, zero value otherwise.
func (o *EvalScoreReq) GetDatasetItemId() string {
if o == nil || IsNil(o.DatasetItemId) {
var ret string
return ret
}
return *o.DatasetItemId
}
// GetDatasetItemIdOk returns a tuple with the DatasetItemId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EvalScoreReq) GetDatasetItemIdOk() (*string, bool) {
if o == nil || IsNil(o.DatasetItemId) {
return nil, false
}
return o.DatasetItemId, true
}
// HasDatasetItemId returns a boolean if a field has been set.
func (o *EvalScoreReq) HasDatasetItemId() bool {
if o != nil && !IsNil(o.DatasetItemId) {
return true
}
return false
}
// SetDatasetItemId gets a reference to the given string and assigns it to the DatasetItemId field.
func (o *EvalScoreReq) SetDatasetItemId(v string) {
o.DatasetItemId = &v
}
// GetDatasetName returns the DatasetName field value if set, zero value otherwise.
func (o *EvalScoreReq) GetDatasetName() string {
if o == nil || IsNil(o.DatasetName) {
var ret string
return ret
}
return *o.DatasetName
}
// GetDatasetNameOk returns a tuple with the DatasetName field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EvalScoreReq) GetDatasetNameOk() (*string, bool) {
if o == nil || IsNil(o.DatasetName) {
return nil, false
}
return o.DatasetName, true
}
// HasDatasetName returns a boolean if a field has been set.
func (o *EvalScoreReq) HasDatasetName() bool {
if o != nil && !IsNil(o.DatasetName) {
return true
}
return false
}
// SetDatasetName gets a reference to the given string and assigns it to the DatasetName field.
func (o *EvalScoreReq) SetDatasetName(v string) {
o.DatasetName = &v
}
// GetName returns the Name field value
func (o *EvalScoreReq) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *EvalScoreReq) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *EvalScoreReq) SetName(v string) {
o.Name = v
}
// GetRunName returns the RunName field value if set, zero value otherwise.
func (o *EvalScoreReq) GetRunName() string {
if o == nil || IsNil(o.RunName) {
var ret string
return ret
}
return *o.RunName
}
// GetRunNameOk returns a tuple with the RunName field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EvalScoreReq) GetRunNameOk() (*string, bool) {
if o == nil || IsNil(o.RunName) {
return nil, false
}
return o.RunName, true
}
// HasRunName returns a boolean if a field has been set.
func (o *EvalScoreReq) HasRunName() bool {
if o != nil && !IsNil(o.RunName) {
return true
}
return false
}
// SetRunName gets a reference to the given string and assigns it to the RunName field.
func (o *EvalScoreReq) SetRunName(v string) {
o.RunName = &v
}
// GetStringValue returns the StringValue field value if set, zero value otherwise.
func (o *EvalScoreReq) GetStringValue() string {
if o == nil || IsNil(o.StringValue) {
var ret string
return ret
}
return *o.StringValue
}
// GetStringValueOk returns a tuple with the StringValue field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EvalScoreReq) GetStringValueOk() (*string, bool) {
if o == nil || IsNil(o.StringValue) {
return nil, false
}
return o.StringValue, true
}
// HasStringValue returns a boolean if a field has been set.
func (o *EvalScoreReq) HasStringValue() bool {
if o != nil && !IsNil(o.StringValue) {
return true
}
return false
}
// SetStringValue gets a reference to the given string and assigns it to the StringValue field.
func (o *EvalScoreReq) SetStringValue(v string) {
o.StringValue = &v
}
// GetTraceId returns the TraceId field value if set, zero value otherwise.
func (o *EvalScoreReq) GetTraceId() string {
if o == nil || IsNil(o.TraceId) {
var ret string
return ret
}
return *o.TraceId
}
// GetTraceIdOk returns a tuple with the TraceId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EvalScoreReq) GetTraceIdOk() (*string, bool) {
if o == nil || IsNil(o.TraceId) {
return nil, false
}
return o.TraceId, true
}
// HasTraceId returns a boolean if a field has been set.
func (o *EvalScoreReq) HasTraceId() bool {
if o != nil && !IsNil(o.TraceId) {
return true
}
return false
}
// SetTraceId gets a reference to the given string and assigns it to the TraceId field.
func (o *EvalScoreReq) SetTraceId(v string) {
o.TraceId = &v
}
// GetValue returns the Value field value if set, zero value otherwise.
func (o *EvalScoreReq) GetValue() float64 {
if o == nil || IsNil(o.Value) {
var ret float64
return ret
}
return *o.Value
}
// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EvalScoreReq) GetValueOk() (*float64, bool) {
if o == nil || IsNil(o.Value) {
return nil, false
}
return o.Value, true
}
// HasValue returns a boolean if a field has been set.
func (o *EvalScoreReq) HasValue() bool {
if o != nil && !IsNil(o.Value) {
return true
}
return false
}
// SetValue gets a reference to the given float64 and assigns it to the Value field.
func (o *EvalScoreReq) SetValue(v float64) {
o.Value = &v
}
func (o EvalScoreReq) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o EvalScoreReq) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Comment) {
toSerialize["comment"] = o.Comment
}
if !IsNil(o.DataType) {
toSerialize["dataType"] = o.DataType
}
if !IsNil(o.DatasetItemId) {
toSerialize["datasetItemId"] = o.DatasetItemId
}
if !IsNil(o.DatasetName) {
toSerialize["datasetName"] = o.DatasetName
}
toSerialize["name"] = o.Name
if !IsNil(o.RunName) {
toSerialize["runName"] = o.RunName
}
if !IsNil(o.StringValue) {
toSerialize["stringValue"] = o.StringValue
}
if !IsNil(o.TraceId) {
toSerialize["traceId"] = o.TraceId
}
if !IsNil(o.Value) {
toSerialize["value"] = o.Value
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *EvalScoreReq) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"name",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err
}
for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varEvalScoreReq := _EvalScoreReq{}
err = json.Unmarshal(data, &varEvalScoreReq)
if err != nil {
return err
}
*o = EvalScoreReq(varEvalScoreReq)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "comment")
delete(additionalProperties, "dataType")
delete(additionalProperties, "datasetItemId")
delete(additionalProperties, "datasetName")
delete(additionalProperties, "name")
delete(additionalProperties, "runName")
delete(additionalProperties, "stringValue")
delete(additionalProperties, "traceId")
delete(additionalProperties, "value")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableEvalScoreReq struct {
value *EvalScoreReq
isSet bool
}
func (v NullableEvalScoreReq) Get() *EvalScoreReq {
return v.value
}
func (v *NullableEvalScoreReq) Set(val *EvalScoreReq) {
v.value = val
v.isSet = true
}
func (v NullableEvalScoreReq) IsSet() bool {
return v.isSet
}
func (v *NullableEvalScoreReq) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableEvalScoreReq(val *EvalScoreReq) *NullableEvalScoreReq {
return &NullableEvalScoreReq{value: val, isSet: true}
}
func (v NullableEvalScoreReq) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableEvalScoreReq) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}