superb-ai-onprem 0.9.0__py3-none-any.whl → 0.10.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of superb-ai-onprem might be problematic. Click here for more details.

Files changed (65) hide show
  1. spb_onprem/__init__.py +39 -9
  2. spb_onprem/_version.py +2 -2
  3. spb_onprem/data/entities/__init__.py +2 -0
  4. spb_onprem/data/entities/data.py +2 -0
  5. spb_onprem/data/entities/data_annotation_stats.py +8 -0
  6. spb_onprem/data/params/data_list.py +7 -2
  7. spb_onprem/data/params/update_data.py +11 -0
  8. spb_onprem/data/params/update_data_slice.py +14 -2
  9. spb_onprem/data/queries.py +12 -1
  10. spb_onprem/data/service.py +9 -0
  11. spb_onprem/entities.py +24 -6
  12. spb_onprem/models/__init__.py +8 -3
  13. spb_onprem/models/entities/__init__.py +9 -0
  14. spb_onprem/models/entities/model.py +32 -0
  15. spb_onprem/models/entities/model_page_info.py +14 -0
  16. spb_onprem/models/entities/model_train_class.py +15 -0
  17. spb_onprem/models/params/__init__.py +16 -4
  18. spb_onprem/models/params/create_model.py +70 -0
  19. spb_onprem/models/params/delete_model.py +11 -8
  20. spb_onprem/models/params/model.py +17 -0
  21. spb_onprem/models/params/models.py +60 -0
  22. spb_onprem/models/params/pin_model.py +17 -0
  23. spb_onprem/models/params/unpin_model.py +17 -0
  24. spb_onprem/models/params/update_model.py +61 -0
  25. spb_onprem/models/queries.py +224 -19
  26. spb_onprem/models/service.py +251 -30
  27. spb_onprem/reports/__init__.py +25 -0
  28. spb_onprem/reports/entities/__init__.py +10 -0
  29. spb_onprem/reports/entities/analytics_report.py +22 -0
  30. spb_onprem/reports/entities/analytics_report_item.py +30 -0
  31. spb_onprem/reports/entities/analytics_report_page_info.py +14 -0
  32. spb_onprem/reports/params/__init__.py +29 -0
  33. spb_onprem/reports/params/analytics_report.py +17 -0
  34. spb_onprem/reports/params/analytics_reports.py +87 -0
  35. spb_onprem/reports/params/create_analytics_report.py +35 -0
  36. spb_onprem/reports/params/create_analytics_report_item.py +47 -0
  37. spb_onprem/reports/params/delete_analytics_report.py +17 -0
  38. spb_onprem/reports/params/delete_analytics_report_item.py +20 -0
  39. spb_onprem/reports/params/update_analytics_report.py +38 -0
  40. spb_onprem/reports/params/update_analytics_report_item.py +46 -0
  41. spb_onprem/reports/queries.py +239 -0
  42. spb_onprem/reports/service.py +328 -0
  43. spb_onprem/searches.py +18 -0
  44. {superb_ai_onprem-0.9.0.dist-info → superb_ai_onprem-0.10.0.dist-info}/METADATA +53 -9
  45. {superb_ai_onprem-0.9.0.dist-info → superb_ai_onprem-0.10.0.dist-info}/RECORD +48 -38
  46. spb_onprem/models/entities.py +0 -9
  47. spb_onprem/models/params/get_models.py +0 -29
  48. spb_onprem/predictions/__init__.py +0 -7
  49. spb_onprem/predictions/entities.py +0 -11
  50. spb_onprem/predictions/params/__init__.py +0 -15
  51. spb_onprem/predictions/params/create_prediction_set.py +0 -44
  52. spb_onprem/predictions/params/delete_prediction_from_data.py +0 -20
  53. spb_onprem/predictions/params/delete_prediction_set.py +0 -14
  54. spb_onprem/predictions/params/get_prediction_set.py +0 -14
  55. spb_onprem/predictions/params/get_prediction_sets.py +0 -29
  56. spb_onprem/predictions/params/update_prediction_set_data_info.py +0 -28
  57. spb_onprem/predictions/queries.py +0 -110
  58. spb_onprem/predictions/service.py +0 -225
  59. tests/models/__init__.py +0 -1
  60. tests/models/test_model_service.py +0 -249
  61. tests/predictions/__init__.py +0 -1
  62. tests/predictions/test_prediction_service.py +0 -359
  63. {superb_ai_onprem-0.9.0.dist-info → superb_ai_onprem-0.10.0.dist-info}/WHEEL +0 -0
  64. {superb_ai_onprem-0.9.0.dist-info → superb_ai_onprem-0.10.0.dist-info}/licenses/LICENSE +0 -0
  65. {superb_ai_onprem-0.9.0.dist-info → superb_ai_onprem-0.10.0.dist-info}/top_level.txt +0 -0
spb_onprem/__init__.py CHANGED
@@ -10,9 +10,8 @@ from .slices.service import SliceService
10
10
  from .activities.service import ActivityService
11
11
  from .exports.service import ExportService
12
12
  from .contents.service import ContentService
13
- from .predictions.service import PredictionService
14
13
  from .models.service import ModelService
15
- from .inferences.service import InferService
14
+ from .reports.service import ReportService
16
15
 
17
16
  # Core Entities and Enums
18
17
  from .entities import (
@@ -21,7 +20,6 @@ from .entities import (
21
20
  Scene,
22
21
  Annotation,
23
22
  AnnotationVersion,
24
- Prediction,
25
23
  DataMeta,
26
24
  Dataset,
27
25
  Slice,
@@ -31,9 +29,9 @@ from .entities import (
31
29
  Export,
32
30
  Content,
33
31
  Frame,
34
- Model,
35
32
  Comment,
36
33
  Reply,
34
+ DataAnnotationStat,
37
35
 
38
36
  # Enums
39
37
  DataType,
@@ -47,6 +45,24 @@ from .entities import (
47
45
  CommentStatus,
48
46
  )
49
47
 
48
+ # Models and Reports Entities
49
+ from .models import (
50
+ Model,
51
+ ModelTrainClass,
52
+ ModelPageInfo,
53
+ ModelsFilter,
54
+ ModelsFilterOptions,
55
+ )
56
+
57
+ from .reports import (
58
+ AnalyticsReport,
59
+ AnalyticsReportItem,
60
+ AnalyticsReportItemType,
61
+ AnalyticsReportPageInfo,
62
+ AnalyticsReportsFilter,
63
+ AnalyticsReportsFilterOptions,
64
+ )
65
+
50
66
  # Filters
51
67
  from .searches import (
52
68
  DateTimeRangeFilterOption,
@@ -80,6 +96,7 @@ from .searches import (
80
96
  ActivitiesFilterOptions,
81
97
  ExportFilter,
82
98
  ExportFilterOptions,
99
+ AnnotationCountsFilter
83
100
  )
84
101
 
85
102
  __all__ = (
@@ -90,16 +107,14 @@ __all__ = (
90
107
  "ActivityService",
91
108
  "ExportService",
92
109
  "ContentService",
93
- "PredictionService",
94
110
  "ModelService",
95
- "InferService",
111
+ "ReportService",
96
112
 
97
113
  # Core Entities
98
114
  "Data",
99
115
  "Scene",
100
116
  "Annotation",
101
117
  "AnnotationVersion",
102
- "Prediction",
103
118
  "DataMeta",
104
119
  "Dataset",
105
120
  "Slice",
@@ -109,10 +124,24 @@ __all__ = (
109
124
  "Export",
110
125
  "Content",
111
126
  "Frame",
112
- "PredictionSet",
113
- "Model",
114
127
  "Comment",
115
128
  "Reply",
129
+ "DataAnnotationStat",
130
+
131
+ # Models Entities
132
+ "Model",
133
+ "ModelTrainClass",
134
+ "ModelPageInfo",
135
+ "ModelsFilter",
136
+ "ModelsFilterOptions",
137
+
138
+ # Reports Entities
139
+ "AnalyticsReport",
140
+ "AnalyticsReportItem",
141
+ "AnalyticsReportItemType",
142
+ "AnalyticsReportPageInfo",
143
+ "AnalyticsReportsFilter",
144
+ "AnalyticsReportsFilterOptions",
116
145
 
117
146
  # Enums
118
147
  "DataType",
@@ -157,4 +186,5 @@ __all__ = (
157
186
  "ActivitiesFilterOptions",
158
187
  "ExportFilter",
159
188
  "ExportFilterOptions",
189
+ "AnnotationCountsFilter",
160
190
  )
spb_onprem/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.9.0'
32
- __version_tuple__ = version_tuple = (0, 9, 0)
31
+ __version__ = version = '0.10.0'
32
+ __version_tuple__ = version_tuple = (0, 10, 0)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -5,6 +5,7 @@ from .data import Data
5
5
  from .scene import Scene
6
6
  from .data_slice import DataSlice
7
7
  from .frame import Frame
8
+ from .data_annotation_stats import DataAnnotationStat
8
9
 
9
10
 
10
11
  __all__ = (
@@ -17,4 +18,5 @@ __all__ = (
17
18
  "Reply",
18
19
  "DataMeta",
19
20
  "DataSlice",
21
+ "DataAnnotationStat",
20
22
  )
@@ -7,6 +7,7 @@ from .data_meta import DataMeta
7
7
  from .data_slice import DataSlice
8
8
  from .frame import Frame
9
9
  from spb_onprem.contents.entities import BaseContent
10
+ from .data_annotation_stats import DataAnnotationStat
10
11
 
11
12
  class Data(CustomBaseModel):
12
13
  """
@@ -28,6 +29,7 @@ class Data(CustomBaseModel):
28
29
 
29
30
  # 어노테이션 및 예측
30
31
  annotation: Optional[Annotation] = Field(None, description="어노테이션 데이터")
32
+ annotation_stats: Optional[List[AnnotationStat]] = Field(None, alias="annotationStats", description="어노테이션 통계 정보")
31
33
 
32
34
  # 메타데이터
33
35
  meta: Optional[List[DataMeta]] = Field(None, description="커스텀 메타데이터 목록")
@@ -0,0 +1,8 @@
1
+
2
+
3
+ class DataAnnotationStat(CustomBaseModel):
4
+ type: Optional[str] = Field(None, description="어노테이션 타입")
5
+ group: Optional[str] = Field(None, description="어노테이션 그룹")
6
+ annotation_class: Optional[str] = Field(None, alias="annotationClass", description="어노테이션 클래스")
7
+ sub_class: Optional[str] = Field(None, alias="subClass", description="어노테이션 서브 클래스")
8
+ count: Optional[int] = Field(None, description="어노테이션 개수")
@@ -173,10 +173,14 @@ class DistanceCountFilter(CustomBaseModel):
173
173
  distance_range: NumericRangeFilter = Field(..., alias="distanceRange")
174
174
  count_range: NumericRangeFilter = Field(..., alias="countRange")
175
175
 
176
- class FrameCountsFilter(CustomBaseModel):
176
+
177
+ class AnnotationCountsFilter(CustomBaseModel):
177
178
  annotation_class: Optional[List[CountFilter]] = Field(None, alias="class")
178
179
  group: Optional[List[CountFilter]] = None
179
180
  sub_class: Optional[List[CountFilter]] = Field(None, alias="subClass")
181
+
182
+
183
+ class FrameCountsFilter(AnnotationCountsFilter):
180
184
  distance: Optional[List[DistanceCountFilter]] = None
181
185
 
182
186
  # === Frame 필터 ===
@@ -227,6 +231,7 @@ class DataFilterOptions(CustomBaseModel):
227
231
  # 메타데이터 및 기타
228
232
  meta: Optional[MetaFilter] = Field(None, description="커스텀 메타데이터 필터")
229
233
  assigned_to_user: Optional[str] = Field(None, alias="assignedToUser", description="할당된 사용자")
234
+ annotation_counts: Optional[AnnotationCountsFilter] = Field(None, alias="annotationCounts", description="어노테이션 개수 필터")
230
235
 
231
236
  class DataSliceStatusFilterOption(CustomBaseModel):
232
237
  status_in: Optional[List[str]] = Field(None, alias="in")
@@ -261,6 +266,7 @@ class DataSlicePropertiesFilter(CustomBaseModel):
261
266
  comments: Optional[DataSliceCommentFilterOption] = None
262
267
  meta: Optional[MetaFilter] = None
263
268
  assigned_to_user: Optional[str] = Field(None, alias="assignedToUser")
269
+ annotation_counts: Optional[AnnotationCountsFilter] = Field(None, alias="annotationCounts")
264
270
 
265
271
  class DataSliceFilter(CustomBaseModel):
266
272
  id: str
@@ -270,7 +276,6 @@ class DataSliceFilter(CustomBaseModel):
270
276
 
271
277
  class FrameFilter(CustomBaseModel):
272
278
  conditions: Optional[FrameFilterOptions] = None
273
- mode: Optional[Union[str, Literal["INDIVIDUAL_FRAMES", "DATA_SUMMARY"]]] = "INDIVIDUAL_FRAMES"
274
279
  matching_frame_count: Optional[NumericRangeFilter] = Field(None, alias="matchingFrameCount")
275
280
 
276
281
 
@@ -9,6 +9,7 @@ from spb_onprem.base_types import (
9
9
  )
10
10
  from spb_onprem.data.entities import (
11
11
  DataMeta,
12
+ DataAnnotationStat,
12
13
  )
13
14
 
14
15
 
@@ -23,6 +24,10 @@ def update_params(
23
24
  Optional[List[DataMeta]],
24
25
  UndefinedType
25
26
  ] = Undefined,
27
+ annotation_stats: Union[
28
+ Optional[List[DataAnnotationStat]],
29
+ UndefinedType
30
+ ] = Undefined
26
31
  ):
27
32
  """Make the variables for the updateData query.
28
33
 
@@ -31,6 +36,7 @@ def update_params(
31
36
  data_id (str): The ID of the data.
32
37
  key (str): The key of the data.
33
38
  meta (List[DataMeta]): The meta of the data.
39
+ annotation_stats (List[DataAnnotationStat]): The annotation stats of the data.
34
40
  """
35
41
  variables = {
36
42
  "datasetId": dataset_id,
@@ -52,4 +58,9 @@ def update_params(
52
58
  for meta_item in meta
53
59
  ] if meta is not None else None
54
60
 
61
+ if annotation_stats is not Undefined:
62
+ variables["annotation_stats"] = [
63
+ stat.model_dump(by_alias=True, exclude_unset=True) for stat in annotation_stats
64
+ ] if annotation_stats is not None else None
65
+
55
66
  return variables
@@ -1,8 +1,11 @@
1
- from typing import Any, Optional, Union
1
+ from typing import Any, Optional, Union, List
2
2
  from spb_onprem.base_types import (
3
3
  Undefined,
4
4
  UndefinedType,
5
5
  )
6
+ from spb_onprem.data.entities import (
7
+ DataAnnotationStat,
8
+ )
6
9
 
7
10
 
8
11
  def update_data_slice_params(
@@ -13,6 +16,10 @@ def update_data_slice_params(
13
16
  Optional[dict],
14
17
  UndefinedType
15
18
  ] = Undefined,
19
+ annotation_stats: Union[
20
+ Optional[List[DataAnnotationStat]],
21
+ UndefinedType
22
+ ] = Undefined
16
23
  ):
17
24
  """Make the variables for the updateDataSlice query.
18
25
 
@@ -27,7 +34,12 @@ def update_data_slice_params(
27
34
  "data_id": data_id,
28
35
  "slice_id": slice_id,
29
36
  }
30
-
37
+
38
+ if annotation_stats is not Undefined:
39
+ params["annotation_stats"] = [
40
+ stat.model_dump(by_alias=True, exclude_unset=True) for stat in annotation_stats
41
+ ] if annotation_stats is not None else None
42
+
31
43
  if meta is not Undefined:
32
44
  params["meta"] = meta
33
45
 
@@ -71,6 +71,13 @@ class Schemas:
71
71
  meta
72
72
  }
73
73
  }
74
+ annotationStats {
75
+ type
76
+ group
77
+ annotationClass
78
+ subClass
79
+ count
80
+ }
74
81
  meta {
75
82
  key
76
83
  type
@@ -172,12 +179,14 @@ class Queries():
172
179
  $data_id: ID!,
173
180
  $key: String,
174
181
  $meta: [DataMetaInput!]
182
+ $annotation_stats: [DataAnnotationStatInput!]
175
183
  ) {{
176
184
  updateData(
177
185
  datasetId: $dataset_id,
178
186
  id: $data_id,
179
187
  key: $key,
180
- meta: $meta
188
+ meta: $meta,
189
+ annotationStats: $annotation_stats,
181
190
  )
182
191
  {{
183
192
  {Schemas.DATA}
@@ -541,12 +550,14 @@ class Queries():
541
550
  $data_id: ID!,
542
551
  $slice_id: ID!,
543
552
  $meta: JSONObject!,
553
+ $annotation_stats: [DataAnnotationStatInput!],
544
554
  ) {{
545
555
  updateDataSlice(
546
556
  datasetId: $dataset_id,
547
557
  dataId: $data_id,
548
558
  sliceId: $slice_id,
549
559
  meta: $meta,
560
+ annotationStats: $annotation_stats,
550
561
  ) {{
551
562
  {Schemas.DATA}
552
563
  }}
@@ -198,6 +198,10 @@ class DataService(BaseService):
198
198
  List[DataMeta],
199
199
  UndefinedType,
200
200
  ] = Undefined,
201
+ annotation_stats: Union[
202
+ Optional[List[DataAnnotationStat]],
203
+ UndefinedType,
204
+ ] = Undefined,
201
205
  ):
202
206
  """Update a data.
203
207
 
@@ -217,6 +221,7 @@ class DataService(BaseService):
217
221
  data_id=data_id,
218
222
  key=key,
219
223
  meta=meta,
224
+ annotation_stats=annotation_stats,
220
225
  )
221
226
  )
222
227
  data = Data.model_validate(response)
@@ -665,6 +670,10 @@ class DataService(BaseService):
665
670
  Optional[dict],
666
671
  UndefinedType
667
672
  ] = Undefined,
673
+ annotation_stats: Union]
674
+ Optional[List[DataAnnotationStat]],
675
+ UndefinedType
676
+ ] = Undefined,
668
677
  ):
669
678
  """Update the metadata of a data slice.
670
679
 
spb_onprem/entities.py CHANGED
@@ -3,12 +3,12 @@ from .data.entities import (
3
3
  Scene,
4
4
  Annotation,
5
5
  AnnotationVersion,
6
- Prediction,
7
6
  DataMeta,
8
7
  DataSlice,
9
8
  Frame,
10
9
  Comment,
11
10
  Reply,
11
+ DataAnnotationStat,
12
12
  )
13
13
  from .data.entities.comment import CommentStatus
14
14
  from .datasets.entities import Dataset
@@ -29,8 +29,17 @@ from .activities.entities import (
29
29
  )
30
30
  from .exports.entities import Export
31
31
  from .contents.entities import Content
32
- from .predictions.entities import PredictionSet
33
- from .models.entities import Model
32
+ from .models.entities import (
33
+ Model,
34
+ ModelTrainClass,
35
+ ModelPageInfo,
36
+ )
37
+ from .reports.entities import (
38
+ AnalyticsReport,
39
+ AnalyticsReportItem,
40
+ AnalyticsReportItemType,
41
+ AnalyticsReportPageInfo,
42
+ )
34
43
 
35
44
  __all__ = [
36
45
  # Core Entities
@@ -38,7 +47,6 @@ __all__ = [
38
47
  "Scene",
39
48
  "Annotation",
40
49
  "AnnotationVersion",
41
- "Prediction",
42
50
  "DataMeta",
43
51
  "DataSlice",
44
52
  "Dataset",
@@ -48,10 +56,20 @@ __all__ = [
48
56
  "Export",
49
57
  "Content",
50
58
  "Frame",
51
- "PredictionSet",
52
- "Model",
53
59
  "Comment",
54
60
  "Reply",
61
+ "DataAnnotationStat",
62
+
63
+ # Models Entities
64
+ "Model",
65
+ "ModelTrainClass",
66
+ "ModelPageInfo",
67
+
68
+ # Reports Entities
69
+ "AnalyticsReport",
70
+ "AnalyticsReportItem",
71
+ "AnalyticsReportItemType",
72
+ "AnalyticsReportPageInfo",
55
73
 
56
74
  # Enums
57
75
  "DataType",
@@ -1,7 +1,12 @@
1
1
  from .service import ModelService
2
- from .entities import Model
2
+ from .entities import Model, ModelTrainClass, ModelPageInfo
3
+ from .params import ModelsFilter, ModelsFilterOptions
3
4
 
4
- __all__ = [
5
+ __all__ = (
5
6
  "ModelService",
6
7
  "Model",
7
- ]
8
+ "ModelTrainClass",
9
+ "ModelPageInfo",
10
+ "ModelsFilter",
11
+ "ModelsFilterOptions",
12
+ )
@@ -0,0 +1,9 @@
1
+ from .model import Model
2
+ from .model_train_class import ModelTrainClass
3
+ from .model_page_info import ModelPageInfo
4
+
5
+ __all__ = (
6
+ "Model",
7
+ "ModelTrainClass",
8
+ "ModelPageInfo",
9
+ )
@@ -0,0 +1,32 @@
1
+ from typing import Optional, List, Any
2
+ from spb_onprem.base_model import CustomBaseModel, Field
3
+ from spb_onprem.contents.entities.base_content import BaseContent
4
+ from spb_onprem.slices.entities.slice import Slice
5
+ from .model_train_class import ModelTrainClass
6
+
7
+
8
+ class Model(CustomBaseModel):
9
+ """
10
+ 모델 엔터티
11
+
12
+ 머신러닝 모델의 정보와 학습 상태, 성능 지표를 포함합니다.
13
+ """
14
+ id: Optional[str] = Field(None, description="모델 고유 식별자")
15
+ dataset_id: Optional[str] = Field(None, alias="datasetId", description="이 모델이 속한 데이터셋 ID")
16
+ baseline_model: Optional[str] = Field(None, alias="baselineModel", description="사용된 베이스라인 모델")
17
+ name: Optional[str] = Field(None, description="모델 이름")
18
+ description: Optional[str] = Field(None, description="모델 설명")
19
+ training_classes: Optional[List[ModelTrainClass]] = Field(None, alias="trainingClasses", description="모델의 학습 클래스")
20
+ training_data_count: Optional[int] = Field(None, alias="trainingDataCount", description="학습용 데이터 수")
21
+ validation_data_count: Optional[int] = Field(None, alias="validationDataCount", description="검증용 데이터 수")
22
+ is_pinned: Optional[bool] = Field(None, alias="isPinned", description="모델 즐겨찾기 고정 여부")
23
+ is_trained: Optional[bool] = Field(None, alias="isTrained", description="모델 학습 완료 여부")
24
+ trained_at: Optional[str] = Field(None, alias="trainedAt", description="모델 학습 완료 일시 (ISO 8601)")
25
+ model_content: Optional[BaseContent] = Field(None, alias="modelContent", description="모델 컨텐츠 베이스")
26
+ created_by: Optional[str] = Field(None, alias="createdBy", description="생성자")
27
+ created_at: Optional[str] = Field(None, alias="createdAt", description="생성일시 (ISO 8601)")
28
+ updated_by: Optional[str] = Field(None, alias="updatedBy", description="수정자")
29
+ updated_at: Optional[str] = Field(None, alias="updatedAt", description="수정일시 (ISO 8601)")
30
+ meta: Optional[Any] = Field(None, description="추가 메타데이터 (JSONObject)")
31
+ training_slices: Optional[List[Slice]] = Field(None, alias="trainingSlices", description="모델의 학습용 슬라이스")
32
+ validation_slices: Optional[List[Slice]] = Field(None, alias="validationSlices", description="모델의 검증용 슬라이스")
@@ -0,0 +1,14 @@
1
+ from typing import Optional, List
2
+ from spb_onprem.base_model import CustomBaseModel, Field
3
+ from .model import Model
4
+
5
+
6
+ class ModelPageInfo(CustomBaseModel):
7
+ """
8
+ 모델 페이지 정보 엔터티
9
+
10
+ 모델 목록 조회 시 페이지네이션 정보를 포함합니다.
11
+ """
12
+ models: Optional[List[Model]] = Field(None, description="쿼리와 일치하는 모델 목록")
13
+ next: Optional[str] = Field(None, description="페이지네이션에 사용할 커서")
14
+ total_count: Optional[int] = Field(None, alias="totalCount", description="쿼리와 일치하는 모델의 총 개수")
@@ -0,0 +1,15 @@
1
+ from typing import Optional
2
+ from spb_onprem.base_model import CustomBaseModel, Field
3
+
4
+
5
+ class ModelTrainClass(CustomBaseModel):
6
+ """
7
+ 모델 학습 클래스 엔터티
8
+
9
+ 모델 학습에 사용되는 클래스별 정보와 성능 지표를 포함합니다.
10
+ """
11
+ class_name: Optional[str] = Field(None, alias="class", description="모델 학습 클래스 이름")
12
+ annotation_type: Optional[str] = Field(None, alias="annotationType", description="어노테이션 타입")
13
+ ap: Optional[float] = Field(None, description="AP (Average Precision) 점수")
14
+ training_annotations_count: Optional[int] = Field(None, alias="trainingAnnotationsCount", description="학습용 어노테이션 수")
15
+ validation_annotations_count: Optional[int] = Field(None, alias="validationAnnotationsCount", description="검증용 어노테이션 수")
@@ -1,7 +1,19 @@
1
- from .get_models import get_models_params
1
+ from .models import models_params, ModelsFilter, ModelsFilterOptions
2
+ from .model import model_params
3
+ from .create_model import create_model_params
4
+ from .update_model import update_model_params
5
+ from .pin_model import pin_model_params
6
+ from .unpin_model import unpin_model_params
2
7
  from .delete_model import delete_model_params
3
8
 
4
- __all__ = [
5
- "get_models_params",
9
+ __all__ = (
10
+ "models_params",
11
+ "model_params",
12
+ "create_model_params",
13
+ "update_model_params",
14
+ "pin_model_params",
15
+ "unpin_model_params",
6
16
  "delete_model_params",
7
- ]
17
+ "ModelsFilter",
18
+ "ModelsFilterOptions",
19
+ )
@@ -0,0 +1,70 @@
1
+ from typing import List, Union, Any, Optional
2
+ from spb_onprem.base_types import Undefined, UndefinedType
3
+ from spb_onprem.models.entities.model_train_class import ModelTrainClass
4
+
5
+
6
+ def create_model_params(
7
+ dataset_id: str,
8
+ name: str,
9
+ baseline_model: str,
10
+ training_slice_ids: List[str],
11
+ validation_slice_ids: List[str],
12
+ description: Union[str, UndefinedType] = Undefined,
13
+ training_classes: Union[List[ModelTrainClass], UndefinedType] = Undefined,
14
+ model_content_id: Union[str, UndefinedType] = Undefined,
15
+ is_trained: Union[bool, UndefinedType] = Undefined,
16
+ trained_at: Union[str, UndefinedType] = Undefined,
17
+ is_pinned: Union[bool, UndefinedType] = Undefined,
18
+ meta: Union[Any, UndefinedType] = Undefined,
19
+ ):
20
+ """Get parameters for creating a model.
21
+
22
+ Args:
23
+ dataset_id: The dataset ID
24
+ name: The model name
25
+ baseline_model: The baseline model used
26
+ training_slice_ids: The IDs of the training slices
27
+ validation_slice_ids: The IDs of the validation slices
28
+ description: Optional model description
29
+ training_classes: Optional training classes
30
+ model_content_id: Optional model content ID
31
+ is_trained: Optional trained status
32
+ trained_at: Optional trained timestamp
33
+ is_pinned: Optional pinned status
34
+ meta: Optional metadata
35
+
36
+ Returns:
37
+ dict: Parameters for creating a model
38
+ """
39
+ params = {
40
+ "datasetId": dataset_id,
41
+ "name": name,
42
+ "baselineModel": baseline_model,
43
+ "trainingSliceIds": training_slice_ids,
44
+ "validationSliceIds": validation_slice_ids,
45
+ }
46
+
47
+ if not isinstance(description, UndefinedType):
48
+ params["description"] = description
49
+
50
+ if not isinstance(training_classes, UndefinedType):
51
+ params["trainingClasses"] = [
52
+ tc.model_dump(by_alias=True, exclude_unset=True) for tc in training_classes
53
+ ] if training_classes is not None else None
54
+
55
+ if not isinstance(model_content_id, UndefinedType):
56
+ params["modelContentId"] = model_content_id
57
+
58
+ if not isinstance(is_trained, UndefinedType):
59
+ params["isTrained"] = is_trained
60
+
61
+ if not isinstance(trained_at, UndefinedType):
62
+ params["trainedAt"] = trained_at
63
+
64
+ if not isinstance(is_pinned, UndefinedType):
65
+ params["isPinned"] = is_pinned
66
+
67
+ if not isinstance(meta, UndefinedType):
68
+ params["meta"] = meta
69
+
70
+ return params
@@ -1,14 +1,17 @@
1
- def delete_model_params(dataset_id: str, model_id: str):
2
- """Generate variables for delete model GraphQL mutation.
1
+ def delete_model_params(
2
+ dataset_id: str,
3
+ model_id: str,
4
+ ):
5
+ """Get parameters for deleting a model.
3
6
 
4
7
  Args:
5
- dataset_id (str): The ID of the dataset.
6
- model_id (str): The ID of the model to delete.
8
+ dataset_id: The dataset ID
9
+ model_id: The model ID
7
10
 
8
11
  Returns:
9
- dict: Variables dictionary for the GraphQL mutation.
12
+ dict: Parameters for deleting a model
10
13
  """
11
14
  return {
12
- "dataset_id": dataset_id,
13
- "id": model_id
14
- }
15
+ "datasetId": dataset_id,
16
+ "id": model_id,
17
+ }
@@ -0,0 +1,17 @@
1
+ def model_params(
2
+ dataset_id: str,
3
+ model_id: str,
4
+ ):
5
+ """Get parameters for retrieving a single model.
6
+
7
+ Args:
8
+ dataset_id: The dataset ID
9
+ model_id: The model ID
10
+
11
+ Returns:
12
+ dict: Parameters for retrieving a model
13
+ """
14
+ return {
15
+ "datasetId": dataset_id,
16
+ "modelId": model_id,
17
+ }