intellif-aihub 0.1.20__py3-none-any.whl → 0.1.21__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 intellif-aihub might be problematic. Click here for more details.

aihub/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.20"
1
+ __version__ = "0.1.21"
aihub/models/eval.py CHANGED
@@ -5,15 +5,28 @@ from typing import Dict, List, Optional
5
5
  from pydantic import BaseModel, Field
6
6
 
7
7
 
8
- class CreateEvalReq(BaseModel):
9
- """创建评测任务"""
8
+ class BaseEvalReq(BaseModel):
9
+ """评测任务基础请求模型"""
10
+ run_id: str = Field(description="运行ID")
11
+ type: str = Field(description="评测类型,支持 'llm' 和 'cv'")
12
+ prediction_artifact_path: str = Field(description="推理产物的路径")
13
+ user_id: int = Field(0, description="用户ID,默认0")
14
+
15
+
16
+ class CreateLLMEvalReq(BaseEvalReq):
17
+ """创建LLM类型评测任务请求"""
18
+ type: str = Field(default="llm", description="评测类型,固定为 'llm'")
10
19
  dataset_id: int = Field(description="数据集ID")
11
20
  dataset_version_id: int = Field(description="数据集版本ID")
12
- prediction_artifact_path: str = Field(description="推理产物的路径")
13
21
  evaled_artifact_path: str = Field(description="评测结果产物的路径")
14
- run_id: str = Field(description="运行ID")
15
- user_id: int = Field(0, description="用户ID")
16
- report: Dict = Field(default_factory=dict, description="评测报告")
22
+ report: Dict = Field(description="评测报告")
23
+
24
+
25
+ class CreateCVEvalReq(BaseEvalReq):
26
+ """创建CV类型评测任务请求"""
27
+ type: str = Field(default="cv", description="评测类型,固定为 'cv'")
28
+ metrics_artifact_path: str = Field(description="指标产物的路径")
29
+ ground_truth_artifact_path: str = Field(description="真实标签产物的路径")
17
30
 
18
31
 
19
32
  class EvalRun(BaseModel):
aihub/services/eval.py CHANGED
@@ -12,7 +12,7 @@ import httpx
12
12
 
13
13
  from ..exceptions import APIError
14
14
  from ..models.common import APIWrapper
15
- from ..models.eval import CreateEvalReq, CreateEvalResp, ListEvalReq, ListEvalResp
15
+ from ..models.eval import CreateLLMEvalReq, CreateCVEvalReq, CreateEvalResp, ListEvalReq, ListEvalResp
16
16
 
17
17
  _BASE = "/eval-platform/api/v1"
18
18
 
@@ -31,6 +31,7 @@ class EvalService:
31
31
  evaled_artifact_path: str,
32
32
  report_json: dict,
33
33
  run_id,
34
+ user_id: int = 0,
34
35
  ) -> int:
35
36
  """创建评测报告
36
37
 
@@ -40,7 +41,7 @@ class EvalService:
40
41
  evaled_artifact_path: 评测结果制品路径
41
42
  prediction_artifact_path: 推理结果制品路径
42
43
  dataset_version_name (str): 数据集名称
43
-
44
+ user_id (int, optional): 用户ID,默认为0
44
45
 
45
46
  Returns:
46
47
  id (int): 评测报告id
@@ -52,17 +53,48 @@ class EvalService:
52
53
  dataset_version = dataset_service.get_dataset_version_by_name(
53
54
  dataset_version_name
54
55
  )
55
- payload = CreateEvalReq(
56
+ payload = CreateLLMEvalReq(
56
57
  dataset_id=dataset_version.dataset_id,
57
58
  dataset_version_id=dataset_version.id,
58
59
  evaled_artifact_path=evaled_artifact_path,
59
60
  prediction_artifact_path=prediction_artifact_path,
60
61
  report=report_json,
61
62
  run_id=run_id,
63
+ user_id=user_id,
62
64
  )
63
65
 
64
66
  return self._eval.create(payload)
65
67
 
68
+ def create_cv_run(
69
+ self,
70
+ run_id: str,
71
+ prediction_artifact_path: str,
72
+ metrics_artifact_path: str,
73
+ ground_truth_artifact_path: str,
74
+ user_id: int = 0,
75
+ ) -> int:
76
+ """创建 CV 类型评测运行
77
+
78
+ Args:
79
+ run_id (str): 运行ID
80
+ prediction_artifact_path (str): 推理产物的路径
81
+ metrics_artifact_path (str): 指标产物的路径
82
+ ground_truth_artifact_path (str): 真实标签产物的路径
83
+ user_id (int, optional): 用户ID,默认为0
84
+
85
+ Returns:
86
+ id (int): 评测运行id
87
+ """
88
+ payload = CreateCVEvalReq(
89
+ run_id=run_id,
90
+ prediction_artifact_path=prediction_artifact_path,
91
+ metrics_artifact_path=metrics_artifact_path,
92
+ ground_truth_artifact_path=ground_truth_artifact_path,
93
+ user_id=user_id,
94
+ )
95
+
96
+ return self._eval.create(payload)
97
+
66
98
  def list(
67
99
  self,
68
100
  page_size: int = 20,
@@ -119,7 +151,7 @@ class _Eval:
119
151
  def __init__(self, http: httpx.Client):
120
152
  self._http = http
121
153
 
122
- def create(self, payload: CreateEvalReq) -> int:
154
+ def create(self, payload) -> int:
123
155
  resp = self._http.post(f"{_BASE}/run/", json=payload.model_dump())
124
156
  wrapper = APIWrapper[CreateEvalResp].model_validate(resp.json())
125
157
  if wrapper.code != 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: intellif-aihub
3
- Version: 0.1.20
3
+ Version: 0.1.21
4
4
  Summary: Intellif AI-hub SDK.
5
5
  Author-email: Platform Team <aihub@example.com>
6
6
  License-Expression: Apache-2.0
@@ -1,4 +1,4 @@
1
- aihub/__init__.py,sha256=8XalsVoLEfXslFvdtUEmkNOuYShzOzYOcFbgmOz1oSk,23
1
+ aihub/__init__.py,sha256=qEmNtjnOwhDYQ0cHPPtUkUaghzD2xl0thJEznl4giYw,23
2
2
  aihub/client.py,sha256=Fu3jlEy21T4nJDV5EXTDujy1_B3Pf6CSTyPwkj3PPuE,5574
3
3
  aihub/exceptions.py,sha256=l2cMAvipTqQOio3o11fXsCCSCevbuK4PTsxofkobFjk,500
4
4
  aihub/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -7,7 +7,7 @@ aihub/models/common.py,sha256=qmabc2LkAdQJXIcpT1P35zxd0Lc8yDYdD4ame1iF4Bs,241
7
7
  aihub/models/data_warehouse.py,sha256=zXvWwg7ySoFJMdqQ_1UMTNEKDMhu1hDHlWdBAXdizBk,3905
8
8
  aihub/models/dataset_management.py,sha256=4DuQ0zM7jv73SJiqvieHLtn2Y-T6FIFV9r7bgzyCtDo,10790
9
9
  aihub/models/document_center.py,sha256=od9bzx6krAS6ktIA-ChxeqGcch0v2wsS1flY2vuHXBc,1340
10
- aihub/models/eval.py,sha256=YFgaRQv8v_mR7i8t6KJ4w8l2TGugsL1BK4VRFr6iqd8,3304
10
+ aihub/models/eval.py,sha256=fcCoCFiDdZksJnbf7IsVPuwPwYMnGbSiVR8U4gN-3OM,3867
11
11
  aihub/models/labelfree.py,sha256=YUnUv0tjYSFAFzYtmbnLOha8rnDe32sb50HkPOclAzU,2016
12
12
  aihub/models/model_center.py,sha256=DNMchrN0pYDcTMHApWNNVMrARF_i9Ng5xlAwHX5isYw,5935
13
13
  aihub/models/model_training_platform.py,sha256=2zir5i-XvuxKKVYr4wuNYUC7nwMzetdtCRoysZ1W_Tc,11725
@@ -21,7 +21,7 @@ aihub/services/artifact.py,sha256=lfOrgOT2AlH1w-75NLcQGOhVWdhmJcWD1gESPpUzqUw,11
21
21
  aihub/services/data_warehouse.py,sha256=awvlJdggo8ph6sXweXXVp4GLRuUSD46LoD0QQksXRts,2964
22
22
  aihub/services/dataset_management.py,sha256=R7mFsJ1dNOI_p5yNj_rQdLolRC0UKEN4WejE7uOjVlE,21379
23
23
  aihub/services/document_center.py,sha256=dG67Ji-DOnzL2t-4x4gVfMt9fbSj_IjVHCLw5R-VTkQ,1813
24
- aihub/services/eval.py,sha256=ryXjbC2eCTTU4ot3vjJ4_HhGldjCuZ0LS4OYVwWaCoc,4505
24
+ aihub/services/eval.py,sha256=CweTUkWSECqAEbccUCl2YlF7ZQsfuZKOWg3UFDaZv10,5619
25
25
  aihub/services/labelfree.py,sha256=xua62UWhVXTxJjHRyy86waaormnJjmpQwepcARBy_h0,1450
26
26
  aihub/services/model_center.py,sha256=QZXlldPZrbC6YkVG3eGw5_53qvFAim2QlXg3DflByTA,6215
27
27
  aihub/services/model_training_platform.py,sha256=38o6HJnyi3htFzpX7qj6UhzdqTchcXLRTYU0nM7ffJg,10176
@@ -36,8 +36,8 @@ aihub/utils/di.py,sha256=vFUzno5WbRKu6-pj8Hnz9IqT7xb9UDZQ4qpOFH1YAtM,11812
36
36
  aihub/utils/download.py,sha256=ZZVbcC-PnN3PumV7ZiJ_-srkt4HPPovu2F6Faa2RrPE,1830
37
37
  aihub/utils/http.py,sha256=AmfHHNjptuuSFx2T1twWCnerR_hLN_gd0lUs8z36ERA,547
38
38
  aihub/utils/s3.py,sha256=ISIBP-XdBPkURpXnN56ZnIWokOOg2SRUh_qvxJk-G1Q,2187
39
- intellif_aihub-0.1.20.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
40
- intellif_aihub-0.1.20.dist-info/METADATA,sha256=Jr4_my80mlDP_JR7KyR6Ayu5dzBI1WZ_quXnBfbfDAA,2949
41
- intellif_aihub-0.1.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
42
- intellif_aihub-0.1.20.dist-info/top_level.txt,sha256=vIvTtSIN73xv46BpYM-ctVGnyOiUQ9EWP_6ngvdIlvw,6
43
- intellif_aihub-0.1.20.dist-info/RECORD,,
39
+ intellif_aihub-0.1.21.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
40
+ intellif_aihub-0.1.21.dist-info/METADATA,sha256=3E24k8VYdgjj3EyXtxZHC4NMpYtMAD_hmPu2aX5MJ4o,2949
41
+ intellif_aihub-0.1.21.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
42
+ intellif_aihub-0.1.21.dist-info/top_level.txt,sha256=vIvTtSIN73xv46BpYM-ctVGnyOiUQ9EWP_6ngvdIlvw,6
43
+ intellif_aihub-0.1.21.dist-info/RECORD,,