forked from kubeflow/model-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.go
More file actions
176 lines (132 loc) · 10.9 KB
/
api.go
File metadata and controls
176 lines (132 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
package api
import "github.com/kubeflow/model-registry/pkg/openapi"
// ListOptions provides options for listing entities with pagination and sorting.
// It includes parameters such as PageSize, OrderBy, SortOrder, and NextPageToken.
type ListOptions struct {
PageSize *int32 // The maximum number of entities to be returned per page.
OrderBy *string // The field by which entities are ordered.
SortOrder *string // The sorting order, which can be "ASC" (ascending) or "DESC" (descending).
NextPageToken *string // A token to retrieve the next page of entities in a paginated result set.
FilterQuery *string // A filter query to restrict results based on entity properties.
}
// ModelRegistryApi defines the external API for the Model Registry library
type ModelRegistryApi interface {
// REGISTERED MODEL
// UpsertRegisteredModel create or update a registered model, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
UpsertRegisteredModel(registeredModel *openapi.RegisteredModel) (*openapi.RegisteredModel, error)
// GetRegisteredModelById retrieve RegisteredModel by id
GetRegisteredModelById(id string) (*openapi.RegisteredModel, error)
// GetRegisteredModelByInferenceService retrieve a RegisteredModel by inference service id
GetRegisteredModelByInferenceService(inferenceServiceId string) (*openapi.RegisteredModel, error)
// GetRegisteredModelByParams find RegisteredModel instances that match the provided optional params
GetRegisteredModelByParams(name *string, externalId *string) (*openapi.RegisteredModel, error)
// GetRegisteredModels return all ModelArtifact properly ordered and sized based on listOptions param.
GetRegisteredModels(listOptions ListOptions) (*openapi.RegisteredModelList, error)
// MODEL VERSION
// UpsertModelVersion create a new Model Version or update a Model Version associated to a
// specific RegisteredModel identified by registeredModelId parameter
UpsertModelVersion(modelVersion *openapi.ModelVersion, registeredModelId *string) (*openapi.ModelVersion, error)
// GetModelVersionById retrieve ModelVersion by id
GetModelVersionById(id string) (*openapi.ModelVersion, error)
// GetModelVersionByInferenceService retrieve a ModelVersion by inference service id
GetModelVersionByInferenceService(inferenceServiceId string) (*openapi.ModelVersion, error)
// GetModelVersionByParams find ModelVersion instances that match the provided optional params
GetModelVersionByParams(versionName *string, registeredModelId *string, externalId *string) (*openapi.ModelVersion, error)
// GetModelVersions return all ModelArtifact properly ordered and sized based on listOptions param.
// if registeredModelId is provided, return all ModelVersion instances belonging to a specific RegisteredModel
GetModelVersions(listOptions ListOptions, registeredModelId *string) (*openapi.ModelVersionList, error)
// ARTIFACT
// UpsertModelVersionArtifact create or update an Artifact for a specific ModelVersion, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
UpsertModelVersionArtifact(artifact *openapi.Artifact, modelVersionId string) (*openapi.Artifact, error)
// UpsertArtifact create or update an Artifact, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
UpsertArtifact(artifact *openapi.Artifact) (*openapi.Artifact, error)
// GetArtifactById retrieve Artifact by id
GetArtifactById(id string) (*openapi.Artifact, error)
// GetArtifactByParams find Artifact instances that match the provided optional params
GetArtifactByParams(artifactName *string, parentResourceId *string, externalId *string) (*openapi.Artifact, error)
// GetArtifacts return all Artifact properly ordered and sized based on listOptions param.
// if parentResourceId is provided, return all Artifact instances belonging to a specific parent resource
GetArtifacts(artifactType openapi.ArtifactTypeQueryParam, listOptions ListOptions, parentResourceId *string) (*openapi.ArtifactList, error)
// MODEL ARTIFACT
// UpsertModelArtifact creates or inserts an Artifact
UpsertModelArtifact(modelArtifact *openapi.ModelArtifact) (*openapi.ModelArtifact, error)
// GetModelArtifactById retrieve ModelArtifact by id
GetModelArtifactById(id string) (*openapi.ModelArtifact, error)
// GetModelArtifactByInferenceService retrieve a ModelArtifact by inference service id
GetModelArtifactByInferenceService(inferenceServiceId string) (*openapi.ModelArtifact, error)
// GetModelArtifactByParams find ModelArtifact instances that match the provided optional params
GetModelArtifactByParams(artifactName *string, parentResourceId *string, externalId *string) (*openapi.ModelArtifact, error)
// GetModelArtifacts return all ModelArtifact properly ordered and sized based on listOptions param.
// if parentResourceId is provided, return all ModelArtifact instances belonging to a specific parent resource
GetModelArtifacts(listOptions ListOptions, parentResourceId *string) (*openapi.ModelArtifactList, error)
// SERVING ENVIRONMENT
// UpsertServingEnvironment create or update a serving environmet, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
UpsertServingEnvironment(registeredModel *openapi.ServingEnvironment) (*openapi.ServingEnvironment, error)
// GetInferenceServiceById retrieve ServingEnvironment by id
GetServingEnvironmentById(id string) (*openapi.ServingEnvironment, error)
// GetServingEnvironmentByParams find ServingEnvironment instances that match the provided optional params
GetServingEnvironmentByParams(name *string, externalId *string) (*openapi.ServingEnvironment, error)
// GetServingEnvironments return all ServingEnvironment properly ordered and sized based on listOptions param
GetServingEnvironments(listOptions ListOptions) (*openapi.ServingEnvironmentList, error)
// INFERENCE SERVICE
// UpsertInferenceService create or update an inference service, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
// inferenceService.servingEnvironmentId defines the ServingEnvironment to be associated as parent ownership
// to the newly created InferenceService.
UpsertInferenceService(inferenceService *openapi.InferenceService) (*openapi.InferenceService, error)
// GetInferenceServiceById retrieve InferenceService by id
GetInferenceServiceById(id string) (*openapi.InferenceService, error)
// GetInferenceServiceByParams find InferenceService instances that match the provided optional params
GetInferenceServiceByParams(name *string, parentResourceId *string, externalId *string) (*openapi.InferenceService, error)
// GetInferenceServices return all InferenceService properly ordered and sized based on listOptions param
// if servingEnvironmentId is provided, return all InferenceService instances belonging to a specific ServingEnvironment
// if runtime is provided, filter those InferenceService having that runtime
GetInferenceServices(listOptions ListOptions, servingEnvironmentId *string, runtime *string) (*openapi.InferenceServiceList, error)
// SERVE MODEL
// UpsertServeModel create or update a serve model, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
// inferenceServiceId defines the InferenceService to be linked to the newly created ServeModel.
UpsertServeModel(serveModel *openapi.ServeModel, inferenceServiceId *string) (*openapi.ServeModel, error)
// GetServeModelById retrieve ServeModel by id
GetServeModelById(id string) (*openapi.ServeModel, error)
// GetServeModels get all ServeModel objects properly ordered and sized based on listOptions param.
// if inferenceServiceId is provided, return all ServeModel instances belonging to a specific InferenceService
GetServeModels(listOptions ListOptions, inferenceServiceId *string) (*openapi.ServeModelList, error)
// EXPERIMENT
// UpsertExperiment create or update an experiment, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
UpsertExperiment(experiment *openapi.Experiment) (*openapi.Experiment, error)
// GetExperimentById retrieve Experiment by id
GetExperimentById(id string) (*openapi.Experiment, error)
// GetExperimentByParams find Experiment instances that match the provided optional params
GetExperimentByParams(name *string, externalId *string) (*openapi.Experiment, error)
// GetExperiments return all Experiment properly ordered and sized based on listOptions param
GetExperiments(listOptions ListOptions) (*openapi.ExperimentList, error)
// EXPERIMENT RUN
// UpsertExperimentRun create or update an experiment run, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
// experimentId defines the Experiment to be associated as parent ownership to the newly created ExperimentRun.
UpsertExperimentRun(experimentRun *openapi.ExperimentRun, experimentId *string) (*openapi.ExperimentRun, error)
// GetExperimentRunById retrieve ExperimentRun by id
GetExperimentRunById(id string) (*openapi.ExperimentRun, error)
// GetExperimentRunByParams find ExperimentRun instances that match the provided optional params
GetExperimentRunByParams(name *string, experimentId *string, externalId *string) (*openapi.ExperimentRun, error)
// GetExperimentRuns return all ExperimentRun properly ordered and sized based on listOptions param.
// if experimentId is provided, return all ExperimentRun instances belonging to a specific Experiment
GetExperimentRuns(listOptions ListOptions, experimentId *string) (*openapi.ExperimentRunList, error)
// EXPERIMENT RUN ARTIFACTS
// UpsertExperimentRunArtifact create or update an Artifact for a specific ExperimentRun, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
UpsertExperimentRunArtifact(artifact *openapi.Artifact, experimentRunId string) (*openapi.Artifact, error)
// GetExperimentRunArtifacts return all Artifact properly ordered and sized based on listOptions param.
// if experimentRunId is provided, return all Artifact instances belonging to a specific ExperimentRun
GetExperimentRunArtifacts(artifactType openapi.ArtifactTypeQueryParam, listOptions ListOptions, experimentRunId *string) (*openapi.ArtifactList, error)
// EXPERIMENT RUN METRIC HISTORY
// GetExperimentRunMetricHistory return metric history for a specific ExperimentRun properly ordered and sized based on listOptions param.
// if name is provided, filter metrics by name. if stepIds is provided, filter metrics by step ids
GetExperimentRunMetricHistory(name *string, stepIds *string, listOptions ListOptions, experimentRunId *string) (*openapi.MetricList, error)
}