diff --git a/api/api/model_schema_api_test.go b/api/api/model_schema_api_test.go index 7944e1c82..e5f883107 100644 --- a/api/api/model_schema_api_test.go +++ b/api/api/model_schema_api_test.go @@ -8,6 +8,7 @@ import ( "github.com/caraml-dev/merlin/models" "github.com/caraml-dev/merlin/pkg/errors" + internalValidator "github.com/caraml-dev/merlin/pkg/validator" "github.com/caraml-dev/merlin/service/mocks" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -295,7 +296,8 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { "model_prediction_output": { "prediction_group_id_column": "session_id", "rank_score_column": "score", - "relevance_score": "relevance_score" + "relevance_score": "relevance_score", + "output_class": "RankingOutput" } } }`), @@ -316,6 +318,7 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { PredictionGroudIDColumn: "session_id", RankScoreColumn: "score", RelevanceScoreColumn: "relevance_score", + OutputClass: models.Ranking, }, }, }, @@ -335,6 +338,7 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { PredictionGroudIDColumn: "session_id", RankScoreColumn: "score", RelevanceScoreColumn: "relevance_score", + OutputClass: models.Ranking, }, }, }, @@ -359,6 +363,7 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { PredictionGroudIDColumn: "session_id", RankScoreColumn: "score", RelevanceScoreColumn: "relevance_score", + OutputClass: models.Ranking, }, }, }, @@ -384,7 +389,8 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { "negative_class_label": "negative", "prediction_score_column": "prediction_score", "prediction_label_column": "prediction_label", - "positive_class_label": "positive" + "positive_class_label": "positive", + "output_class": "BinaryClassificationOutput" } } }`), @@ -407,6 +413,7 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { PredictionScoreColumn: "prediction_score", PredictionLabelColumn: "prediction_label", PositiveClassLabel: "positive", + OutputClass: models.BinaryClassification, }, }, }, @@ -428,6 +435,7 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { PredictionScoreColumn: "prediction_score", PredictionLabelColumn: "prediction_label", PositiveClassLabel: "positive", + OutputClass: models.BinaryClassification, }, }, }, @@ -454,6 +462,7 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { PredictionScoreColumn: "prediction_score", PredictionLabelColumn: "prediction_label", PositiveClassLabel: "positive", + OutputClass: models.BinaryClassification, }, }, }, @@ -476,7 +485,8 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { }, "model_prediction_output": { "prediction_score_column": "prediction_score", - "actual_score_column": "actual_score" + "actual_score_column": "actual_score", + "output_class": "RegressionOutput" } } }`), @@ -496,6 +506,7 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { RegressionOutput: &models.RegressionOutput{ PredictionScoreColumn: "prediction_score", ActualScoreColumn: "actual_score", + OutputClass: models.Regression, }, }, }, @@ -514,6 +525,7 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { RegressionOutput: &models.RegressionOutput{ PredictionScoreColumn: "prediction_score", ActualScoreColumn: "actual_score", + OutputClass: models.Regression, }, }, }, @@ -537,6 +549,7 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { RegressionOutput: &models.RegressionOutput{ PredictionScoreColumn: "prediction_score", ActualScoreColumn: "actual_score", + OutputClass: models.Regression, }, }, }, @@ -560,7 +573,8 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { "model_prediction_output": { "prediction_group_id_column": "session_id", "rank_score_column": "score", - "relevance_score": "relevance_score" + "relevance_score": "relevance_score", + "output_class": "RankingOutput" } } }`), @@ -581,6 +595,7 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { PredictionGroudIDColumn: "session_id", RankScoreColumn: "score", RelevanceScoreColumn: "relevance_score", + OutputClass: models.Ranking, }, }, }, @@ -603,12 +618,41 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { var modelSchema *models.ModelSchema err := json.Unmarshal(tt.body, &modelSchema) require.NoError(t, err) + + validate, _ := internalValidator.NewValidator() + err = validate.Struct(modelSchema) + require.NoError(t, err) + resp := ctrl.CreateOrUpdateSchema(&http.Request{}, tt.vars, modelSchema) assertEqualResponses(t, tt.expected, resp) }) } } +func Benchmark_Unmarshal(b *testing.B) { + data := []byte(` { + "prediction_id_column":"prediction_id", + "tag_columns": ["tags"], + "feature_types": { + "featureA": "float64", + "featureB": "int64", + "featureC": "boolean" + }, + "model_prediction_output": { + "actual_label_column": "actual_label", + "negative_class_label": "negative", + "prediction_score_column": "prediction_score", + "prediction_label_column": "prediction_label", + "positive_class_label": "positive", + "output_class": "BinaryClassificationOutput" + } + }`) + for i := 0; i < b.N; i++ { + var schemaSpec models.SchemaSpec + _ = json.Unmarshal(data, &schemaSpec) + } +} + func TestModelSchemaController_DeleteSchema(t *testing.T) { tests := []struct { desc string diff --git a/api/client/api_model_schema.go b/api/client/api_model_schema.go index b0d1cef4e..f13e795c7 100644 --- a/api/client/api_model_schema.go +++ b/api/client/api_model_schema.go @@ -28,7 +28,7 @@ type ApiModelsModelIdSchemasGetRequest struct { modelId int32 } -func (r ApiModelsModelIdSchemasGetRequest) Execute() ([]InferenceSchema, *http.Response, error) { +func (r ApiModelsModelIdSchemasGetRequest) Execute() ([]ModelSchema, *http.Response, error) { return r.ApiService.ModelsModelIdSchemasGetExecute(r) } @@ -49,13 +49,13 @@ func (a *ModelSchemaAPIService) ModelsModelIdSchemasGet(ctx context.Context, mod // Execute executes the request // -// @return []InferenceSchema -func (a *ModelSchemaAPIService) ModelsModelIdSchemasGetExecute(r ApiModelsModelIdSchemasGetRequest) ([]InferenceSchema, *http.Response, error) { +// @return []ModelSchema +func (a *ModelSchemaAPIService) ModelsModelIdSchemasGetExecute(r ApiModelsModelIdSchemasGetRequest) ([]ModelSchema, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue []InferenceSchema + localVarReturnValue []ModelSchema ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelSchemaAPIService.ModelsModelIdSchemasGet") @@ -138,31 +138,31 @@ func (a *ModelSchemaAPIService) ModelsModelIdSchemasGetExecute(r ApiModelsModelI return localVarReturnValue, localVarHTTPResponse, nil } -type ApiModelsModelIdSchemasPostRequest struct { +type ApiModelsModelIdSchemasPutRequest struct { ctx context.Context ApiService *ModelSchemaAPIService modelId int32 - body *InferenceSchema + body *ModelSchema } -func (r ApiModelsModelIdSchemasPostRequest) Body(body InferenceSchema) ApiModelsModelIdSchemasPostRequest { +func (r ApiModelsModelIdSchemasPutRequest) Body(body ModelSchema) ApiModelsModelIdSchemasPutRequest { r.body = &body return r } -func (r ApiModelsModelIdSchemasPostRequest) Execute() (*InferenceSchema, *http.Response, error) { - return r.ApiService.ModelsModelIdSchemasPostExecute(r) +func (r ApiModelsModelIdSchemasPutRequest) Execute() (*ModelSchema, *http.Response, error) { + return r.ApiService.ModelsModelIdSchemasPutExecute(r) } /* -ModelsModelIdSchemasPost Creating new schemas for a model +ModelsModelIdSchemasPut Creating new schemas for a model @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param modelId - @return ApiModelsModelIdSchemasPostRequest + @return ApiModelsModelIdSchemasPutRequest */ -func (a *ModelSchemaAPIService) ModelsModelIdSchemasPost(ctx context.Context, modelId int32) ApiModelsModelIdSchemasPostRequest { - return ApiModelsModelIdSchemasPostRequest{ +func (a *ModelSchemaAPIService) ModelsModelIdSchemasPut(ctx context.Context, modelId int32) ApiModelsModelIdSchemasPutRequest { + return ApiModelsModelIdSchemasPutRequest{ ApiService: a, ctx: ctx, modelId: modelId, @@ -171,16 +171,16 @@ func (a *ModelSchemaAPIService) ModelsModelIdSchemasPost(ctx context.Context, mo // Execute executes the request // -// @return InferenceSchema -func (a *ModelSchemaAPIService) ModelsModelIdSchemasPostExecute(r ApiModelsModelIdSchemasPostRequest) (*InferenceSchema, *http.Response, error) { +// @return ModelSchema +func (a *ModelSchemaAPIService) ModelsModelIdSchemasPutExecute(r ApiModelsModelIdSchemasPutRequest) (*ModelSchema, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *InferenceSchema + localVarReturnValue *ModelSchema ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelSchemaAPIService.ModelsModelIdSchemasPost") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelSchemaAPIService.ModelsModelIdSchemasPut") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -262,6 +262,114 @@ func (a *ModelSchemaAPIService) ModelsModelIdSchemasPostExecute(r ApiModelsModel return localVarReturnValue, localVarHTTPResponse, nil } +type ApiModelsModelIdSchemasSchemaIdDeleteRequest struct { + ctx context.Context + ApiService *ModelSchemaAPIService + modelId int32 + schemaId int32 +} + +func (r ApiModelsModelIdSchemasSchemaIdDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.ModelsModelIdSchemasSchemaIdDeleteExecute(r) +} + +/* +ModelsModelIdSchemasSchemaIdDelete Delete schema + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param modelId + @param schemaId + @return ApiModelsModelIdSchemasSchemaIdDeleteRequest +*/ +func (a *ModelSchemaAPIService) ModelsModelIdSchemasSchemaIdDelete(ctx context.Context, modelId int32, schemaId int32) ApiModelsModelIdSchemasSchemaIdDeleteRequest { + return ApiModelsModelIdSchemasSchemaIdDeleteRequest{ + ApiService: a, + ctx: ctx, + modelId: modelId, + schemaId: schemaId, + } +} + +// Execute executes the request +func (a *ModelSchemaAPIService) ModelsModelIdSchemasSchemaIdDeleteExecute(r ApiModelsModelIdSchemasSchemaIdDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelSchemaAPIService.ModelsModelIdSchemasSchemaIdDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/models/{model_id}/schemas/{schema_id}" + localVarPath = strings.Replace(localVarPath, "{"+"model_id"+"}", url.PathEscape(parameterValueToString(r.modelId, "modelId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"schema_id"+"}", url.PathEscape(parameterValueToString(r.schemaId, "schemaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + type ApiModelsModelIdSchemasSchemaIdGetRequest struct { ctx context.Context ApiService *ModelSchemaAPIService @@ -269,7 +377,7 @@ type ApiModelsModelIdSchemasSchemaIdGetRequest struct { schemaId int32 } -func (r ApiModelsModelIdSchemasSchemaIdGetRequest) Execute() (*InferenceSchema, *http.Response, error) { +func (r ApiModelsModelIdSchemasSchemaIdGetRequest) Execute() (*ModelSchema, *http.Response, error) { return r.ApiService.ModelsModelIdSchemasSchemaIdGetExecute(r) } @@ -292,13 +400,13 @@ func (a *ModelSchemaAPIService) ModelsModelIdSchemasSchemaIdGet(ctx context.Cont // Execute executes the request // -// @return InferenceSchema -func (a *ModelSchemaAPIService) ModelsModelIdSchemasSchemaIdGetExecute(r ApiModelsModelIdSchemasSchemaIdGetRequest) (*InferenceSchema, *http.Response, error) { +// @return ModelSchema +func (a *ModelSchemaAPIService) ModelsModelIdSchemasSchemaIdGetExecute(r ApiModelsModelIdSchemasSchemaIdGetRequest) (*ModelSchema, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *InferenceSchema + localVarReturnValue *ModelSchema ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelSchemaAPIService.ModelsModelIdSchemasSchemaIdGet") diff --git a/api/client/model_autoscaling_policy.go b/api/client/model_autoscaling_policy.go index a67f07a2f..d636c1217 100644 --- a/api/client/model_autoscaling_policy.go +++ b/api/client/model_autoscaling_policy.go @@ -12,6 +12,7 @@ package client import ( "encoding/json" + "fmt" ) // checks if the AutoscalingPolicy type satisfies the MappedNullable interface at compile time @@ -19,16 +20,20 @@ var _ MappedNullable = &AutoscalingPolicy{} // AutoscalingPolicy struct for AutoscalingPolicy type AutoscalingPolicy struct { - MetricsType *MetricsType `json:"metrics_type,omitempty"` - TargetValue *float32 `json:"target_value,omitempty"` + MetricsType MetricsType `json:"metrics_type"` + TargetValue float32 `json:"target_value"` } +type _AutoscalingPolicy AutoscalingPolicy + // NewAutoscalingPolicy instantiates a new AutoscalingPolicy 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 NewAutoscalingPolicy() *AutoscalingPolicy { +func NewAutoscalingPolicy(metricsType MetricsType, targetValue float32) *AutoscalingPolicy { this := AutoscalingPolicy{} + this.MetricsType = metricsType + this.TargetValue = targetValue return &this } @@ -40,68 +45,52 @@ func NewAutoscalingPolicyWithDefaults() *AutoscalingPolicy { return &this } -// GetMetricsType returns the MetricsType field value if set, zero value otherwise. +// GetMetricsType returns the MetricsType field value func (o *AutoscalingPolicy) GetMetricsType() MetricsType { - if o == nil || IsNil(o.MetricsType) { + if o == nil { var ret MetricsType return ret } - return *o.MetricsType + + return o.MetricsType } -// GetMetricsTypeOk returns a tuple with the MetricsType field value if set, nil otherwise +// GetMetricsTypeOk returns a tuple with the MetricsType field value // and a boolean to check if the value has been set. func (o *AutoscalingPolicy) GetMetricsTypeOk() (*MetricsType, bool) { - if o == nil || IsNil(o.MetricsType) { + if o == nil { return nil, false } - return o.MetricsType, true + return &o.MetricsType, true } -// HasMetricsType returns a boolean if a field has been set. -func (o *AutoscalingPolicy) HasMetricsType() bool { - if o != nil && !IsNil(o.MetricsType) { - return true - } - - return false -} - -// SetMetricsType gets a reference to the given MetricsType and assigns it to the MetricsType field. +// SetMetricsType sets field value func (o *AutoscalingPolicy) SetMetricsType(v MetricsType) { - o.MetricsType = &v + o.MetricsType = v } -// GetTargetValue returns the TargetValue field value if set, zero value otherwise. +// GetTargetValue returns the TargetValue field value func (o *AutoscalingPolicy) GetTargetValue() float32 { - if o == nil || IsNil(o.TargetValue) { + if o == nil { var ret float32 return ret } - return *o.TargetValue + + return o.TargetValue } -// GetTargetValueOk returns a tuple with the TargetValue field value if set, nil otherwise +// GetTargetValueOk returns a tuple with the TargetValue field value // and a boolean to check if the value has been set. func (o *AutoscalingPolicy) GetTargetValueOk() (*float32, bool) { - if o == nil || IsNil(o.TargetValue) { + if o == nil { return nil, false } - return o.TargetValue, true + return &o.TargetValue, true } -// HasTargetValue returns a boolean if a field has been set. -func (o *AutoscalingPolicy) HasTargetValue() bool { - if o != nil && !IsNil(o.TargetValue) { - return true - } - - return false -} - -// SetTargetValue gets a reference to the given float32 and assigns it to the TargetValue field. +// SetTargetValue sets field value func (o *AutoscalingPolicy) SetTargetValue(v float32) { - o.TargetValue = &v + o.TargetValue = v } func (o AutoscalingPolicy) MarshalJSON() ([]byte, error) { @@ -114,13 +103,45 @@ func (o AutoscalingPolicy) MarshalJSON() ([]byte, error) { func (o AutoscalingPolicy) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.MetricsType) { - toSerialize["metrics_type"] = o.MetricsType + toSerialize["metrics_type"] = o.MetricsType + toSerialize["target_value"] = o.TargetValue + return toSerialize, nil +} + +func (o *AutoscalingPolicy) UnmarshalJSON(bytes []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{ + "metrics_type", + "target_value", } - if !IsNil(o.TargetValue) { - toSerialize["target_value"] = o.TargetValue + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(bytes, &allProperties) + + if err != nil { + return err } - return toSerialize, nil + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAutoscalingPolicy := _AutoscalingPolicy{} + + err = json.Unmarshal(bytes, &varAutoscalingPolicy) + + if err != nil { + return err + } + + *o = AutoscalingPolicy(varAutoscalingPolicy) + + return err } type NullableAutoscalingPolicy struct { diff --git a/api/client/model_binary_classification_output.go b/api/client/model_binary_classification_output.go index 383c19533..a75023589 100644 --- a/api/client/model_binary_classification_output.go +++ b/api/client/model_binary_classification_output.go @@ -12,6 +12,7 @@ package client import ( "encoding/json" + "fmt" ) // checks if the BinaryClassificationOutput type satisfies the MappedNullable interface at compile time @@ -19,19 +20,26 @@ var _ MappedNullable = &BinaryClassificationOutput{} // BinaryClassificationOutput struct for BinaryClassificationOutput type BinaryClassificationOutput struct { - PredictionScoreColumn *string `json:"prediction_score_column,omitempty"` - ActualLabelColumn *string `json:"actual_label_column,omitempty"` - PositiveClassLabel *string `json:"positive_class_label,omitempty"` - NegativeClassLabel *string `json:"negative_class_label,omitempty"` - ScoreThreshold *float32 `json:"score_threshold,omitempty"` + PredictionScoreColumn string `json:"prediction_score_column"` + ActualLabelColumn *string `json:"actual_label_column,omitempty"` + PositiveClassLabel string `json:"positive_class_label"` + NegativeClassLabel string `json:"negative_class_label"` + ScoreThreshold *float32 `json:"score_threshold,omitempty"` + OutputClass ModelPredictionOutputClass `json:"output_class"` } +type _BinaryClassificationOutput BinaryClassificationOutput + // NewBinaryClassificationOutput instantiates a new BinaryClassificationOutput 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 NewBinaryClassificationOutput() *BinaryClassificationOutput { +func NewBinaryClassificationOutput(predictionScoreColumn string, positiveClassLabel string, negativeClassLabel string, outputClass ModelPredictionOutputClass) *BinaryClassificationOutput { this := BinaryClassificationOutput{} + this.PredictionScoreColumn = predictionScoreColumn + this.PositiveClassLabel = positiveClassLabel + this.NegativeClassLabel = negativeClassLabel + this.OutputClass = outputClass return &this } @@ -43,36 +51,28 @@ func NewBinaryClassificationOutputWithDefaults() *BinaryClassificationOutput { return &this } -// GetPredictionScoreColumn returns the PredictionScoreColumn field value if set, zero value otherwise. +// GetPredictionScoreColumn returns the PredictionScoreColumn field value func (o *BinaryClassificationOutput) GetPredictionScoreColumn() string { - if o == nil || IsNil(o.PredictionScoreColumn) { + if o == nil { var ret string return ret } - return *o.PredictionScoreColumn + + return o.PredictionScoreColumn } -// GetPredictionScoreColumnOk returns a tuple with the PredictionScoreColumn field value if set, nil otherwise +// GetPredictionScoreColumnOk returns a tuple with the PredictionScoreColumn field value // and a boolean to check if the value has been set. func (o *BinaryClassificationOutput) GetPredictionScoreColumnOk() (*string, bool) { - if o == nil || IsNil(o.PredictionScoreColumn) { + if o == nil { return nil, false } - return o.PredictionScoreColumn, true -} - -// HasPredictionScoreColumn returns a boolean if a field has been set. -func (o *BinaryClassificationOutput) HasPredictionScoreColumn() bool { - if o != nil && !IsNil(o.PredictionScoreColumn) { - return true - } - - return false + return &o.PredictionScoreColumn, true } -// SetPredictionScoreColumn gets a reference to the given string and assigns it to the PredictionScoreColumn field. +// SetPredictionScoreColumn sets field value func (o *BinaryClassificationOutput) SetPredictionScoreColumn(v string) { - o.PredictionScoreColumn = &v + o.PredictionScoreColumn = v } // GetActualLabelColumn returns the ActualLabelColumn field value if set, zero value otherwise. @@ -107,68 +107,52 @@ func (o *BinaryClassificationOutput) SetActualLabelColumn(v string) { o.ActualLabelColumn = &v } -// GetPositiveClassLabel returns the PositiveClassLabel field value if set, zero value otherwise. +// GetPositiveClassLabel returns the PositiveClassLabel field value func (o *BinaryClassificationOutput) GetPositiveClassLabel() string { - if o == nil || IsNil(o.PositiveClassLabel) { + if o == nil { var ret string return ret } - return *o.PositiveClassLabel + + return o.PositiveClassLabel } -// GetPositiveClassLabelOk returns a tuple with the PositiveClassLabel field value if set, nil otherwise +// GetPositiveClassLabelOk returns a tuple with the PositiveClassLabel field value // and a boolean to check if the value has been set. func (o *BinaryClassificationOutput) GetPositiveClassLabelOk() (*string, bool) { - if o == nil || IsNil(o.PositiveClassLabel) { + if o == nil { return nil, false } - return o.PositiveClassLabel, true + return &o.PositiveClassLabel, true } -// HasPositiveClassLabel returns a boolean if a field has been set. -func (o *BinaryClassificationOutput) HasPositiveClassLabel() bool { - if o != nil && !IsNil(o.PositiveClassLabel) { - return true - } - - return false -} - -// SetPositiveClassLabel gets a reference to the given string and assigns it to the PositiveClassLabel field. +// SetPositiveClassLabel sets field value func (o *BinaryClassificationOutput) SetPositiveClassLabel(v string) { - o.PositiveClassLabel = &v + o.PositiveClassLabel = v } -// GetNegativeClassLabel returns the NegativeClassLabel field value if set, zero value otherwise. +// GetNegativeClassLabel returns the NegativeClassLabel field value func (o *BinaryClassificationOutput) GetNegativeClassLabel() string { - if o == nil || IsNil(o.NegativeClassLabel) { + if o == nil { var ret string return ret } - return *o.NegativeClassLabel + + return o.NegativeClassLabel } -// GetNegativeClassLabelOk returns a tuple with the NegativeClassLabel field value if set, nil otherwise +// GetNegativeClassLabelOk returns a tuple with the NegativeClassLabel field value // and a boolean to check if the value has been set. func (o *BinaryClassificationOutput) GetNegativeClassLabelOk() (*string, bool) { - if o == nil || IsNil(o.NegativeClassLabel) { + if o == nil { return nil, false } - return o.NegativeClassLabel, true + return &o.NegativeClassLabel, true } -// HasNegativeClassLabel returns a boolean if a field has been set. -func (o *BinaryClassificationOutput) HasNegativeClassLabel() bool { - if o != nil && !IsNil(o.NegativeClassLabel) { - return true - } - - return false -} - -// SetNegativeClassLabel gets a reference to the given string and assigns it to the NegativeClassLabel field. +// SetNegativeClassLabel sets field value func (o *BinaryClassificationOutput) SetNegativeClassLabel(v string) { - o.NegativeClassLabel = &v + o.NegativeClassLabel = v } // GetScoreThreshold returns the ScoreThreshold field value if set, zero value otherwise. @@ -203,6 +187,30 @@ func (o *BinaryClassificationOutput) SetScoreThreshold(v float32) { o.ScoreThreshold = &v } +// GetOutputClass returns the OutputClass field value +func (o *BinaryClassificationOutput) GetOutputClass() ModelPredictionOutputClass { + if o == nil { + var ret ModelPredictionOutputClass + return ret + } + + return o.OutputClass +} + +// GetOutputClassOk returns a tuple with the OutputClass field value +// and a boolean to check if the value has been set. +func (o *BinaryClassificationOutput) GetOutputClassOk() (*ModelPredictionOutputClass, bool) { + if o == nil { + return nil, false + } + return &o.OutputClass, true +} + +// SetOutputClass sets field value +func (o *BinaryClassificationOutput) SetOutputClass(v ModelPredictionOutputClass) { + o.OutputClass = v +} + func (o BinaryClassificationOutput) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -213,24 +221,57 @@ func (o BinaryClassificationOutput) MarshalJSON() ([]byte, error) { func (o BinaryClassificationOutput) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.PredictionScoreColumn) { - toSerialize["prediction_score_column"] = o.PredictionScoreColumn - } + toSerialize["prediction_score_column"] = o.PredictionScoreColumn if !IsNil(o.ActualLabelColumn) { toSerialize["actual_label_column"] = o.ActualLabelColumn } - if !IsNil(o.PositiveClassLabel) { - toSerialize["positive_class_label"] = o.PositiveClassLabel - } - if !IsNil(o.NegativeClassLabel) { - toSerialize["negative_class_label"] = o.NegativeClassLabel - } + toSerialize["positive_class_label"] = o.PositiveClassLabel + toSerialize["negative_class_label"] = o.NegativeClassLabel if !IsNil(o.ScoreThreshold) { toSerialize["score_threshold"] = o.ScoreThreshold } + toSerialize["output_class"] = o.OutputClass return toSerialize, nil } +func (o *BinaryClassificationOutput) UnmarshalJSON(bytes []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{ + "prediction_score_column", + "positive_class_label", + "negative_class_label", + "output_class", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(bytes, &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) + } + } + + varBinaryClassificationOutput := _BinaryClassificationOutput{} + + err = json.Unmarshal(bytes, &varBinaryClassificationOutput) + + if err != nil { + return err + } + + *o = BinaryClassificationOutput(varBinaryClassificationOutput) + + return err +} + type NullableBinaryClassificationOutput struct { value *BinaryClassificationOutput isSet bool diff --git a/api/client/model_environment.go b/api/client/model_environment.go index 36750bc8d..5589468df 100644 --- a/api/client/model_environment.go +++ b/api/client/model_environment.go @@ -23,7 +23,7 @@ var _ MappedNullable = &Environment{} type Environment struct { Id *int32 `json:"id,omitempty"` Name string `json:"name"` - Cluster *string `json:"cluster,omitempty"` + Cluster string `json:"cluster"` IsDefault *bool `json:"is_default,omitempty"` Region *string `json:"region,omitempty"` GcpProject *string `json:"gcp_project,omitempty"` @@ -41,9 +41,10 @@ type _Environment Environment // 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 NewEnvironment(name string) *Environment { +func NewEnvironment(name string, cluster string) *Environment { this := Environment{} this.Name = name + this.Cluster = cluster return &this } @@ -111,36 +112,28 @@ func (o *Environment) SetName(v string) { o.Name = v } -// GetCluster returns the Cluster field value if set, zero value otherwise. +// GetCluster returns the Cluster field value func (o *Environment) GetCluster() string { - if o == nil || IsNil(o.Cluster) { + if o == nil { var ret string return ret } - return *o.Cluster + + return o.Cluster } -// GetClusterOk returns a tuple with the Cluster field value if set, nil otherwise +// GetClusterOk returns a tuple with the Cluster field value // and a boolean to check if the value has been set. func (o *Environment) GetClusterOk() (*string, bool) { - if o == nil || IsNil(o.Cluster) { + if o == nil { return nil, false } - return o.Cluster, true -} - -// HasCluster returns a boolean if a field has been set. -func (o *Environment) HasCluster() bool { - if o != nil && !IsNil(o.Cluster) { - return true - } - - return false + return &o.Cluster, true } -// SetCluster gets a reference to the given string and assigns it to the Cluster field. +// SetCluster sets field value func (o *Environment) SetCluster(v string) { - o.Cluster = &v + o.Cluster = v } // GetIsDefault returns the IsDefault field value if set, zero value otherwise. @@ -445,9 +438,7 @@ func (o Environment) ToMap() (map[string]interface{}, error) { toSerialize["id"] = o.Id } toSerialize["name"] = o.Name - if !IsNil(o.Cluster) { - toSerialize["cluster"] = o.Cluster - } + toSerialize["cluster"] = o.Cluster if !IsNil(o.IsDefault) { toSerialize["is_default"] = o.IsDefault } @@ -484,6 +475,7 @@ func (o *Environment) UnmarshalJSON(bytes []byte) (err error) { // that every required field exists as a key in the generic map. requiredProperties := []string{ "name", + "cluster", } allProperties := make(map[string]interface{}) diff --git a/api/client/model_inference_schema.go b/api/client/model_inference_schema.go deleted file mode 100644 index 075dbf7df..000000000 --- a/api/client/model_inference_schema.go +++ /dev/null @@ -1,160 +0,0 @@ -/* -Merlin - -API Guide for accessing Merlin's model management, deployment, and serving functionalities - -API version: 0.14.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "encoding/json" -) - -// checks if the InferenceSchema type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &InferenceSchema{} - -// InferenceSchema struct for InferenceSchema -type InferenceSchema struct { - Id *int32 `json:"id,omitempty"` - Schema *Schema `json:"schema,omitempty"` -} - -// NewInferenceSchema instantiates a new InferenceSchema 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 NewInferenceSchema() *InferenceSchema { - this := InferenceSchema{} - return &this -} - -// NewInferenceSchemaWithDefaults instantiates a new InferenceSchema 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 NewInferenceSchemaWithDefaults() *InferenceSchema { - this := InferenceSchema{} - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *InferenceSchema) GetId() int32 { - if o == nil || IsNil(o.Id) { - var ret int32 - 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 *InferenceSchema) GetIdOk() (*int32, 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 *InferenceSchema) HasId() bool { - if o != nil && !IsNil(o.Id) { - return true - } - - return false -} - -// SetId gets a reference to the given int32 and assigns it to the Id field. -func (o *InferenceSchema) SetId(v int32) { - o.Id = &v -} - -// GetSchema returns the Schema field value if set, zero value otherwise. -func (o *InferenceSchema) GetSchema() Schema { - if o == nil || IsNil(o.Schema) { - var ret Schema - return ret - } - return *o.Schema -} - -// GetSchemaOk returns a tuple with the Schema field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InferenceSchema) GetSchemaOk() (*Schema, bool) { - if o == nil || IsNil(o.Schema) { - return nil, false - } - return o.Schema, true -} - -// HasSchema returns a boolean if a field has been set. -func (o *InferenceSchema) HasSchema() bool { - if o != nil && !IsNil(o.Schema) { - return true - } - - return false -} - -// SetSchema gets a reference to the given Schema and assigns it to the Schema field. -func (o *InferenceSchema) SetSchema(v Schema) { - o.Schema = &v -} - -func (o InferenceSchema) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o InferenceSchema) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.Id) { - toSerialize["id"] = o.Id - } - if !IsNil(o.Schema) { - toSerialize["schema"] = o.Schema - } - return toSerialize, nil -} - -type NullableInferenceSchema struct { - value *InferenceSchema - isSet bool -} - -func (v NullableInferenceSchema) Get() *InferenceSchema { - return v.value -} - -func (v *NullableInferenceSchema) Set(val *InferenceSchema) { - v.value = val - v.isSet = true -} - -func (v NullableInferenceSchema) IsSet() bool { - return v.isSet -} - -func (v *NullableInferenceSchema) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInferenceSchema(val *InferenceSchema) *NullableInferenceSchema { - return &NullableInferenceSchema{value: val, isSet: true} -} - -func (v NullableInferenceSchema) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInferenceSchema) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/client/model_logger_config.go b/api/client/model_logger_config.go index e6f6eb0aa..7d567e303 100644 --- a/api/client/model_logger_config.go +++ b/api/client/model_logger_config.go @@ -12,6 +12,7 @@ package client import ( "encoding/json" + "fmt" ) // checks if the LoggerConfig type satisfies the MappedNullable interface at compile time @@ -19,16 +20,20 @@ var _ MappedNullable = &LoggerConfig{} // LoggerConfig struct for LoggerConfig type LoggerConfig struct { - Enabled *bool `json:"enabled,omitempty"` - Mode *LoggerMode `json:"mode,omitempty"` + Enabled bool `json:"enabled"` + Mode LoggerMode `json:"mode"` } +type _LoggerConfig LoggerConfig + // NewLoggerConfig instantiates a new LoggerConfig 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 NewLoggerConfig() *LoggerConfig { +func NewLoggerConfig(enabled bool, mode LoggerMode) *LoggerConfig { this := LoggerConfig{} + this.Enabled = enabled + this.Mode = mode return &this } @@ -40,68 +45,52 @@ func NewLoggerConfigWithDefaults() *LoggerConfig { return &this } -// GetEnabled returns the Enabled field value if set, zero value otherwise. +// GetEnabled returns the Enabled field value func (o *LoggerConfig) GetEnabled() bool { - if o == nil || IsNil(o.Enabled) { + if o == nil { var ret bool return ret } - return *o.Enabled + + return o.Enabled } -// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// GetEnabledOk returns a tuple with the Enabled field value // and a boolean to check if the value has been set. func (o *LoggerConfig) GetEnabledOk() (*bool, bool) { - if o == nil || IsNil(o.Enabled) { + if o == nil { return nil, false } - return o.Enabled, true + return &o.Enabled, true } -// HasEnabled returns a boolean if a field has been set. -func (o *LoggerConfig) HasEnabled() bool { - if o != nil && !IsNil(o.Enabled) { - return true - } - - return false -} - -// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +// SetEnabled sets field value func (o *LoggerConfig) SetEnabled(v bool) { - o.Enabled = &v + o.Enabled = v } -// GetMode returns the Mode field value if set, zero value otherwise. +// GetMode returns the Mode field value func (o *LoggerConfig) GetMode() LoggerMode { - if o == nil || IsNil(o.Mode) { + if o == nil { var ret LoggerMode return ret } - return *o.Mode + + return o.Mode } -// GetModeOk returns a tuple with the Mode field value if set, nil otherwise +// GetModeOk returns a tuple with the Mode field value // and a boolean to check if the value has been set. func (o *LoggerConfig) GetModeOk() (*LoggerMode, bool) { - if o == nil || IsNil(o.Mode) { + if o == nil { return nil, false } - return o.Mode, true + return &o.Mode, true } -// HasMode returns a boolean if a field has been set. -func (o *LoggerConfig) HasMode() bool { - if o != nil && !IsNil(o.Mode) { - return true - } - - return false -} - -// SetMode gets a reference to the given LoggerMode and assigns it to the Mode field. +// SetMode sets field value func (o *LoggerConfig) SetMode(v LoggerMode) { - o.Mode = &v + o.Mode = v } func (o LoggerConfig) MarshalJSON() ([]byte, error) { @@ -114,13 +103,45 @@ func (o LoggerConfig) MarshalJSON() ([]byte, error) { func (o LoggerConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Enabled) { - toSerialize["enabled"] = o.Enabled + toSerialize["enabled"] = o.Enabled + toSerialize["mode"] = o.Mode + return toSerialize, nil +} + +func (o *LoggerConfig) UnmarshalJSON(bytes []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{ + "enabled", + "mode", } - if !IsNil(o.Mode) { - toSerialize["mode"] = o.Mode + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(bytes, &allProperties) + + if err != nil { + return err } - return toSerialize, nil + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varLoggerConfig := _LoggerConfig{} + + err = json.Unmarshal(bytes, &varLoggerConfig) + + if err != nil { + return err + } + + *o = LoggerConfig(varLoggerConfig) + + return err } type NullableLoggerConfig struct { diff --git a/api/client/model_model.go b/api/client/model_model.go index 035e3f7db..179aff7d2 100644 --- a/api/client/model_model.go +++ b/api/client/model_model.go @@ -12,6 +12,7 @@ package client import ( "encoding/json" + "fmt" "time" ) @@ -20,10 +21,10 @@ var _ MappedNullable = &Model{} // Model struct for Model type Model struct { - Id *int32 `json:"id,omitempty"` - ProjectId *int32 `json:"project_id,omitempty"` - MlflowExperimentId *int32 `json:"mlflow_experiment_id,omitempty"` - Name *string `json:"name,omitempty"` + Id *int32 `json:"id,omitempty"` + ProjectId *int32 `json:"project_id,omitempty"` + MlflowExperimentId *int32 `json:"mlflow_experiment_id,omitempty"` + Name string `json:"name"` // Model type Type *string `json:"type,omitempty"` MlflowUrl *string `json:"mlflow_url,omitempty"` @@ -32,12 +33,15 @@ type Model struct { UpdatedAt *time.Time `json:"updated_at,omitempty"` } +type _Model Model + // NewModel instantiates a new Model 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 NewModel() *Model { +func NewModel(name string) *Model { this := Model{} + this.Name = name return &this } @@ -145,36 +149,28 @@ func (o *Model) SetMlflowExperimentId(v int32) { o.MlflowExperimentId = &v } -// GetName returns the Name field value if set, zero value otherwise. +// GetName returns the Name field value func (o *Model) GetName() string { - if o == nil || IsNil(o.Name) { + if o == nil { var ret string return ret } - return *o.Name + + return o.Name } -// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. func (o *Model) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { + if o == nil { return nil, false } - return o.Name, true + return &o.Name, true } -// HasName returns a boolean if a field has been set. -func (o *Model) HasName() bool { - if o != nil && !IsNil(o.Name) { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName sets field value func (o *Model) SetName(v string) { - o.Name = &v + o.Name = v } // GetType returns the Type field value if set, zero value otherwise. @@ -356,9 +352,7 @@ func (o Model) ToMap() (map[string]interface{}, error) { if !IsNil(o.MlflowExperimentId) { toSerialize["mlflow_experiment_id"] = o.MlflowExperimentId } - if !IsNil(o.Name) { - toSerialize["name"] = o.Name - } + toSerialize["name"] = o.Name if !IsNil(o.Type) { toSerialize["type"] = o.Type } @@ -377,6 +371,41 @@ func (o Model) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *Model) UnmarshalJSON(bytes []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(bytes, &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) + } + } + + varModel := _Model{} + + err = json.Unmarshal(bytes, &varModel) + + if err != nil { + return err + } + + *o = Model(varModel) + + return err +} + type NullableModel struct { value *Model isSet bool diff --git a/api/client/model_model_prediction_output.go b/api/client/model_model_prediction_output.go index 47b5a3721..3e0d72e8b 100644 --- a/api/client/model_model_prediction_output.go +++ b/api/client/model_model_prediction_output.go @@ -19,6 +19,7 @@ import ( type ModelPredictionOutput struct { BinaryClassificationOutput *BinaryClassificationOutput RankingOutput *RankingOutput + RegressionOutput *RegressionOutput } // BinaryClassificationOutputAsModelPredictionOutput is a convenience function that returns BinaryClassificationOutput wrapped in ModelPredictionOutput @@ -35,6 +36,13 @@ func RankingOutputAsModelPredictionOutput(v *RankingOutput) ModelPredictionOutpu } } +// RegressionOutputAsModelPredictionOutput is a convenience function that returns RegressionOutput wrapped in ModelPredictionOutput +func RegressionOutputAsModelPredictionOutput(v *RegressionOutput) ModelPredictionOutput { + return ModelPredictionOutput{ + RegressionOutput: v, + } +} + // Unmarshal JSON data into one of the pointers in the struct func (dst *ModelPredictionOutput) UnmarshalJSON(data []byte) error { var err error @@ -65,10 +73,24 @@ func (dst *ModelPredictionOutput) UnmarshalJSON(data []byte) error { dst.RankingOutput = nil } + // try to unmarshal data into RegressionOutput + err = newStrictDecoder(data).Decode(&dst.RegressionOutput) + if err == nil { + jsonRegressionOutput, _ := json.Marshal(dst.RegressionOutput) + if string(jsonRegressionOutput) == "{}" { // empty struct + dst.RegressionOutput = nil + } else { + match++ + } + } else { + dst.RegressionOutput = nil + } + if match > 1 { // more than 1 match // reset to nil dst.BinaryClassificationOutput = nil dst.RankingOutput = nil + dst.RegressionOutput = nil return fmt.Errorf("data matches more than one schema in oneOf(ModelPredictionOutput)") } else if match == 1 { @@ -88,6 +110,10 @@ func (src ModelPredictionOutput) MarshalJSON() ([]byte, error) { return json.Marshal(&src.RankingOutput) } + if src.RegressionOutput != nil { + return json.Marshal(&src.RegressionOutput) + } + return nil, nil // no data in oneOf schemas } @@ -104,6 +130,10 @@ func (obj *ModelPredictionOutput) GetActualInstance() interface{} { return obj.RankingOutput } + if obj.RegressionOutput != nil { + return obj.RegressionOutput + } + // all schemas are nil return nil } diff --git a/api/client/model_model_prediction_output_class.go b/api/client/model_model_prediction_output_class.go new file mode 100644 index 000000000..56ca67f11 --- /dev/null +++ b/api/client/model_model_prediction_output_class.go @@ -0,0 +1,112 @@ +/* +Merlin + +API Guide for accessing Merlin's model management, deployment, and serving functionalities + +API version: 0.14.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// ModelPredictionOutputClass the model 'ModelPredictionOutputClass' +type ModelPredictionOutputClass string + +// List of ModelPredictionOutputClass +const ( + MODELPREDICTIONOUTPUTCLASS_BINARY_CLASSIFICATION_OUTPUT ModelPredictionOutputClass = "BinaryClassificationOutput" + MODELPREDICTIONOUTPUTCLASS_RANKING_OUTPUT ModelPredictionOutputClass = "RankingOutput" + MODELPREDICTIONOUTPUTCLASS_REGRESSION_OUTPUT ModelPredictionOutputClass = "RegressionOutput" +) + +// All allowed values of ModelPredictionOutputClass enum +var AllowedModelPredictionOutputClassEnumValues = []ModelPredictionOutputClass{ + "BinaryClassificationOutput", + "RankingOutput", + "RegressionOutput", +} + +func (v *ModelPredictionOutputClass) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ModelPredictionOutputClass(value) + for _, existing := range AllowedModelPredictionOutputClassEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ModelPredictionOutputClass", value) +} + +// NewModelPredictionOutputClassFromValue returns a pointer to a valid ModelPredictionOutputClass +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewModelPredictionOutputClassFromValue(v string) (*ModelPredictionOutputClass, error) { + ev := ModelPredictionOutputClass(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ModelPredictionOutputClass: valid values are %v", v, AllowedModelPredictionOutputClassEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ModelPredictionOutputClass) IsValid() bool { + for _, existing := range AllowedModelPredictionOutputClassEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ModelPredictionOutputClass value +func (v ModelPredictionOutputClass) Ptr() *ModelPredictionOutputClass { + return &v +} + +type NullableModelPredictionOutputClass struct { + value *ModelPredictionOutputClass + isSet bool +} + +func (v NullableModelPredictionOutputClass) Get() *ModelPredictionOutputClass { + return v.value +} + +func (v *NullableModelPredictionOutputClass) Set(val *ModelPredictionOutputClass) { + v.value = val + v.isSet = true +} + +func (v NullableModelPredictionOutputClass) IsSet() bool { + return v.isSet +} + +func (v *NullableModelPredictionOutputClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelPredictionOutputClass(val *ModelPredictionOutputClass) *NullableModelPredictionOutputClass { + return &NullableModelPredictionOutputClass{value: val, isSet: true} +} + +func (v NullableModelPredictionOutputClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelPredictionOutputClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/client/model_model_schema.go b/api/client/model_model_schema.go new file mode 100644 index 000000000..4402fe03c --- /dev/null +++ b/api/client/model_model_schema.go @@ -0,0 +1,225 @@ +/* +Merlin + +API Guide for accessing Merlin's model management, deployment, and serving functionalities + +API version: 0.14.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// checks if the ModelSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelSchema{} + +// ModelSchema struct for ModelSchema +type ModelSchema struct { + Id *int32 `json:"id,omitempty"` + ModelId *int32 `json:"model_id,omitempty"` + Spec SchemaSpec `json:"spec"` +} + +type _ModelSchema ModelSchema + +// NewModelSchema instantiates a new ModelSchema 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 NewModelSchema(spec SchemaSpec) *ModelSchema { + this := ModelSchema{} + this.Spec = spec + return &this +} + +// NewModelSchemaWithDefaults instantiates a new ModelSchema 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 NewModelSchemaWithDefaults() *ModelSchema { + this := ModelSchema{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ModelSchema) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + 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 *ModelSchema) GetIdOk() (*int32, 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 *ModelSchema) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *ModelSchema) SetId(v int32) { + o.Id = &v +} + +// GetModelId returns the ModelId field value if set, zero value otherwise. +func (o *ModelSchema) GetModelId() int32 { + if o == nil || IsNil(o.ModelId) { + var ret int32 + return ret + } + return *o.ModelId +} + +// GetModelIdOk returns a tuple with the ModelId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelSchema) GetModelIdOk() (*int32, bool) { + if o == nil || IsNil(o.ModelId) { + return nil, false + } + return o.ModelId, true +} + +// HasModelId returns a boolean if a field has been set. +func (o *ModelSchema) HasModelId() bool { + if o != nil && !IsNil(o.ModelId) { + return true + } + + return false +} + +// SetModelId gets a reference to the given int32 and assigns it to the ModelId field. +func (o *ModelSchema) SetModelId(v int32) { + o.ModelId = &v +} + +// GetSpec returns the Spec field value +func (o *ModelSchema) GetSpec() SchemaSpec { + if o == nil { + var ret SchemaSpec + return ret + } + + return o.Spec +} + +// GetSpecOk returns a tuple with the Spec field value +// and a boolean to check if the value has been set. +func (o *ModelSchema) GetSpecOk() (*SchemaSpec, bool) { + if o == nil { + return nil, false + } + return &o.Spec, true +} + +// SetSpec sets field value +func (o *ModelSchema) SetSpec(v SchemaSpec) { + o.Spec = v +} + +func (o ModelSchema) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.ModelId) { + toSerialize["model_id"] = o.ModelId + } + toSerialize["spec"] = o.Spec + return toSerialize, nil +} + +func (o *ModelSchema) UnmarshalJSON(bytes []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{ + "spec", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(bytes, &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) + } + } + + varModelSchema := _ModelSchema{} + + err = json.Unmarshal(bytes, &varModelSchema) + + if err != nil { + return err + } + + *o = ModelSchema(varModelSchema) + + return err +} + +type NullableModelSchema struct { + value *ModelSchema + isSet bool +} + +func (v NullableModelSchema) Get() *ModelSchema { + return v.value +} + +func (v *NullableModelSchema) Set(val *ModelSchema) { + v.value = val + v.isSet = true +} + +func (v NullableModelSchema) IsSet() bool { + return v.isSet +} + +func (v *NullableModelSchema) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelSchema(val *ModelSchema) *NullableModelSchema { + return &NullableModelSchema{value: val, isSet: true} +} + +func (v NullableModelSchema) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelSchema) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/client/model_operation_tracing.go b/api/client/model_operation_tracing.go index c0f071123..c7cabf6f7 100644 --- a/api/client/model_operation_tracing.go +++ b/api/client/model_operation_tracing.go @@ -19,8 +19,8 @@ var _ MappedNullable = &OperationTracing{} // OperationTracing struct for OperationTracing type OperationTracing struct { - Preprocess []PipelineTracingInner `json:"preprocess,omitempty"` - Postprocess []PipelineTracingInner `json:"postprocess,omitempty"` + Preprocess []PipelineTracing `json:"preprocess,omitempty"` + Postprocess []PipelineTracing `json:"postprocess,omitempty"` } // NewOperationTracing instantiates a new OperationTracing object @@ -41,9 +41,9 @@ func NewOperationTracingWithDefaults() *OperationTracing { } // GetPreprocess returns the Preprocess field value if set, zero value otherwise. -func (o *OperationTracing) GetPreprocess() []PipelineTracingInner { +func (o *OperationTracing) GetPreprocess() []PipelineTracing { if o == nil || IsNil(o.Preprocess) { - var ret []PipelineTracingInner + var ret []PipelineTracing return ret } return o.Preprocess @@ -51,7 +51,7 @@ func (o *OperationTracing) GetPreprocess() []PipelineTracingInner { // GetPreprocessOk returns a tuple with the Preprocess field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *OperationTracing) GetPreprocessOk() ([]PipelineTracingInner, bool) { +func (o *OperationTracing) GetPreprocessOk() ([]PipelineTracing, bool) { if o == nil || IsNil(o.Preprocess) { return nil, false } @@ -67,15 +67,15 @@ func (o *OperationTracing) HasPreprocess() bool { return false } -// SetPreprocess gets a reference to the given []PipelineTracingInner and assigns it to the Preprocess field. -func (o *OperationTracing) SetPreprocess(v []PipelineTracingInner) { +// SetPreprocess gets a reference to the given []PipelineTracing and assigns it to the Preprocess field. +func (o *OperationTracing) SetPreprocess(v []PipelineTracing) { o.Preprocess = v } // GetPostprocess returns the Postprocess field value if set, zero value otherwise. -func (o *OperationTracing) GetPostprocess() []PipelineTracingInner { +func (o *OperationTracing) GetPostprocess() []PipelineTracing { if o == nil || IsNil(o.Postprocess) { - var ret []PipelineTracingInner + var ret []PipelineTracing return ret } return o.Postprocess @@ -83,7 +83,7 @@ func (o *OperationTracing) GetPostprocess() []PipelineTracingInner { // GetPostprocessOk returns a tuple with the Postprocess field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *OperationTracing) GetPostprocessOk() ([]PipelineTracingInner, bool) { +func (o *OperationTracing) GetPostprocessOk() ([]PipelineTracing, bool) { if o == nil || IsNil(o.Postprocess) { return nil, false } @@ -99,8 +99,8 @@ func (o *OperationTracing) HasPostprocess() bool { return false } -// SetPostprocess gets a reference to the given []PipelineTracingInner and assigns it to the Postprocess field. -func (o *OperationTracing) SetPostprocess(v []PipelineTracingInner) { +// SetPostprocess gets a reference to the given []PipelineTracing and assigns it to the Postprocess field. +func (o *OperationTracing) SetPostprocess(v []PipelineTracing) { o.Postprocess = v } diff --git a/api/client/model_pipeline_tracing.go b/api/client/model_pipeline_tracing.go new file mode 100644 index 000000000..5d6feba58 --- /dev/null +++ b/api/client/model_pipeline_tracing.go @@ -0,0 +1,232 @@ +/* +Merlin + +API Guide for accessing Merlin's model management, deployment, and serving functionalities + +API version: 0.14.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the PipelineTracing type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PipelineTracing{} + +// PipelineTracing struct for PipelineTracing +type PipelineTracing struct { + OperationType *string `json:"operation_type,omitempty"` + Spec map[string]interface{} `json:"spec,omitempty"` + Input map[string]interface{} `json:"input,omitempty"` + Output map[string]interface{} `json:"output,omitempty"` +} + +// NewPipelineTracing instantiates a new PipelineTracing 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 NewPipelineTracing() *PipelineTracing { + this := PipelineTracing{} + return &this +} + +// NewPipelineTracingWithDefaults instantiates a new PipelineTracing 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 NewPipelineTracingWithDefaults() *PipelineTracing { + this := PipelineTracing{} + return &this +} + +// GetOperationType returns the OperationType field value if set, zero value otherwise. +func (o *PipelineTracing) GetOperationType() string { + if o == nil || IsNil(o.OperationType) { + var ret string + return ret + } + return *o.OperationType +} + +// GetOperationTypeOk returns a tuple with the OperationType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PipelineTracing) GetOperationTypeOk() (*string, bool) { + if o == nil || IsNil(o.OperationType) { + return nil, false + } + return o.OperationType, true +} + +// HasOperationType returns a boolean if a field has been set. +func (o *PipelineTracing) HasOperationType() bool { + if o != nil && !IsNil(o.OperationType) { + return true + } + + return false +} + +// SetOperationType gets a reference to the given string and assigns it to the OperationType field. +func (o *PipelineTracing) SetOperationType(v string) { + o.OperationType = &v +} + +// GetSpec returns the Spec field value if set, zero value otherwise. +func (o *PipelineTracing) GetSpec() map[string]interface{} { + if o == nil || IsNil(o.Spec) { + var ret map[string]interface{} + return ret + } + return o.Spec +} + +// GetSpecOk returns a tuple with the Spec field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PipelineTracing) GetSpecOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Spec) { + return map[string]interface{}{}, false + } + return o.Spec, true +} + +// HasSpec returns a boolean if a field has been set. +func (o *PipelineTracing) HasSpec() bool { + if o != nil && !IsNil(o.Spec) { + return true + } + + return false +} + +// SetSpec gets a reference to the given map[string]interface{} and assigns it to the Spec field. +func (o *PipelineTracing) SetSpec(v map[string]interface{}) { + o.Spec = v +} + +// GetInput returns the Input field value if set, zero value otherwise. +func (o *PipelineTracing) GetInput() map[string]interface{} { + if o == nil || IsNil(o.Input) { + var ret map[string]interface{} + return ret + } + return o.Input +} + +// GetInputOk returns a tuple with the Input field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PipelineTracing) GetInputOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Input) { + return map[string]interface{}{}, false + } + return o.Input, true +} + +// HasInput returns a boolean if a field has been set. +func (o *PipelineTracing) HasInput() bool { + if o != nil && !IsNil(o.Input) { + return true + } + + return false +} + +// SetInput gets a reference to the given map[string]interface{} and assigns it to the Input field. +func (o *PipelineTracing) SetInput(v map[string]interface{}) { + o.Input = v +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *PipelineTracing) GetOutput() map[string]interface{} { + if o == nil || IsNil(o.Output) { + var ret map[string]interface{} + return ret + } + return o.Output +} + +// GetOutputOk returns a tuple with the Output field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PipelineTracing) GetOutputOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Output) { + return map[string]interface{}{}, false + } + return o.Output, true +} + +// HasOutput returns a boolean if a field has been set. +func (o *PipelineTracing) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given map[string]interface{} and assigns it to the Output field. +func (o *PipelineTracing) SetOutput(v map[string]interface{}) { + o.Output = v +} + +func (o PipelineTracing) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PipelineTracing) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.OperationType) { + toSerialize["operation_type"] = o.OperationType + } + if !IsNil(o.Spec) { + toSerialize["spec"] = o.Spec + } + if !IsNil(o.Input) { + toSerialize["input"] = o.Input + } + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + return toSerialize, nil +} + +type NullablePipelineTracing struct { + value *PipelineTracing + isSet bool +} + +func (v NullablePipelineTracing) Get() *PipelineTracing { + return v.value +} + +func (v *NullablePipelineTracing) Set(val *PipelineTracing) { + v.value = val + v.isSet = true +} + +func (v NullablePipelineTracing) IsSet() bool { + return v.isSet +} + +func (v *NullablePipelineTracing) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePipelineTracing(val *PipelineTracing) *NullablePipelineTracing { + return &NullablePipelineTracing{value: val, isSet: true} +} + +func (v NullablePipelineTracing) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePipelineTracing) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/client/model_pipeline_tracing_inner.go b/api/client/model_pipeline_tracing_inner.go deleted file mode 100644 index 53972a2c6..000000000 --- a/api/client/model_pipeline_tracing_inner.go +++ /dev/null @@ -1,232 +0,0 @@ -/* -Merlin - -API Guide for accessing Merlin's model management, deployment, and serving functionalities - -API version: 0.14.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "encoding/json" -) - -// checks if the PipelineTracingInner type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &PipelineTracingInner{} - -// PipelineTracingInner struct for PipelineTracingInner -type PipelineTracingInner struct { - OperationType *string `json:"operation_type,omitempty"` - Specs map[string]interface{} `json:"specs,omitempty"` - Inputs map[string]interface{} `json:"inputs,omitempty"` - Outputs map[string]interface{} `json:"outputs,omitempty"` -} - -// NewPipelineTracingInner instantiates a new PipelineTracingInner 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 NewPipelineTracingInner() *PipelineTracingInner { - this := PipelineTracingInner{} - return &this -} - -// NewPipelineTracingInnerWithDefaults instantiates a new PipelineTracingInner 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 NewPipelineTracingInnerWithDefaults() *PipelineTracingInner { - this := PipelineTracingInner{} - return &this -} - -// GetOperationType returns the OperationType field value if set, zero value otherwise. -func (o *PipelineTracingInner) GetOperationType() string { - if o == nil || IsNil(o.OperationType) { - var ret string - return ret - } - return *o.OperationType -} - -// GetOperationTypeOk returns a tuple with the OperationType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PipelineTracingInner) GetOperationTypeOk() (*string, bool) { - if o == nil || IsNil(o.OperationType) { - return nil, false - } - return o.OperationType, true -} - -// HasOperationType returns a boolean if a field has been set. -func (o *PipelineTracingInner) HasOperationType() bool { - if o != nil && !IsNil(o.OperationType) { - return true - } - - return false -} - -// SetOperationType gets a reference to the given string and assigns it to the OperationType field. -func (o *PipelineTracingInner) SetOperationType(v string) { - o.OperationType = &v -} - -// GetSpecs returns the Specs field value if set, zero value otherwise. -func (o *PipelineTracingInner) GetSpecs() map[string]interface{} { - if o == nil || IsNil(o.Specs) { - var ret map[string]interface{} - return ret - } - return o.Specs -} - -// GetSpecsOk returns a tuple with the Specs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PipelineTracingInner) GetSpecsOk() (map[string]interface{}, bool) { - if o == nil || IsNil(o.Specs) { - return map[string]interface{}{}, false - } - return o.Specs, true -} - -// HasSpecs returns a boolean if a field has been set. -func (o *PipelineTracingInner) HasSpecs() bool { - if o != nil && !IsNil(o.Specs) { - return true - } - - return false -} - -// SetSpecs gets a reference to the given map[string]interface{} and assigns it to the Specs field. -func (o *PipelineTracingInner) SetSpecs(v map[string]interface{}) { - o.Specs = v -} - -// GetInputs returns the Inputs field value if set, zero value otherwise. -func (o *PipelineTracingInner) GetInputs() map[string]interface{} { - if o == nil || IsNil(o.Inputs) { - var ret map[string]interface{} - return ret - } - return o.Inputs -} - -// GetInputsOk returns a tuple with the Inputs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PipelineTracingInner) GetInputsOk() (map[string]interface{}, bool) { - if o == nil || IsNil(o.Inputs) { - return map[string]interface{}{}, false - } - return o.Inputs, true -} - -// HasInputs returns a boolean if a field has been set. -func (o *PipelineTracingInner) HasInputs() bool { - if o != nil && !IsNil(o.Inputs) { - return true - } - - return false -} - -// SetInputs gets a reference to the given map[string]interface{} and assigns it to the Inputs field. -func (o *PipelineTracingInner) SetInputs(v map[string]interface{}) { - o.Inputs = v -} - -// GetOutputs returns the Outputs field value if set, zero value otherwise. -func (o *PipelineTracingInner) GetOutputs() map[string]interface{} { - if o == nil || IsNil(o.Outputs) { - var ret map[string]interface{} - return ret - } - return o.Outputs -} - -// GetOutputsOk returns a tuple with the Outputs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PipelineTracingInner) GetOutputsOk() (map[string]interface{}, bool) { - if o == nil || IsNil(o.Outputs) { - return map[string]interface{}{}, false - } - return o.Outputs, true -} - -// HasOutputs returns a boolean if a field has been set. -func (o *PipelineTracingInner) HasOutputs() bool { - if o != nil && !IsNil(o.Outputs) { - return true - } - - return false -} - -// SetOutputs gets a reference to the given map[string]interface{} and assigns it to the Outputs field. -func (o *PipelineTracingInner) SetOutputs(v map[string]interface{}) { - o.Outputs = v -} - -func (o PipelineTracingInner) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o PipelineTracingInner) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.OperationType) { - toSerialize["operation_type"] = o.OperationType - } - if !IsNil(o.Specs) { - toSerialize["specs"] = o.Specs - } - if !IsNil(o.Inputs) { - toSerialize["inputs"] = o.Inputs - } - if !IsNil(o.Outputs) { - toSerialize["outputs"] = o.Outputs - } - return toSerialize, nil -} - -type NullablePipelineTracingInner struct { - value *PipelineTracingInner - isSet bool -} - -func (v NullablePipelineTracingInner) Get() *PipelineTracingInner { - return v.value -} - -func (v *NullablePipelineTracingInner) Set(val *PipelineTracingInner) { - v.value = val - v.isSet = true -} - -func (v NullablePipelineTracingInner) IsSet() bool { - return v.isSet -} - -func (v *NullablePipelineTracingInner) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullablePipelineTracingInner(val *PipelineTracingInner) *NullablePipelineTracingInner { - return &NullablePipelineTracingInner{value: val, isSet: true} -} - -func (v NullablePipelineTracingInner) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullablePipelineTracingInner) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/client/model_prediction_logger_config.go b/api/client/model_prediction_logger_config.go index 30dcafa51..26219db29 100644 --- a/api/client/model_prediction_logger_config.go +++ b/api/client/model_prediction_logger_config.go @@ -12,6 +12,7 @@ package client import ( "encoding/json" + "fmt" ) // checks if the PredictionLoggerConfig type satisfies the MappedNullable interface at compile time @@ -19,17 +20,20 @@ var _ MappedNullable = &PredictionLoggerConfig{} // PredictionLoggerConfig struct for PredictionLoggerConfig type PredictionLoggerConfig struct { - Enabled *bool `json:"enabled,omitempty"` + Enabled bool `json:"enabled"` RawFeaturesTable *string `json:"raw_features_table,omitempty"` EntitiesTable *string `json:"entities_table,omitempty"` } +type _PredictionLoggerConfig PredictionLoggerConfig + // NewPredictionLoggerConfig instantiates a new PredictionLoggerConfig 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 NewPredictionLoggerConfig() *PredictionLoggerConfig { +func NewPredictionLoggerConfig(enabled bool) *PredictionLoggerConfig { this := PredictionLoggerConfig{} + this.Enabled = enabled return &this } @@ -41,36 +45,28 @@ func NewPredictionLoggerConfigWithDefaults() *PredictionLoggerConfig { return &this } -// GetEnabled returns the Enabled field value if set, zero value otherwise. +// GetEnabled returns the Enabled field value func (o *PredictionLoggerConfig) GetEnabled() bool { - if o == nil || IsNil(o.Enabled) { + if o == nil { var ret bool return ret } - return *o.Enabled + + return o.Enabled } -// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// GetEnabledOk returns a tuple with the Enabled field value // and a boolean to check if the value has been set. func (o *PredictionLoggerConfig) GetEnabledOk() (*bool, bool) { - if o == nil || IsNil(o.Enabled) { + if o == nil { return nil, false } - return o.Enabled, true + return &o.Enabled, true } -// HasEnabled returns a boolean if a field has been set. -func (o *PredictionLoggerConfig) HasEnabled() bool { - if o != nil && !IsNil(o.Enabled) { - return true - } - - return false -} - -// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +// SetEnabled sets field value func (o *PredictionLoggerConfig) SetEnabled(v bool) { - o.Enabled = &v + o.Enabled = v } // GetRawFeaturesTable returns the RawFeaturesTable field value if set, zero value otherwise. @@ -147,9 +143,7 @@ func (o PredictionLoggerConfig) MarshalJSON() ([]byte, error) { func (o PredictionLoggerConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Enabled) { - toSerialize["enabled"] = o.Enabled - } + toSerialize["enabled"] = o.Enabled if !IsNil(o.RawFeaturesTable) { toSerialize["raw_features_table"] = o.RawFeaturesTable } @@ -159,6 +153,41 @@ func (o PredictionLoggerConfig) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *PredictionLoggerConfig) UnmarshalJSON(bytes []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{ + "enabled", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(bytes, &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) + } + } + + varPredictionLoggerConfig := _PredictionLoggerConfig{} + + err = json.Unmarshal(bytes, &varPredictionLoggerConfig) + + if err != nil { + return err + } + + *o = PredictionLoggerConfig(varPredictionLoggerConfig) + + return err +} + type NullablePredictionLoggerConfig struct { value *PredictionLoggerConfig isSet bool diff --git a/api/client/model_project.go b/api/client/model_project.go index dcfc4de8c..77f866c1d 100644 --- a/api/client/model_project.go +++ b/api/client/model_project.go @@ -21,7 +21,7 @@ var _ MappedNullable = &Project{} // Project struct for Project type Project struct { - Id *int32 `json:"id,omitempty"` + Id int32 `json:"id"` Name string `json:"name"` MlflowTrackingUrl *string `json:"mlflow_tracking_url,omitempty"` Administrators []string `json:"administrators,omitempty"` @@ -39,8 +39,9 @@ type _Project Project // 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 NewProject(name string) *Project { +func NewProject(id int32, name string) *Project { this := Project{} + this.Id = id this.Name = name return &this } @@ -53,36 +54,28 @@ func NewProjectWithDefaults() *Project { return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value func (o *Project) GetId() int32 { - if o == nil || IsNil(o.Id) { + if o == nil { var ret int32 return ret } - return *o.Id + + return o.Id } -// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. func (o *Project) GetIdOk() (*int32, bool) { - if o == nil || IsNil(o.Id) { + if o == nil { return nil, false } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Project) HasId() bool { - if o != nil && !IsNil(o.Id) { - return true - } - - return false + return &o.Id, true } -// SetId gets a reference to the given int32 and assigns it to the Id field. +// SetId sets field value func (o *Project) SetId(v int32) { - o.Id = &v + o.Id = v } // GetName returns the Name field value @@ -375,9 +368,7 @@ func (o Project) MarshalJSON() ([]byte, error) { func (o Project) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Id) { - toSerialize["id"] = o.Id - } + toSerialize["id"] = o.Id toSerialize["name"] = o.Name if !IsNil(o.MlflowTrackingUrl) { toSerialize["mlflow_tracking_url"] = o.MlflowTrackingUrl @@ -411,6 +402,7 @@ func (o *Project) UnmarshalJSON(bytes []byte) (err error) { // 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{ + "id", "name", } diff --git a/api/client/model_ranking_output.go b/api/client/model_ranking_output.go index 7e7143bcf..93b947066 100644 --- a/api/client/model_ranking_output.go +++ b/api/client/model_ranking_output.go @@ -12,6 +12,7 @@ package client import ( "encoding/json" + "fmt" ) // checks if the RankingOutput type satisfies the MappedNullable interface at compile time @@ -19,17 +20,23 @@ var _ MappedNullable = &RankingOutput{} // RankingOutput struct for RankingOutput type RankingOutput struct { - RankScoreColumn *string `json:"rank_score_column,omitempty"` - PredictionScoreColumn *string `json:"prediction_score_column,omitempty"` - RelevanceScoreColumn *string `json:"relevance_score_column,omitempty"` + RankScoreColumn string `json:"rank_score_column"` + PredictionGroupIdColumn string `json:"prediction_group_id_column"` + RelevanceScoreColumn *string `json:"relevance_score_column,omitempty"` + OutputClass ModelPredictionOutputClass `json:"output_class"` } +type _RankingOutput RankingOutput + // NewRankingOutput instantiates a new RankingOutput 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 NewRankingOutput() *RankingOutput { +func NewRankingOutput(rankScoreColumn string, predictionGroupIdColumn string, outputClass ModelPredictionOutputClass) *RankingOutput { this := RankingOutput{} + this.RankScoreColumn = rankScoreColumn + this.PredictionGroupIdColumn = predictionGroupIdColumn + this.OutputClass = outputClass return &this } @@ -41,68 +48,52 @@ func NewRankingOutputWithDefaults() *RankingOutput { return &this } -// GetRankScoreColumn returns the RankScoreColumn field value if set, zero value otherwise. +// GetRankScoreColumn returns the RankScoreColumn field value func (o *RankingOutput) GetRankScoreColumn() string { - if o == nil || IsNil(o.RankScoreColumn) { + if o == nil { var ret string return ret } - return *o.RankScoreColumn + + return o.RankScoreColumn } -// GetRankScoreColumnOk returns a tuple with the RankScoreColumn field value if set, nil otherwise +// GetRankScoreColumnOk returns a tuple with the RankScoreColumn field value // and a boolean to check if the value has been set. func (o *RankingOutput) GetRankScoreColumnOk() (*string, bool) { - if o == nil || IsNil(o.RankScoreColumn) { + if o == nil { return nil, false } - return o.RankScoreColumn, true -} - -// HasRankScoreColumn returns a boolean if a field has been set. -func (o *RankingOutput) HasRankScoreColumn() bool { - if o != nil && !IsNil(o.RankScoreColumn) { - return true - } - - return false + return &o.RankScoreColumn, true } -// SetRankScoreColumn gets a reference to the given string and assigns it to the RankScoreColumn field. +// SetRankScoreColumn sets field value func (o *RankingOutput) SetRankScoreColumn(v string) { - o.RankScoreColumn = &v + o.RankScoreColumn = v } -// GetPredictionScoreColumn returns the PredictionScoreColumn field value if set, zero value otherwise. -func (o *RankingOutput) GetPredictionScoreColumn() string { - if o == nil || IsNil(o.PredictionScoreColumn) { +// GetPredictionGroupIdColumn returns the PredictionGroupIdColumn field value +func (o *RankingOutput) GetPredictionGroupIdColumn() string { + if o == nil { var ret string return ret } - return *o.PredictionScoreColumn + + return o.PredictionGroupIdColumn } -// GetPredictionScoreColumnOk returns a tuple with the PredictionScoreColumn field value if set, nil otherwise +// GetPredictionGroupIdColumnOk returns a tuple with the PredictionGroupIdColumn field value // and a boolean to check if the value has been set. -func (o *RankingOutput) GetPredictionScoreColumnOk() (*string, bool) { - if o == nil || IsNil(o.PredictionScoreColumn) { +func (o *RankingOutput) GetPredictionGroupIdColumnOk() (*string, bool) { + if o == nil { return nil, false } - return o.PredictionScoreColumn, true + return &o.PredictionGroupIdColumn, true } -// HasPredictionScoreColumn returns a boolean if a field has been set. -func (o *RankingOutput) HasPredictionScoreColumn() bool { - if o != nil && !IsNil(o.PredictionScoreColumn) { - return true - } - - return false -} - -// SetPredictionScoreColumn gets a reference to the given string and assigns it to the PredictionScoreColumn field. -func (o *RankingOutput) SetPredictionScoreColumn(v string) { - o.PredictionScoreColumn = &v +// SetPredictionGroupIdColumn sets field value +func (o *RankingOutput) SetPredictionGroupIdColumn(v string) { + o.PredictionGroupIdColumn = v } // GetRelevanceScoreColumn returns the RelevanceScoreColumn field value if set, zero value otherwise. @@ -137,6 +128,30 @@ func (o *RankingOutput) SetRelevanceScoreColumn(v string) { o.RelevanceScoreColumn = &v } +// GetOutputClass returns the OutputClass field value +func (o *RankingOutput) GetOutputClass() ModelPredictionOutputClass { + if o == nil { + var ret ModelPredictionOutputClass + return ret + } + + return o.OutputClass +} + +// GetOutputClassOk returns a tuple with the OutputClass field value +// and a boolean to check if the value has been set. +func (o *RankingOutput) GetOutputClassOk() (*ModelPredictionOutputClass, bool) { + if o == nil { + return nil, false + } + return &o.OutputClass, true +} + +// SetOutputClass sets field value +func (o *RankingOutput) SetOutputClass(v ModelPredictionOutputClass) { + o.OutputClass = v +} + func (o RankingOutput) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -147,18 +162,52 @@ func (o RankingOutput) MarshalJSON() ([]byte, error) { func (o RankingOutput) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.RankScoreColumn) { - toSerialize["rank_score_column"] = o.RankScoreColumn - } - if !IsNil(o.PredictionScoreColumn) { - toSerialize["prediction_score_column"] = o.PredictionScoreColumn - } + toSerialize["rank_score_column"] = o.RankScoreColumn + toSerialize["prediction_group_id_column"] = o.PredictionGroupIdColumn if !IsNil(o.RelevanceScoreColumn) { toSerialize["relevance_score_column"] = o.RelevanceScoreColumn } + toSerialize["output_class"] = o.OutputClass return toSerialize, nil } +func (o *RankingOutput) UnmarshalJSON(bytes []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{ + "rank_score_column", + "prediction_group_id_column", + "output_class", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(bytes, &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) + } + } + + varRankingOutput := _RankingOutput{} + + err = json.Unmarshal(bytes, &varRankingOutput) + + if err != nil { + return err + } + + *o = RankingOutput(varRankingOutput) + + return err +} + type NullableRankingOutput struct { value *RankingOutput isSet bool diff --git a/api/client/model_regression_output.go b/api/client/model_regression_output.go index 272c9e570..f1fa72d6b 100644 --- a/api/client/model_regression_output.go +++ b/api/client/model_regression_output.go @@ -12,6 +12,7 @@ package client import ( "encoding/json" + "fmt" ) // checks if the RegressionOutput type satisfies the MappedNullable interface at compile time @@ -19,16 +20,21 @@ var _ MappedNullable = &RegressionOutput{} // RegressionOutput struct for RegressionOutput type RegressionOutput struct { - PredictionScoreColumn *string `json:"prediction_score_column,omitempty"` - ActualScoreColumn *string `json:"actual_score_column,omitempty"` + PredictionScoreColumn string `json:"prediction_score_column"` + ActualScoreColumn *string `json:"actual_score_column,omitempty"` + OutputClass ModelPredictionOutputClass `json:"output_class"` } +type _RegressionOutput RegressionOutput + // NewRegressionOutput instantiates a new RegressionOutput 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 NewRegressionOutput() *RegressionOutput { +func NewRegressionOutput(predictionScoreColumn string, outputClass ModelPredictionOutputClass) *RegressionOutput { this := RegressionOutput{} + this.PredictionScoreColumn = predictionScoreColumn + this.OutputClass = outputClass return &this } @@ -40,36 +46,28 @@ func NewRegressionOutputWithDefaults() *RegressionOutput { return &this } -// GetPredictionScoreColumn returns the PredictionScoreColumn field value if set, zero value otherwise. +// GetPredictionScoreColumn returns the PredictionScoreColumn field value func (o *RegressionOutput) GetPredictionScoreColumn() string { - if o == nil || IsNil(o.PredictionScoreColumn) { + if o == nil { var ret string return ret } - return *o.PredictionScoreColumn + + return o.PredictionScoreColumn } -// GetPredictionScoreColumnOk returns a tuple with the PredictionScoreColumn field value if set, nil otherwise +// GetPredictionScoreColumnOk returns a tuple with the PredictionScoreColumn field value // and a boolean to check if the value has been set. func (o *RegressionOutput) GetPredictionScoreColumnOk() (*string, bool) { - if o == nil || IsNil(o.PredictionScoreColumn) { + if o == nil { return nil, false } - return o.PredictionScoreColumn, true -} - -// HasPredictionScoreColumn returns a boolean if a field has been set. -func (o *RegressionOutput) HasPredictionScoreColumn() bool { - if o != nil && !IsNil(o.PredictionScoreColumn) { - return true - } - - return false + return &o.PredictionScoreColumn, true } -// SetPredictionScoreColumn gets a reference to the given string and assigns it to the PredictionScoreColumn field. +// SetPredictionScoreColumn sets field value func (o *RegressionOutput) SetPredictionScoreColumn(v string) { - o.PredictionScoreColumn = &v + o.PredictionScoreColumn = v } // GetActualScoreColumn returns the ActualScoreColumn field value if set, zero value otherwise. @@ -104,6 +102,30 @@ func (o *RegressionOutput) SetActualScoreColumn(v string) { o.ActualScoreColumn = &v } +// GetOutputClass returns the OutputClass field value +func (o *RegressionOutput) GetOutputClass() ModelPredictionOutputClass { + if o == nil { + var ret ModelPredictionOutputClass + return ret + } + + return o.OutputClass +} + +// GetOutputClassOk returns a tuple with the OutputClass field value +// and a boolean to check if the value has been set. +func (o *RegressionOutput) GetOutputClassOk() (*ModelPredictionOutputClass, bool) { + if o == nil { + return nil, false + } + return &o.OutputClass, true +} + +// SetOutputClass sets field value +func (o *RegressionOutput) SetOutputClass(v ModelPredictionOutputClass) { + o.OutputClass = v +} + func (o RegressionOutput) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -114,15 +136,50 @@ func (o RegressionOutput) MarshalJSON() ([]byte, error) { func (o RegressionOutput) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.PredictionScoreColumn) { - toSerialize["prediction_score_column"] = o.PredictionScoreColumn - } + toSerialize["prediction_score_column"] = o.PredictionScoreColumn if !IsNil(o.ActualScoreColumn) { toSerialize["actual_score_column"] = o.ActualScoreColumn } + toSerialize["output_class"] = o.OutputClass return toSerialize, nil } +func (o *RegressionOutput) UnmarshalJSON(bytes []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{ + "prediction_score_column", + "output_class", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(bytes, &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) + } + } + + varRegressionOutput := _RegressionOutput{} + + err = json.Unmarshal(bytes, &varRegressionOutput) + + if err != nil { + return err + } + + *o = RegressionOutput(varRegressionOutput) + + return err +} + type NullableRegressionOutput struct { value *RegressionOutput isSet bool diff --git a/api/client/model_schema.go b/api/client/model_schema.go deleted file mode 100644 index e0cbea4df..000000000 --- a/api/client/model_schema.go +++ /dev/null @@ -1,232 +0,0 @@ -/* -Merlin - -API Guide for accessing Merlin's model management, deployment, and serving functionalities - -API version: 0.14.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "encoding/json" -) - -// checks if the Schema type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &Schema{} - -// Schema struct for Schema -type Schema struct { - PredictionIdColumn *string `json:"prediction_id_column,omitempty"` - ModelPredictionOutput *ModelPredictionOutput `json:"model_prediction_output,omitempty"` - TagColumns []string `json:"tag_columns,omitempty"` - FeatureTypes *map[string]ValueType `json:"feature_types,omitempty"` -} - -// NewSchema instantiates a new Schema 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 NewSchema() *Schema { - this := Schema{} - return &this -} - -// NewSchemaWithDefaults instantiates a new Schema 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 NewSchemaWithDefaults() *Schema { - this := Schema{} - return &this -} - -// GetPredictionIdColumn returns the PredictionIdColumn field value if set, zero value otherwise. -func (o *Schema) GetPredictionIdColumn() string { - if o == nil || IsNil(o.PredictionIdColumn) { - var ret string - return ret - } - return *o.PredictionIdColumn -} - -// GetPredictionIdColumnOk returns a tuple with the PredictionIdColumn field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Schema) GetPredictionIdColumnOk() (*string, bool) { - if o == nil || IsNil(o.PredictionIdColumn) { - return nil, false - } - return o.PredictionIdColumn, true -} - -// HasPredictionIdColumn returns a boolean if a field has been set. -func (o *Schema) HasPredictionIdColumn() bool { - if o != nil && !IsNil(o.PredictionIdColumn) { - return true - } - - return false -} - -// SetPredictionIdColumn gets a reference to the given string and assigns it to the PredictionIdColumn field. -func (o *Schema) SetPredictionIdColumn(v string) { - o.PredictionIdColumn = &v -} - -// GetModelPredictionOutput returns the ModelPredictionOutput field value if set, zero value otherwise. -func (o *Schema) GetModelPredictionOutput() ModelPredictionOutput { - if o == nil || IsNil(o.ModelPredictionOutput) { - var ret ModelPredictionOutput - return ret - } - return *o.ModelPredictionOutput -} - -// GetModelPredictionOutputOk returns a tuple with the ModelPredictionOutput field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Schema) GetModelPredictionOutputOk() (*ModelPredictionOutput, bool) { - if o == nil || IsNil(o.ModelPredictionOutput) { - return nil, false - } - return o.ModelPredictionOutput, true -} - -// HasModelPredictionOutput returns a boolean if a field has been set. -func (o *Schema) HasModelPredictionOutput() bool { - if o != nil && !IsNil(o.ModelPredictionOutput) { - return true - } - - return false -} - -// SetModelPredictionOutput gets a reference to the given ModelPredictionOutput and assigns it to the ModelPredictionOutput field. -func (o *Schema) SetModelPredictionOutput(v ModelPredictionOutput) { - o.ModelPredictionOutput = &v -} - -// GetTagColumns returns the TagColumns field value if set, zero value otherwise. -func (o *Schema) GetTagColumns() []string { - if o == nil || IsNil(o.TagColumns) { - var ret []string - return ret - } - return o.TagColumns -} - -// GetTagColumnsOk returns a tuple with the TagColumns field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Schema) GetTagColumnsOk() ([]string, bool) { - if o == nil || IsNil(o.TagColumns) { - return nil, false - } - return o.TagColumns, true -} - -// HasTagColumns returns a boolean if a field has been set. -func (o *Schema) HasTagColumns() bool { - if o != nil && !IsNil(o.TagColumns) { - return true - } - - return false -} - -// SetTagColumns gets a reference to the given []string and assigns it to the TagColumns field. -func (o *Schema) SetTagColumns(v []string) { - o.TagColumns = v -} - -// GetFeatureTypes returns the FeatureTypes field value if set, zero value otherwise. -func (o *Schema) GetFeatureTypes() map[string]ValueType { - if o == nil || IsNil(o.FeatureTypes) { - var ret map[string]ValueType - return ret - } - return *o.FeatureTypes -} - -// GetFeatureTypesOk returns a tuple with the FeatureTypes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Schema) GetFeatureTypesOk() (*map[string]ValueType, bool) { - if o == nil || IsNil(o.FeatureTypes) { - return nil, false - } - return o.FeatureTypes, true -} - -// HasFeatureTypes returns a boolean if a field has been set. -func (o *Schema) HasFeatureTypes() bool { - if o != nil && !IsNil(o.FeatureTypes) { - return true - } - - return false -} - -// SetFeatureTypes gets a reference to the given map[string]ValueType and assigns it to the FeatureTypes field. -func (o *Schema) SetFeatureTypes(v map[string]ValueType) { - o.FeatureTypes = &v -} - -func (o Schema) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o Schema) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.PredictionIdColumn) { - toSerialize["prediction_id_column"] = o.PredictionIdColumn - } - if !IsNil(o.ModelPredictionOutput) { - toSerialize["model_prediction_output"] = o.ModelPredictionOutput - } - if !IsNil(o.TagColumns) { - toSerialize["tag_columns"] = o.TagColumns - } - if !IsNil(o.FeatureTypes) { - toSerialize["feature_types"] = o.FeatureTypes - } - return toSerialize, nil -} - -type NullableSchema struct { - value *Schema - isSet bool -} - -func (v NullableSchema) Get() *Schema { - return v.value -} - -func (v *NullableSchema) Set(val *Schema) { - v.value = val - v.isSet = true -} - -func (v NullableSchema) IsSet() bool { - return v.isSet -} - -func (v *NullableSchema) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableSchema(val *Schema) *NullableSchema { - return &NullableSchema{value: val, isSet: true} -} - -func (v NullableSchema) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableSchema) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/client/model_schema_spec.go b/api/client/model_schema_spec.go new file mode 100644 index 000000000..ec474cb10 --- /dev/null +++ b/api/client/model_schema_spec.go @@ -0,0 +1,245 @@ +/* +Merlin + +API Guide for accessing Merlin's model management, deployment, and serving functionalities + +API version: 0.14.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// checks if the SchemaSpec type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SchemaSpec{} + +// SchemaSpec struct for SchemaSpec +type SchemaSpec struct { + PredictionIdColumn string `json:"prediction_id_column"` + ModelPredictionOutput ModelPredictionOutput `json:"model_prediction_output"` + TagColumns []string `json:"tag_columns,omitempty"` + FeatureTypes map[string]ValueType `json:"feature_types"` +} + +type _SchemaSpec SchemaSpec + +// NewSchemaSpec instantiates a new SchemaSpec 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 NewSchemaSpec(predictionIdColumn string, modelPredictionOutput ModelPredictionOutput, featureTypes map[string]ValueType) *SchemaSpec { + this := SchemaSpec{} + this.PredictionIdColumn = predictionIdColumn + this.ModelPredictionOutput = modelPredictionOutput + this.FeatureTypes = featureTypes + return &this +} + +// NewSchemaSpecWithDefaults instantiates a new SchemaSpec 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 NewSchemaSpecWithDefaults() *SchemaSpec { + this := SchemaSpec{} + return &this +} + +// GetPredictionIdColumn returns the PredictionIdColumn field value +func (o *SchemaSpec) GetPredictionIdColumn() string { + if o == nil { + var ret string + return ret + } + + return o.PredictionIdColumn +} + +// GetPredictionIdColumnOk returns a tuple with the PredictionIdColumn field value +// and a boolean to check if the value has been set. +func (o *SchemaSpec) GetPredictionIdColumnOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PredictionIdColumn, true +} + +// SetPredictionIdColumn sets field value +func (o *SchemaSpec) SetPredictionIdColumn(v string) { + o.PredictionIdColumn = v +} + +// GetModelPredictionOutput returns the ModelPredictionOutput field value +func (o *SchemaSpec) GetModelPredictionOutput() ModelPredictionOutput { + if o == nil { + var ret ModelPredictionOutput + return ret + } + + return o.ModelPredictionOutput +} + +// GetModelPredictionOutputOk returns a tuple with the ModelPredictionOutput field value +// and a boolean to check if the value has been set. +func (o *SchemaSpec) GetModelPredictionOutputOk() (*ModelPredictionOutput, bool) { + if o == nil { + return nil, false + } + return &o.ModelPredictionOutput, true +} + +// SetModelPredictionOutput sets field value +func (o *SchemaSpec) SetModelPredictionOutput(v ModelPredictionOutput) { + o.ModelPredictionOutput = v +} + +// GetTagColumns returns the TagColumns field value if set, zero value otherwise. +func (o *SchemaSpec) GetTagColumns() []string { + if o == nil || IsNil(o.TagColumns) { + var ret []string + return ret + } + return o.TagColumns +} + +// GetTagColumnsOk returns a tuple with the TagColumns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SchemaSpec) GetTagColumnsOk() ([]string, bool) { + if o == nil || IsNil(o.TagColumns) { + return nil, false + } + return o.TagColumns, true +} + +// HasTagColumns returns a boolean if a field has been set. +func (o *SchemaSpec) HasTagColumns() bool { + if o != nil && !IsNil(o.TagColumns) { + return true + } + + return false +} + +// SetTagColumns gets a reference to the given []string and assigns it to the TagColumns field. +func (o *SchemaSpec) SetTagColumns(v []string) { + o.TagColumns = v +} + +// GetFeatureTypes returns the FeatureTypes field value +func (o *SchemaSpec) GetFeatureTypes() map[string]ValueType { + if o == nil { + var ret map[string]ValueType + return ret + } + + return o.FeatureTypes +} + +// GetFeatureTypesOk returns a tuple with the FeatureTypes field value +// and a boolean to check if the value has been set. +func (o *SchemaSpec) GetFeatureTypesOk() (*map[string]ValueType, bool) { + if o == nil { + return nil, false + } + return &o.FeatureTypes, true +} + +// SetFeatureTypes sets field value +func (o *SchemaSpec) SetFeatureTypes(v map[string]ValueType) { + o.FeatureTypes = v +} + +func (o SchemaSpec) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SchemaSpec) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["prediction_id_column"] = o.PredictionIdColumn + toSerialize["model_prediction_output"] = o.ModelPredictionOutput + if !IsNil(o.TagColumns) { + toSerialize["tag_columns"] = o.TagColumns + } + toSerialize["feature_types"] = o.FeatureTypes + return toSerialize, nil +} + +func (o *SchemaSpec) UnmarshalJSON(bytes []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{ + "prediction_id_column", + "model_prediction_output", + "feature_types", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(bytes, &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) + } + } + + varSchemaSpec := _SchemaSpec{} + + err = json.Unmarshal(bytes, &varSchemaSpec) + + if err != nil { + return err + } + + *o = SchemaSpec(varSchemaSpec) + + return err +} + +type NullableSchemaSpec struct { + value *SchemaSpec + isSet bool +} + +func (v NullableSchemaSpec) Get() *SchemaSpec { + return v.value +} + +func (v *NullableSchemaSpec) Set(val *SchemaSpec) { + v.value = val + v.isSet = true +} + +func (v NullableSchemaSpec) IsSet() bool { + return v.isSet +} + +func (v *NullableSchemaSpec) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSchemaSpec(val *SchemaSpec) *NullableSchemaSpec { + return &NullableSchemaSpec{value: val, isSet: true} +} + +func (v NullableSchemaSpec) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSchemaSpec) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/client/model_version.go b/api/client/model_version.go index c54376693..ebfd1be45 100644 --- a/api/client/model_version.go +++ b/api/client/model_version.go @@ -32,7 +32,7 @@ type Version struct { CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` PythonVersion *string `json:"python_version,omitempty"` - Schema *InferenceSchema `json:"schema,omitempty"` + ModelSchema *ModelSchema `json:"model_schema,omitempty"` } // NewVersion instantiates a new Version object @@ -436,36 +436,36 @@ func (o *Version) SetPythonVersion(v string) { o.PythonVersion = &v } -// GetSchema returns the Schema field value if set, zero value otherwise. -func (o *Version) GetSchema() InferenceSchema { - if o == nil || IsNil(o.Schema) { - var ret InferenceSchema +// GetModelSchema returns the ModelSchema field value if set, zero value otherwise. +func (o *Version) GetModelSchema() ModelSchema { + if o == nil || IsNil(o.ModelSchema) { + var ret ModelSchema return ret } - return *o.Schema + return *o.ModelSchema } -// GetSchemaOk returns a tuple with the Schema field value if set, nil otherwise +// GetModelSchemaOk returns a tuple with the ModelSchema field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *Version) GetSchemaOk() (*InferenceSchema, bool) { - if o == nil || IsNil(o.Schema) { +func (o *Version) GetModelSchemaOk() (*ModelSchema, bool) { + if o == nil || IsNil(o.ModelSchema) { return nil, false } - return o.Schema, true + return o.ModelSchema, true } -// HasSchema returns a boolean if a field has been set. -func (o *Version) HasSchema() bool { - if o != nil && !IsNil(o.Schema) { +// HasModelSchema returns a boolean if a field has been set. +func (o *Version) HasModelSchema() bool { + if o != nil && !IsNil(o.ModelSchema) { return true } return false } -// SetSchema gets a reference to the given InferenceSchema and assigns it to the Schema field. -func (o *Version) SetSchema(v InferenceSchema) { - o.Schema = &v +// SetModelSchema gets a reference to the given ModelSchema and assigns it to the ModelSchema field. +func (o *Version) SetModelSchema(v ModelSchema) { + o.ModelSchema = &v } func (o Version) MarshalJSON() ([]byte, error) { @@ -514,8 +514,8 @@ func (o Version) ToMap() (map[string]interface{}, error) { if !IsNil(o.PythonVersion) { toSerialize["python_version"] = o.PythonVersion } - if !IsNil(o.Schema) { - toSerialize["schema"] = o.Schema + if !IsNil(o.ModelSchema) { + toSerialize["model_schema"] = o.ModelSchema } return toSerialize, nil } diff --git a/api/models/model_schema.go b/api/models/model_schema.go index fe0d5f3a6..944cdc005 100644 --- a/api/models/model_schema.go +++ b/api/models/model_schema.go @@ -10,11 +10,12 @@ import ( type InferenceType string +type ModelPredictionOutputClass string + const ( - BinaryClassification = "BINARY_CLASSIFICATION" - MulticlassClassification = "MULTICLASS_CLASSIFICATION" - Regression = "REGRESSION" - Ranking = "RANKING" + BinaryClassification ModelPredictionOutputClass = "BinaryClassificationOutput" + Regression ModelPredictionOutputClass = "RegressionOutput" + Ranking ModelPredictionOutputClass = "RankingOutput" ) type ValueType string @@ -66,57 +67,36 @@ func newStrictDecoder(data []byte) *json.Decoder { func (m *ModelPredictionOutput) UnmarshalJSON(data []byte) error { var err error - match := 0 - // try to unmarshal data into BinaryClassificationOutput - err = newStrictDecoder(data).Decode(&m.BinaryClassificationOutput) - if err == nil { - jsonBinaryClassificationOutput, _ := json.Marshal(m.BinaryClassificationOutput) - if string(jsonBinaryClassificationOutput) == "{}" { // empty struct - m.BinaryClassificationOutput = nil - } else { - match++ - } - } else { - m.BinaryClassificationOutput = nil + outputClassStruct := struct { + OutputClass ModelPredictionOutputClass `json:"output_class"` + }{} + err = json.Unmarshal(data, &outputClassStruct) + if err != nil { + return err } - // try to unmarshal data into RankingOutput - err = newStrictDecoder(data).Decode(&m.RankingOutput) - if err == nil { - jsonRankingOutput, _ := json.Marshal(m.RankingOutput) - if string(jsonRankingOutput) == "{}" { // empty struct - m.RankingOutput = nil - } else { - match++ + strictDecoder := newStrictDecoder(data) + switch outputClassStruct.OutputClass { + case BinaryClassification: + err := strictDecoder.Decode(&m.BinaryClassificationOutput) + if err != nil { + return err } - } else { - m.RankingOutput = nil - } - - // try to unmarshal data into RegresionOutput - err = newStrictDecoder(data).Decode(&m.RegressionOutput) - if err == nil { - jsonRegressionOutput, _ := json.Marshal(m.RegressionOutput) - if string(jsonRegressionOutput) == "{}" { // empty struct - m.RegressionOutput = nil - } else { - match++ + case Regression: + err := strictDecoder.Decode(&m.RegressionOutput) + if err != nil { + return err } - } else { - m.RegressionOutput = nil - } - - if match > 1 { // more than 1 match - // reset to nil - m.BinaryClassificationOutput = nil - m.RankingOutput = nil - m.RegressionOutput = nil - return fmt.Errorf("data matches more than one schema in oneOf(ModelPredictionOutput)") - } else if match == 1 { - return nil // exactly one match + case Ranking: + err := strictDecoder.Decode(&m.RankingOutput) + if err != nil { + return err + } + default: + return fmt.Errorf("output class %v it not supported", outputClassStruct.OutputClass) } - return fmt.Errorf("data failed to match schemas in oneOf(ModelPredictionOutput)") + return nil } func (m ModelPredictionOutput) MarshalJSON() ([]byte, error) { @@ -136,21 +116,24 @@ func (m ModelPredictionOutput) MarshalJSON() ([]byte, error) { } type BinaryClassificationOutput struct { - ActualLabelColumn string `json:"actual_label_column"` - NegativeClassLabel string `json:"negative_class_label"` - PredictionScoreColumn string `json:"prediction_score_column"` - PredictionLabelColumn string `json:"prediction_label_column"` - PositiveClassLabel string `json:"positive_class_label"` - ScoreThreshold *float64 `json:"score_threshold,omitempty"` + ActualLabelColumn string `json:"actual_label_column"` + NegativeClassLabel string `json:"negative_class_label"` + PredictionScoreColumn string `json:"prediction_score_column"` + PredictionLabelColumn string `json:"prediction_label_column"` + PositiveClassLabel string `json:"positive_class_label"` + ScoreThreshold *float64 `json:"score_threshold,omitempty"` + OutputClass ModelPredictionOutputClass `json:"output_class" validate:"required"` } type RankingOutput struct { - PredictionGroudIDColumn string `json:"prediction_group_id_column"` - RankScoreColumn string `json:"rank_score_column"` - RelevanceScoreColumn string `json:"relevance_score"` + PredictionGroudIDColumn string `json:"prediction_group_id_column"` + RankScoreColumn string `json:"rank_score_column"` + RelevanceScoreColumn string `json:"relevance_score"` + OutputClass ModelPredictionOutputClass `json:"output_class" validate:"required"` } type RegressionOutput struct { - PredictionScoreColumn string `json:"prediction_score_column"` - ActualScoreColumn string `json:"actual_score_column"` + PredictionScoreColumn string `json:"prediction_score_column"` + ActualScoreColumn string `json:"actual_score_column"` + OutputClass ModelPredictionOutputClass `json:"output_class" validate:"required"` } diff --git a/python/sdk/client/__init__.py b/python/sdk/client/__init__.py index 984732f35..90fec4ada 100644 --- a/python/sdk/client/__init__.py +++ b/python/sdk/client/__init__.py @@ -70,6 +70,7 @@ from client.models.model_endpoint_rule_destination import ModelEndpointRuleDestination from client.models.model_prediction_config import ModelPredictionConfig from client.models.model_prediction_output import ModelPredictionOutput +from client.models.model_prediction_output_class import ModelPredictionOutputClass from client.models.model_schema import ModelSchema from client.models.operation_tracing import OperationTracing from client.models.pipeline_tracing import PipelineTracing diff --git a/python/sdk/client/models/__init__.py b/python/sdk/client/models/__init__.py index e9578f58e..ecbad6c1d 100644 --- a/python/sdk/client/models/__init__.py +++ b/python/sdk/client/models/__init__.py @@ -42,6 +42,7 @@ from client.models.model_endpoint_rule_destination import ModelEndpointRuleDestination from client.models.model_prediction_config import ModelPredictionConfig from client.models.model_prediction_output import ModelPredictionOutput +from client.models.model_prediction_output_class import ModelPredictionOutputClass from client.models.model_schema import ModelSchema from client.models.operation_tracing import OperationTracing from client.models.pipeline_tracing import PipelineTracing diff --git a/python/sdk/client/models/binary_classification_output.py b/python/sdk/client/models/binary_classification_output.py index 6e6f05555..1d829d260 100644 --- a/python/sdk/client/models/binary_classification_output.py +++ b/python/sdk/client/models/binary_classification_output.py @@ -20,6 +20,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Union from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from client.models.model_prediction_output_class import ModelPredictionOutputClass try: from typing import Self except ImportError: @@ -34,7 +35,8 @@ class BinaryClassificationOutput(BaseModel): positive_class_label: StrictStr negative_class_label: StrictStr score_threshold: Optional[Union[StrictFloat, StrictInt]] = None - __properties: ClassVar[List[str]] = ["prediction_score_column", "actual_label_column", "positive_class_label", "negative_class_label", "score_threshold"] + output_class: Optional[ModelPredictionOutputClass] = None + __properties: ClassVar[List[str]] = ["prediction_score_column", "actual_label_column", "positive_class_label", "negative_class_label", "score_threshold", "output_class"] model_config = { "populate_by_name": True, @@ -88,7 +90,8 @@ def from_dict(cls, obj: Dict) -> Self: "actual_label_column": obj.get("actual_label_column"), "positive_class_label": obj.get("positive_class_label"), "negative_class_label": obj.get("negative_class_label"), - "score_threshold": obj.get("score_threshold") + "score_threshold": obj.get("score_threshold"), + "output_class": obj.get("output_class") }) return _obj diff --git a/python/sdk/client/models/model_prediction_output_class.py b/python/sdk/client/models/model_prediction_output_class.py new file mode 100644 index 000000000..41352d099 --- /dev/null +++ b/python/sdk/client/models/model_prediction_output_class.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +""" + Merlin + + API Guide for accessing Merlin's model management, deployment, and serving functionalities + + The version of the OpenAPI document: 0.14.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +import re # noqa: F401 +from enum import Enum + + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self + + +class ModelPredictionOutputClass(str, Enum): + """ + ModelPredictionOutputClass + """ + + """ + allowed enum values + """ + BINARYCLASSIFICATIONOUTPUT = 'BinaryClassificationOutput' + RANKINGOUTPUT = 'RankingOutput' + REGRESSIONOUTPUT = 'RegressionOutput' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ModelPredictionOutputClass from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/python/sdk/client/models/ranking_output.py b/python/sdk/client/models/ranking_output.py index 43bcaca66..426d80add 100644 --- a/python/sdk/client/models/ranking_output.py +++ b/python/sdk/client/models/ranking_output.py @@ -20,6 +20,7 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr +from client.models.model_prediction_output_class import ModelPredictionOutputClass try: from typing import Self except ImportError: @@ -32,7 +33,8 @@ class RankingOutput(BaseModel): rank_score_column: StrictStr prediction_group_id_column: StrictStr relevance_score_column: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["rank_score_column", "prediction_group_id_column", "relevance_score_column"] + output_class: Optional[ModelPredictionOutputClass] = None + __properties: ClassVar[List[str]] = ["rank_score_column", "prediction_group_id_column", "relevance_score_column", "output_class"] model_config = { "populate_by_name": True, @@ -84,7 +86,8 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "rank_score_column": obj.get("rank_score_column"), "prediction_group_id_column": obj.get("prediction_group_id_column"), - "relevance_score_column": obj.get("relevance_score_column") + "relevance_score_column": obj.get("relevance_score_column"), + "output_class": obj.get("output_class") }) return _obj diff --git a/python/sdk/client/models/regression_output.py b/python/sdk/client/models/regression_output.py index 1e60e2b59..74c9fb4cc 100644 --- a/python/sdk/client/models/regression_output.py +++ b/python/sdk/client/models/regression_output.py @@ -20,6 +20,7 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr +from client.models.model_prediction_output_class import ModelPredictionOutputClass try: from typing import Self except ImportError: @@ -31,7 +32,8 @@ class RegressionOutput(BaseModel): """ # noqa: E501 prediction_score_column: StrictStr actual_score_column: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["prediction_score_column", "actual_score_column"] + output_class: Optional[ModelPredictionOutputClass] = None + __properties: ClassVar[List[str]] = ["prediction_score_column", "actual_score_column", "output_class"] model_config = { "populate_by_name": True, @@ -82,7 +84,8 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "prediction_score_column": obj.get("prediction_score_column"), - "actual_score_column": obj.get("actual_score_column") + "actual_score_column": obj.get("actual_score_column"), + "output_class": obj.get("output_class") }) return _obj diff --git a/swagger.yaml b/swagger.yaml index cdb26427c..6727de5a7 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -1403,11 +1403,16 @@ components: - int64 - boolean - string - + ModelPredictionOutputClass: + type: string + enum: + - BinaryClassificationOutput + - RankingOutput + - RegressionOutput ModelPredictionOutput: type: object discriminator: - propertyName: type + propertyName: output_class oneOf: - $ref: '#/components/schemas/BinaryClassificationOutput' - $ref: '#/components/schemas/RankingOutput' @@ -1429,6 +1434,9 @@ components: type: string score_threshold: type: number + output_class: + $ref: '#/components/schemas/ModelPredictionOutputClass' + RankingOutput: type: object required: @@ -1441,6 +1449,8 @@ components: type: string relevance_score_column: type: string + output_class: + $ref: '#/components/schemas/ModelPredictionOutputClass' RegressionOutput: type: object required: @@ -1450,6 +1460,8 @@ components: type: string actual_score_column: type: string + output_class: + $ref: '#/components/schemas/ModelPredictionOutputClass' EndpointStatus: type: string enum: