intellif-aihub 0.1.12__py3-none-any.whl → 0.1.14__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.12"
1
+ __version__ = "0.1.14"
@@ -135,3 +135,71 @@ class FileUploadData(BaseModel):
135
135
  """文件上传数据"""
136
136
  path: str = Field(description="路径")
137
137
  url: str = Field(description="URL")
138
+
139
+
140
+ class ListDatasetReq(BaseModel):
141
+ """列表查询数据集请求(使用 dataset_management v2)"""
142
+ page_size: int = Field(20, alias="page_size", description="每页大小,默认20")
143
+ page_num: int = Field(1, alias="page_num", description="页码,从1开始")
144
+ name: Optional[str] = Field(None, description="数据集名称筛选")
145
+ tags: Optional[str] = Field(None, description="标签筛选")
146
+ create_by: Optional[int] = Field(None, alias="create_by", description="创建人筛选")
147
+ scope: Optional[str] = Field("all", description="范围筛选:created|shared|all")
148
+
149
+
150
+ class ListDatasetItem(BaseModel):
151
+ """列表数据集项"""
152
+ id: int = Field(description="数据集ID")
153
+ name: str = Field(description="数据集名称")
154
+ description: str = Field(description="数据集描述")
155
+ cover_img: str = Field(alias="cover_img", description="封面图片")
156
+ created_at: int = Field(alias="created_at", description="创建时间戳")
157
+ updated_at: int = Field(alias="update_at", description="更新时间戳")
158
+ user_id: int = Field(alias="user_id", description="创建人ID")
159
+ username: str = Field(description="创建人用户名")
160
+ tags: Optional[List[int]] = Field(None, description="标签列表")
161
+ access_user_ids: Optional[List[int]] = Field(None, alias="access_user_ids", description="有访问权限的用户ID列表")
162
+ is_private: bool = Field(alias="is_private", description="是否私有")
163
+
164
+
165
+ class ListDatasetResp(BaseModel):
166
+ """列表查询数据集响应"""
167
+ total: int = Field(description="总数")
168
+ page_size: int = Field(alias="page_size", description="每页大小")
169
+ page_num: int = Field(alias="page_num", description="当前页码")
170
+ data: List[ListDatasetItem] = Field(description="数据集列表")
171
+
172
+
173
+ class ListDatasetVersionReq(BaseModel):
174
+ """列表查询数据集版本请求(使用 dataset_management v2)"""
175
+ page_size: int = Field(10000000, alias="page_size", description="每页大小,默认10000000")
176
+ page_num: int = Field(1, alias="page_num", description="页码,从1开始")
177
+ dataset_id: Optional[int] = Field(None, alias="dataset_id", description="数据集ID筛选")
178
+ dataset_version_ids: Optional[str] = Field(None, alias="dataset_version_ids", description="数据集版本ID列表,逗号分隔")
179
+
180
+
181
+ class ListDatasetVersionItem(BaseModel):
182
+ """列表数据集版本项"""
183
+ id: int = Field(description="版本ID")
184
+ version: int = Field(description="版本号")
185
+ dataset_id: int = Field(alias="dataset_id", description="数据集ID")
186
+ upload_path: str = Field(alias="upload_path", description="上传路径")
187
+ upload_type: int = Field(alias="upload_type", description="上传类型")
188
+ parent_version_id: Optional[int] = Field(None, alias="parent_version_id", description="父版本ID")
189
+ description: Optional[str] = Field(None, description="版本描述")
190
+ status: int = Field(description="版本状态")
191
+ message: str = Field(description="状态信息")
192
+ created_at: int = Field(alias="created_at", description="创建时间戳")
193
+ user_id: int = Field(alias="user_id", description="创建人ID")
194
+ data_size: int = Field(alias="data_size", description="数据大小")
195
+ data_count: int = Field(alias="data_count", description="数据条数")
196
+ username: str = Field(description="创建人用户名")
197
+ dataset_name: str = Field(alias="dataset_name", description="数据集名称")
198
+
199
+
200
+ class ListDatasetVersionResp(BaseModel):
201
+ """列表查询数据集版本响应"""
202
+ total: int = Field(description="总数")
203
+ page_size: int = Field(alias="page_size", description="每页大小")
204
+ page_num: int = Field(alias="page_num", description="当前页码")
205
+ data: List[ListDatasetVersionItem] = Field(description="数据集版本列表")
@@ -7,6 +7,8 @@
7
7
  - **创建数据集及其版本**(支持本地上传和服务器现有文件两种方式)
8
8
  - **上传文件到对象存储**(大文件自动分片)
9
9
  - **查询数据集/数据集版本详情**
10
+ - **列表查询和搜索数据集**(支持分页和筛选)
11
+ - **列表查询数据集版本**(支持按数据集ID筛选和分页)
10
12
  - **按版本名称或ID下载数据集文件**
11
13
  """
12
14
 
@@ -34,6 +36,10 @@ from ..models.dataset_management import (
34
36
  DatasetVersionDetail,
35
37
  UploadDatasetVersionResponse,
36
38
  FileUploadData,
39
+ ListDatasetReq,
40
+ ListDatasetResp,
41
+ ListDatasetVersionReq,
42
+ ListDatasetVersionResp,
37
43
  )
38
44
  from ..models.dataset_management import DatasetVersionStatus
39
45
  from ..utils.download import dataset_download, zip_dir
@@ -270,6 +276,66 @@ class DatasetManagementService:
270
276
  raise APIError("parquet_index_path 为空")
271
277
  dataset_download(detail.parquet_index_path, local_dir, worker)
272
278
 
279
+ def list_datasets(
280
+ self,
281
+ *,
282
+ page_size: int = 20,
283
+ page_num: int = 1,
284
+ name: str | None = None,
285
+ tags: str | None = None,
286
+ create_by: int | None = None,
287
+ scope: str = "all"
288
+ ) -> ListDatasetResp:
289
+ """列表查询数据集
290
+
291
+ Args:
292
+ page_size: 每页大小,默认20
293
+ page_num: 页码,从1开始,默认1
294
+ name: 数据集名称筛选,可选
295
+ tags: 标签筛选,可选
296
+ create_by: 创建人筛选,可选
297
+ scope: 范围筛选:created|shared|all,默认all
298
+
299
+ Returns:
300
+ ListDatasetResp: 数据集列表响应,包含分页信息和数据集列表
301
+ """
302
+ payload = ListDatasetReq(
303
+ page_size=page_size,
304
+ page_num=page_num,
305
+ name=name,
306
+ tags=tags,
307
+ create_by=create_by,
308
+ scope=scope
309
+ )
310
+ return self._dataset.list_datasets(payload)
311
+
312
+ def list_dataset_versions(
313
+ self,
314
+ *,
315
+ page_size: int = 10000000,
316
+ page_num: int = 1,
317
+ dataset_id: int | None = None,
318
+ dataset_version_ids: str | None = None
319
+ ) -> ListDatasetVersionResp:
320
+ """列表查询数据集版本
321
+
322
+ Args:
323
+ page_size: 每页大小,默认10000000
324
+ page_num: 页码,从1开始,默认1
325
+ dataset_id: 数据集ID筛选,可选
326
+ dataset_version_ids: 数据集版本ID列表,逗号分隔,可选
327
+
328
+ Returns:
329
+ ListDatasetVersionResp: 数据集版本列表响应,包含分页信息和数据集版本列表
330
+ """
331
+ payload = ListDatasetVersionReq(
332
+ page_size=page_size,
333
+ page_num=page_num,
334
+ dataset_id=dataset_id,
335
+ dataset_version_ids=dataset_version_ids
336
+ )
337
+ return self._dataset_version.list_dataset_versions(payload)
338
+
273
339
 
274
340
  class _Dataset:
275
341
  def __init__(self, http: httpx.Client):
@@ -292,6 +358,15 @@ class _Dataset:
292
358
  raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
293
359
  return wrapper.data
294
360
 
361
+ def list_datasets(self, payload: ListDatasetReq) -> ListDatasetResp:
362
+ """列表查询数据集"""
363
+ params = payload.model_dump(by_alias=True, exclude_none=True)
364
+ resp = self._http.get(f"{_BASE}/datasets", params=params)
365
+ wrapper = APIWrapper[ListDatasetResp].model_validate(resp.json())
366
+ if wrapper.code != 0:
367
+ raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
368
+ return wrapper.data
369
+
295
370
 
296
371
  class _DatasetVersion:
297
372
  def __init__(self, http: httpx.Client):
@@ -333,6 +408,15 @@ class _DatasetVersion:
333
408
  raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
334
409
  return wrapper.data
335
410
 
411
+ def list_dataset_versions(self, payload: ListDatasetVersionReq) -> ListDatasetVersionResp:
412
+ """列表查询数据集版本"""
413
+ params = payload.model_dump(by_alias=True, exclude_none=True)
414
+ resp = self._http.get(f"{_BASE}/dataset-versions", params=params)
415
+ wrapper = APIWrapper[ListDatasetVersionResp].model_validate(resp.json())
416
+ if wrapper.code != 0:
417
+ raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
418
+ return wrapper.data
419
+
336
420
 
337
421
  class _Upload:
338
422
  def __init__(self, http: httpx.Client):
aihub/utils/http.py CHANGED
@@ -1,13 +1,14 @@
1
1
  from __future__ import annotations
2
2
 
3
- import httpx
4
3
  import os
5
4
 
5
+ import requests
6
+
6
7
 
7
8
  def http_download_file(url: str, dst_path: str, chunk: int = 1 << 16) -> None:
8
9
  os.makedirs(os.path.dirname(dst_path), exist_ok=True)
9
- with httpx.stream("GET", url, follow_redirects=True, timeout=None) as r:
10
+ with requests.get(url, timeout=None, stream=True) as r:
10
11
  r.raise_for_status()
11
12
  with open(dst_path, "wb") as f:
12
- for block in r.iter_bytes(chunk):
13
+ for block in r.iter_content(chunk):
13
14
  f.write(block)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: intellif-aihub
3
- Version: 0.1.12
3
+ Version: 0.1.14
4
4
  Summary: Intellif AI-hub SDK.
5
5
  Author-email: Platform Team <aihub@example.com>
6
6
  License-Expression: Apache-2.0
@@ -17,6 +17,7 @@ Requires-Dist: pyarrow>=21.0.0
17
17
  Requires-Dist: tqdm<5.0,>=4.66
18
18
  Requires-Dist: loguru>=0.7.3
19
19
  Requires-Dist: minio>=7.2.7
20
+ Requires-Dist: requests>=2.32.4
20
21
  Dynamic: license-file
21
22
 
22
23
  # Intellif AI-Hub SDK
@@ -1,11 +1,11 @@
1
- aihub/__init__.py,sha256=LcIlFjHZFfiF9Rd4UHoakmombOFkxIYk00I181frGBM,23
1
+ aihub/__init__.py,sha256=PIBqEOI-nqKFL9oJAWQQwlHuujG9Cd7EmdxDrThNQto,23
2
2
  aihub/client.py,sha256=nVELjkyVOG6DKJjurYn59fCoT5JsSayUweiH7bvKcAo,5547
3
3
  aihub/exceptions.py,sha256=l2cMAvipTqQOio3o11fXsCCSCevbuK4PTsxofkobFjk,500
4
4
  aihub/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  aihub/models/artifact.py,sha256=4xIWV3xfZuZWcCdmZGEZ5k_rvV4oc5C_3gapw5O-2vQ,4586
6
6
  aihub/models/common.py,sha256=qmabc2LkAdQJXIcpT1P35zxd0Lc8yDYdD4ame1iF4Bs,241
7
7
  aihub/models/data_warehouse.py,sha256=zXvWwg7ySoFJMdqQ_1UMTNEKDMhu1hDHlWdBAXdizBk,3905
8
- aihub/models/dataset_management.py,sha256=HmmOW0bA2byQNVavrDG0K5L6pAeGrTFv-ap9pvBWgds,6511
8
+ aihub/models/dataset_management.py,sha256=etvMOwKO3Oc8h-pJ-adoGCOLWIe2YYzx2smZZ7eCdWw,10327
9
9
  aihub/models/document_center.py,sha256=od9bzx6krAS6ktIA-ChxeqGcch0v2wsS1flY2vuHXBc,1340
10
10
  aihub/models/eval.py,sha256=4Gon4Sg4dOkyCx3KH2mO5ip3AhrBwrPC0UZA447HeoQ,910
11
11
  aihub/models/labelfree.py,sha256=nljprYO6ECuctTVbHqriQ73N5EEyYURhBrnU28Ngfvc,1589
@@ -19,7 +19,7 @@ aihub/models/workflow_center.py,sha256=4xtI1WZ38ceXJ8gwDBj-QNjOiRlLO_8kGiQybdudJ
19
19
  aihub/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  aihub/services/artifact.py,sha256=PtCGhYFpFK_hppQr7A0bdXvceXzmYSwEpRj-PE2rIcQ,11473
21
21
  aihub/services/data_warehouse.py,sha256=awvlJdggo8ph6sXweXXVp4GLRuUSD46LoD0QQksXRts,2964
22
- aihub/services/dataset_management.py,sha256=KB-NZpcQwixOpEkQ1xI0gKzvWA3A6ay6aQzFQoUfXXU,12847
22
+ aihub/services/dataset_management.py,sha256=i9Q_Mt8XZeFQR3_5JqIeXu3Y01ay-fPXbykkrfs0OmQ,15961
23
23
  aihub/services/document_center.py,sha256=dG67Ji-DOnzL2t-4x4gVfMt9fbSj_IjVHCLw5R-VTkQ,1813
24
24
  aihub/services/eval.py,sha256=V1nBISIyYWg9JJO24xzy4-kit9NsaCYp1EWIX_fgJkQ,2128
25
25
  aihub/services/labelfree.py,sha256=xua62UWhVXTxJjHRyy86waaormnJjmpQwepcARBy_h0,1450
@@ -33,10 +33,10 @@ aihub/services/user_system.py,sha256=IqWL4bnsKyyzuGT5l6adnw0qNXlH9PSo1-C_pFyOSzA
33
33
  aihub/services/workflow_center.py,sha256=caKxOlba0J1s1RUK6RUm1ndJSwAcZXEakRanu3sGKPU,17468
34
34
  aihub/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  aihub/utils/download.py,sha256=yC3SoL5uE68pMB-IsNz233wj-gFrHB7D7ALzQA5JkFM,2155
36
- aihub/utils/http.py,sha256=rSNh4uNP7E3YGm3H1indRHctxC5Wu5xNBPvDrb9UHt4,421
36
+ aihub/utils/http.py,sha256=SvEWB4BxvwaHYqMVE4B0Go3OWGAD4xyQnUXDZ16yOSo,410
37
37
  aihub/utils/s3.py,sha256=ISIBP-XdBPkURpXnN56ZnIWokOOg2SRUh_qvxJk-G1Q,2187
38
- intellif_aihub-0.1.12.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
39
- intellif_aihub-0.1.12.dist-info/METADATA,sha256=LPpYwvlgxhqRiSk6-PD7BEY0F8pVjw-kOZH_oU4Vwug,2917
40
- intellif_aihub-0.1.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
- intellif_aihub-0.1.12.dist-info/top_level.txt,sha256=vIvTtSIN73xv46BpYM-ctVGnyOiUQ9EWP_6ngvdIlvw,6
42
- intellif_aihub-0.1.12.dist-info/RECORD,,
38
+ intellif_aihub-0.1.14.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
39
+ intellif_aihub-0.1.14.dist-info/METADATA,sha256=f1WbrM_51scvCQQZsNdhgYpweM3tVtdMftIif8zq7yU,2949
40
+ intellif_aihub-0.1.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
+ intellif_aihub-0.1.14.dist-info/top_level.txt,sha256=vIvTtSIN73xv46BpYM-ctVGnyOiUQ9EWP_6ngvdIlvw,6
42
+ intellif_aihub-0.1.14.dist-info/RECORD,,