diff --git a/api/api/model_schema_api_test.go b/api/api/model_schema_api_test.go index ee0af3c99..18198e906 100644 --- a/api/api/model_schema_api_test.go +++ b/api/api/model_schema_api_test.go @@ -33,9 +33,8 @@ func TestModelSchemaController_GetAllSchemas(t *testing.T) { ModelID: models.ID(1), ID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -56,9 +55,8 @@ func TestModelSchemaController_GetAllSchemas(t *testing.T) { ModelID: models.ID(1), ID: models.ID(2), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -82,9 +80,8 @@ func TestModelSchemaController_GetAllSchemas(t *testing.T) { ModelID: models.ID(1), ID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -105,9 +102,8 @@ func TestModelSchemaController_GetAllSchemas(t *testing.T) { ModelID: models.ID(1), ID: models.ID(2), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -187,7 +183,6 @@ func TestModelSchemaController_GetSchema(t *testing.T) { ModelID: models.ID(1), ID: models.ID(2), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -212,7 +207,6 @@ func TestModelSchemaController_GetSchema(t *testing.T) { ModelID: models.ID(1), ID: models.ID(2), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -292,7 +286,6 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { }, body: []byte(`{ "spec": { - "prediction_id_column":"prediction_id", "session_id_column":"session_id", "row_id_column":"row_id", "tag_columns": ["tags"], @@ -313,10 +306,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { mockSvc.On("Save", mock.Anything, &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -334,10 +326,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -360,10 +351,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -387,7 +377,6 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { }, body: []byte(`{ "spec": { - "prediction_id_column":"prediction_id", "session_id_column":"session_id", "row_id_column":"row_id", "tag_columns": ["tags"], @@ -409,10 +398,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { mockSvc.On("Save", mock.Anything, &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -430,10 +418,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -456,10 +443,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -483,7 +469,6 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { }, body: []byte(`{ "spec": { - "prediction_id_column":"prediction_id", "session_id_column":"session_id", "row_id_column":"row_id", "tag_columns": ["tags"], @@ -507,10 +492,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { mockSvc.On("Save", mock.Anything, &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -531,10 +515,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -560,10 +543,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -590,7 +572,6 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { }, body: []byte(`{ "spec": { - "prediction_id_column":"prediction_id", "session_id_column":"session_id", "row_id_column":"row_id", "tag_columns": ["tags"], @@ -611,10 +592,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { mockSvc.On("Save", mock.Anything, &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -632,10 +612,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -658,10 +637,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -685,7 +663,6 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { }, body: []byte(`{ "spec": { - "prediction_id_column":"prediction_id", "session_id_column":"session_id", "row_id_column":"row_id", "tag_columns": ["tags"], @@ -706,10 +683,9 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { mockSvc.On("Save", mock.Anything, &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -738,7 +714,6 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { }, body: []byte(`{ "spec": { - "prediction_id_column":"prediction_id", "session_id_column":"session_id", "row_id_column":"row_id", "tag_columns": ["tags"], @@ -788,7 +763,6 @@ func TestModelSchemaController_CreateOrUpdateSchema(t *testing.T) { func Benchmark_Unmarshal(b *testing.B) { data := []byte(` { - "prediction_id_column":"prediction_id", "session_id_column":"session_id", "row_id_column":"row_id", "tag_columns": ["tags"], diff --git a/api/api/versions_api_test.go b/api/api/versions_api_test.go index aa8581f3a..97b39824b 100644 --- a/api/api/versions_api_test.go +++ b/api/api/versions_api_test.go @@ -721,9 +721,8 @@ func TestPatchVersion(t *testing.T) { }, ModelSchema: &models.ModelSchema{ Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", ModelPredictionOutput: &models.ModelPredictionOutput{ RankingOutput: &models.RankingOutput{ RankScoreColumn: "score", @@ -776,9 +775,8 @@ func TestPatchVersion(t *testing.T) { }, ModelSchema: &models.ModelSchema{ Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", ModelPredictionOutput: &models.ModelPredictionOutput{ RankingOutput: &models.RankingOutput{ RankScoreColumn: "score", @@ -813,9 +811,8 @@ func TestPatchVersion(t *testing.T) { }, ModelSchema: &models.ModelSchema{ Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", ModelPredictionOutput: &models.ModelPredictionOutput{ RankingOutput: &models.RankingOutput{ RankScoreColumn: "score", @@ -855,9 +852,8 @@ func TestPatchVersion(t *testing.T) { }, ModelSchema: &models.ModelSchema{ Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", ModelPredictionOutput: &models.ModelPredictionOutput{ RankingOutput: &models.RankingOutput{ RankScoreColumn: "score", @@ -889,9 +885,8 @@ func TestPatchVersion(t *testing.T) { }, ModelSchema: &models.ModelSchema{ Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", ModelPredictionOutput: &models.ModelPredictionOutput{ RankingOutput: &models.RankingOutput{ RankScoreColumn: "score", @@ -1450,9 +1445,8 @@ func TestCreateVersion(t *testing.T) { body: models.VersionPost{ ModelSchema: &models.ModelSchema{ Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", ModelPredictionOutput: &models.ModelPredictionOutput{ RankingOutput: &models.RankingOutput{ RankScoreColumn: "score", @@ -1504,9 +1498,8 @@ func TestCreateVersion(t *testing.T) { PythonVersion: DEFAULT_PYTHON_VERSION, ModelSchema: &models.ModelSchema{ Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", ModelPredictionOutput: &models.ModelPredictionOutput{ RankingOutput: &models.RankingOutput{ RankScoreColumn: "score", @@ -1538,9 +1531,8 @@ func TestCreateVersion(t *testing.T) { PythonVersion: DEFAULT_PYTHON_VERSION, ModelSchema: &models.ModelSchema{ Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", ModelPredictionOutput: &models.ModelPredictionOutput{ RankingOutput: &models.RankingOutput{ RankScoreColumn: "score", @@ -1577,9 +1569,8 @@ func TestCreateVersion(t *testing.T) { PythonVersion: DEFAULT_PYTHON_VERSION, ModelSchema: &models.ModelSchema{ Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", ModelPredictionOutput: &models.ModelPredictionOutput{ RankingOutput: &models.RankingOutput{ RankScoreColumn: "score", @@ -1606,9 +1597,8 @@ func TestCreateVersion(t *testing.T) { body: models.VersionPost{ ModelSchema: &models.ModelSchema{ Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", ModelPredictionOutput: &models.ModelPredictionOutput{ RankingOutput: &models.RankingOutput{ RankScoreColumn: "score", diff --git a/api/client/model_schema_spec.go b/api/client/model_schema_spec.go index 9616b1e84..7b1f1f10c 100644 --- a/api/client/model_schema_spec.go +++ b/api/client/model_schema_spec.go @@ -20,7 +20,6 @@ var _ MappedNullable = &SchemaSpec{} // SchemaSpec struct for SchemaSpec type SchemaSpec struct { - PredictionIdColumn *string `json:"prediction_id_column,omitempty"` SessionIdColumn *string `json:"session_id_column,omitempty"` RowIdColumn *string `json:"row_id_column,omitempty"` ModelPredictionOutput ModelPredictionOutput `json:"model_prediction_output"` @@ -49,38 +48,6 @@ func NewSchemaSpecWithDefaults() *SchemaSpec { return &this } -// GetPredictionIdColumn returns the PredictionIdColumn field value if set, zero value otherwise. -func (o *SchemaSpec) 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 *SchemaSpec) 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 *SchemaSpec) 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 *SchemaSpec) SetPredictionIdColumn(v string) { - o.PredictionIdColumn = &v -} - // GetSessionIdColumn returns the SessionIdColumn field value if set, zero value otherwise. func (o *SchemaSpec) GetSessionIdColumn() string { if o == nil || IsNil(o.SessionIdColumn) { @@ -235,9 +202,6 @@ func (o SchemaSpec) MarshalJSON() ([]byte, error) { func (o SchemaSpec) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.PredictionIdColumn) { - toSerialize["prediction_id_column"] = o.PredictionIdColumn - } if !IsNil(o.SessionIdColumn) { toSerialize["session_id_column"] = o.SessionIdColumn } diff --git a/api/cluster/resource/templater_test.go b/api/cluster/resource/templater_test.go index c9c9cd501..760558d4f 100644 --- a/api/cluster/resource/templater_test.go +++ b/api/cluster/resource/templater_test.go @@ -231,10 +231,9 @@ func TestCreateInferenceServiceSpec(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -859,10 +858,9 @@ func TestCreateInferenceServiceSpec(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, @@ -947,10 +945,9 @@ func TestCreateInferenceServiceSpec(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tags"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tags"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Int64, diff --git a/api/models/model_schema.go b/api/models/model_schema.go index 67b1a01cc..adbfdb8e5 100644 --- a/api/models/model_schema.go +++ b/api/models/model_schema.go @@ -36,7 +36,6 @@ type ModelSchema struct { // SchemaSpec type SchemaSpec struct { - PredictionIDColumn string `json:"prediction_id_column"` SessionIDColumn string `json:"session_id_column"` RowIDColumn string `json:"row_id_column"` ModelPredictionOutput *ModelPredictionOutput `json:"model_prediction_output"` diff --git a/api/service/model_schema_service_test.go b/api/service/model_schema_service_test.go index dd545e9e3..f3d6e6fdc 100644 --- a/api/service/model_schema_service_test.go +++ b/api/service/model_schema_service_test.go @@ -37,9 +37,8 @@ func Test_modelSchemaService_List(t *testing.T) { ModelID: models.ID(1), ID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -60,9 +59,8 @@ func Test_modelSchemaService_List(t *testing.T) { ModelID: models.ID(1), ID: models.ID(2), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -88,9 +86,8 @@ func Test_modelSchemaService_List(t *testing.T) { ModelID: models.ID(1), ID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -111,9 +108,8 @@ func Test_modelSchemaService_List(t *testing.T) { ModelID: models.ID(1), ID: models.ID(2), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -182,9 +178,8 @@ func Test_modelSchemaService_Save(t *testing.T) { storageMock.On("Save", mock.Anything, &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -204,9 +199,8 @@ func Test_modelSchemaService_Save(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -230,9 +224,8 @@ func Test_modelSchemaService_Save(t *testing.T) { modelSchema: &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -254,9 +247,8 @@ func Test_modelSchemaService_Save(t *testing.T) { ID: models.ID(1), ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -281,9 +273,8 @@ func Test_modelSchemaService_Save(t *testing.T) { storageMock.On("Save", mock.Anything, &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -307,9 +298,8 @@ func Test_modelSchemaService_Save(t *testing.T) { modelSchema: &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -364,9 +354,8 @@ func Test_modelSchemaService_Delete(t *testing.T) { storageMock.On("Delete", mock.Anything, &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -390,9 +379,8 @@ func Test_modelSchemaService_Delete(t *testing.T) { modelSchema: &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -418,9 +406,8 @@ func Test_modelSchemaService_Delete(t *testing.T) { storageMock.On("Delete", mock.Anything, &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -444,9 +431,8 @@ func Test_modelSchemaService_Delete(t *testing.T) { modelSchema: &models.ModelSchema{ ModelID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -499,9 +485,8 @@ func Test_modelSchemaService_FindByID(t *testing.T) { ModelID: models.ID(1), ID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, @@ -529,9 +514,8 @@ func Test_modelSchemaService_FindByID(t *testing.T) { ModelID: models.ID(1), ID: models.ID(1), Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", + SessionIDColumn: "session_id", + RowIDColumn: "row_id", FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Boolean, diff --git a/api/storage/model_schema_storage_test.go b/api/storage/model_schema_storage_test.go index 776fabd96..da4783577 100644 --- a/api/storage/model_schema_storage_test.go +++ b/api/storage/model_schema_storage_test.go @@ -43,10 +43,9 @@ func Test_modelSchemaStorage_Save(t *testing.T) { modelSchema := &models.ModelSchema{ ModelID: m.ID, Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tag"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tag"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Float64, @@ -122,10 +121,9 @@ func Test_modelSchemaStorage_SaveThroughVersion(t *testing.T) { ModelSchema: &models.ModelSchema{ ModelID: m.ID, Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tag"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tag"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Float64, @@ -208,10 +206,9 @@ func Test_modelSchemaStorage_FindAll_Delete(t *testing.T) { { ModelID: m.ID, Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tag"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tag"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Float64, @@ -233,10 +230,9 @@ func Test_modelSchemaStorage_FindAll_Delete(t *testing.T) { { ModelID: m.ID, Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tag"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tag"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Float64, @@ -255,10 +251,9 @@ func Test_modelSchemaStorage_FindAll_Delete(t *testing.T) { { ModelID: m.ID, Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tag"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tag"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Float64, @@ -325,10 +320,9 @@ func Test_modelSchemaStorage_FindByID(t *testing.T) { modelSchema := &models.ModelSchema{ ModelID: m.ID, Spec: &models.SchemaSpec{ - PredictionIDColumn: "prediction_id", - SessionIDColumn: "session_id", - RowIDColumn: "row_id", - TagColumns: []string{"tag"}, + SessionIDColumn: "session_id", + RowIDColumn: "row_id", + TagColumns: []string{"tag"}, FeatureTypes: map[string]models.ValueType{ "featureA": models.Float64, "featureB": models.Float64, diff --git a/python/sdk/client/models/regression_output.py b/python/sdk/client/models/regression_output.py index 68fe5b604..ca12db692 100644 --- a/python/sdk/client/models/regression_output.py +++ b/python/sdk/client/models/regression_output.py @@ -31,7 +31,7 @@ class RegressionOutput(BaseModel): RegressionOutput """ # noqa: E501 prediction_score_column: StrictStr - actual_score_column: StrictStr + actual_score_column: Optional[StrictStr] = None output_class: ModelPredictionOutputClass __properties: ClassVar[List[str]] = ["prediction_score_column", "actual_score_column", "output_class"] diff --git a/python/sdk/client/models/schema_spec.py b/python/sdk/client/models/schema_spec.py index a50dff7b3..e74472d90 100644 --- a/python/sdk/client/models/schema_spec.py +++ b/python/sdk/client/models/schema_spec.py @@ -31,13 +31,12 @@ class SchemaSpec(BaseModel): """ SchemaSpec """ # noqa: E501 - prediction_id_column: Optional[StrictStr] = None session_id_column: Optional[StrictStr] = None row_id_column: Optional[StrictStr] = None model_prediction_output: ModelPredictionOutput tag_columns: Optional[List[StrictStr]] = None feature_types: Dict[str, ValueType] - __properties: ClassVar[List[str]] = ["prediction_id_column", "session_id_column", "row_id_column", "model_prediction_output", "tag_columns", "feature_types"] + __properties: ClassVar[List[str]] = ["session_id_column", "row_id_column", "model_prediction_output", "tag_columns", "feature_types"] model_config = { "populate_by_name": True, @@ -90,7 +89,6 @@ def from_dict(cls, obj: Dict) -> Self: return cls.model_validate(obj) _obj = cls.model_validate({ - "prediction_id_column": obj.get("prediction_id_column"), "session_id_column": obj.get("session_id_column"), "row_id_column": obj.get("row_id_column"), "model_prediction_output": ModelPredictionOutput.from_dict(obj.get("model_prediction_output")) if obj.get("model_prediction_output") is not None else None, diff --git a/python/sdk/merlin/model_schema.py b/python/sdk/merlin/model_schema.py index 40783efd2..595e5fc69 100644 --- a/python/sdk/merlin/model_schema.py +++ b/python/sdk/merlin/model_schema.py @@ -11,7 +11,7 @@ PredictionOutput, RankingOutput, RegressionOutput, - ValueType, DEFAULT_PREDICTION_ID_COLUMN, DEFAULT_SESSION_ID_COLUMN, DEFAULT_ROW_ID_COLUMN, + ValueType, DEFAULT_SESSION_ID_COLUMN, DEFAULT_ROW_ID_COLUMN, ) from merlin.util import autostr, extract_optional_value_with_default @@ -56,7 +56,6 @@ def from_model_schema_response( model_id=response.model_id, spec=InferenceSchema( feature_types=feature_types, - prediction_id_column=extract_optional_value_with_default(response_spec.prediction_id_column, DEFAULT_PREDICTION_ID_COLUMN), session_id_column=extract_optional_value_with_default(response_spec.session_id_column, DEFAULT_SESSION_ID_COLUMN), row_id_column=extract_optional_value_with_default(response_spec.row_id_column, DEFAULT_ROW_ID_COLUMN), tag_columns=response_spec.tag_columns, @@ -151,7 +150,6 @@ def to_client_model_schema(self) -> client.ModelSchema: id=self.id, model_id=self.model_id, spec=client.SchemaSpec( - prediction_id_column=self.spec.prediction_id_column, session_id_column=self.spec.session_id_column, row_id_column=self.spec.row_id_column, tag_columns=self.spec.tag_columns, diff --git a/python/sdk/merlin/observability/inference.py b/python/sdk/merlin/observability/inference.py index 16caf2bcf..cb4fe99f1 100644 --- a/python/sdk/merlin/observability/inference.py +++ b/python/sdk/merlin/observability/inference.py @@ -8,7 +8,6 @@ from dataclasses_json import DataClassJsonMixin, config, dataclass_json -DEFAULT_PREDICTION_ID_COLUMN = "prediction_id" DEFAULT_SESSION_ID_COLUMN = "session_id" DEFAULT_ROW_ID_COLUMN = "row_id" @@ -272,7 +271,6 @@ class InferenceSchema: ) session_id_column: str = DEFAULT_SESSION_ID_COLUMN row_id_column: str = DEFAULT_ROW_ID_COLUMN - prediction_id_column: str = DEFAULT_PREDICTION_ID_COLUMN tag_columns: Optional[List[str]] = None @property @@ -290,8 +288,18 @@ def ground_truth_columns(self) -> List[str]: def preprocess( self, df: pd.DataFrame, observation_types: List[ObservationType] ) -> pd.DataFrame: - if observation_types != ObservationType.FEATURE: - df[self.prediction_id_column] = df[self.session_id_column] + "_" + df[self.row_id_column] return self.model_prediction_output.preprocess( df, self.session_id_column, self.row_id_column, observation_types ) + +def add_prediction_id_column(df: pd.DataFrame, session_id_column: str, row_id_column: str, prediction_id_column: str) -> pd.DataFrame: + """ + Add prediction id column to the dataframe. + :param df: Input dataframe. + :param session_id_column: Name of the column containing the session id. + :param row_id_column: Name of the column containing the row id. + :param prediction_id_column: Name of the prediction id column. + :return: Dataframe with prediction id column. + """ + df[prediction_id_column] = df[session_id_column] + "_" + df[row_id_column] + return df \ No newline at end of file diff --git a/python/sdk/test/integration_test.py b/python/sdk/test/integration_test.py index 3645986b3..1231a2c9b 100644 --- a/python/sdk/test/integration_test.py +++ b/python/sdk/test/integration_test.py @@ -187,7 +187,6 @@ def test_model_schema( "featureC": ValueType.STRING, "featureD": ValueType.BOOLEAN }, - prediction_id_column="prediction_id", model_prediction_output=BinaryClassificationOutput( prediction_score_column="score", actual_score_column="actual", diff --git a/python/sdk/test/model_schema_test.py b/python/sdk/test/model_schema_test.py index 8a767ca7d..233cf97d4 100644 --- a/python/sdk/test/model_schema_test.py +++ b/python/sdk/test/model_schema_test.py @@ -12,7 +12,6 @@ id=1, model_id=1, spec=client.SchemaSpec( - prediction_id_column="prediction_id", session_id_column="session_id", row_id_column="row_id", tag_columns=["tags"], @@ -38,7 +37,6 @@ id=1, model_id=1, spec=InferenceSchema( - prediction_id_column="prediction_id", session_id_column="session_id", row_id_column="row_id", tag_columns=["tags"], @@ -64,7 +62,6 @@ id=2, model_id=1, spec=client.SchemaSpec( - prediction_id_column="prediction_id", session_id_column="session_id", row_id_column="row_id", tag_columns=["tags", "extras"], @@ -87,7 +84,6 @@ id=2, model_id=1, spec=InferenceSchema( - prediction_id_column="prediction_id", session_id_column="session_id", row_id_column="row_id", tag_columns=["tags", "extras"], @@ -110,7 +106,6 @@ id=3, model_id=1, spec=client.SchemaSpec( - prediction_id_column="prediction_id", session_id_column="session_id", row_id_column="row_id", tag_columns=["tags", "extras"], @@ -133,7 +128,6 @@ id=3, model_id=1, spec=InferenceSchema( - prediction_id_column="prediction_id", session_id_column="session_id", row_id_column="row_id", tag_columns=["tags", "extras"], @@ -156,7 +150,6 @@ id=3, model_id=1, spec=client.SchemaSpec( - prediction_id_column="prediction_id", session_id_column="session_id", row_id_column="row_id", tag_columns=["tags", "extras"], diff --git a/python/sdk/test/model_test.py b/python/sdk/test/model_test.py index 179daaab5..acc3807cf 100644 --- a/python/sdk/test/model_test.py +++ b/python/sdk/test/model_test.py @@ -1321,7 +1321,6 @@ class TestModel: id=3, model_id=1, spec=client.SchemaSpec( - prediction_id_column="prediction_id", tag_columns=["tags", "extras"], feature_types={ "featureA": client.ValueType.FLOAT64, @@ -1342,7 +1341,6 @@ class TestModel: id=3, model_id=1, spec=InferenceSchema( - prediction_id_column="prediction_id", tag_columns=["tags", "extras"], feature_types={ "featureA": ValueType.FLOAT64, diff --git a/swagger.yaml b/swagger.yaml index b572803b7..9f9a38bd8 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -1383,8 +1383,6 @@ components: - model_prediction_output - feature_types properties: - prediction_id_column: - type: string session_id_column: type: string row_id_column: