ap-client 0.7.0.dev11__tar.gz → 0.7.1b1__tar.gz

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.
Files changed (28) hide show
  1. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/PKG-INFO +1 -1
  2. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/cli.py +170 -39
  3. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/dataset_commands.py +30 -32
  4. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/dataset_register.py +1 -2
  5. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/pyproject.toml +1 -1
  6. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/__init__.py +0 -0
  7. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/akpool_commands.py +0 -0
  8. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/api.py +0 -0
  9. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/config.py +0 -0
  10. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/dataset_name.py +0 -0
  11. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/dfs_commands.py +0 -0
  12. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/exporter.py +0 -0
  13. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/fs_commands.py +0 -0
  14. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/fs_storage.py +0 -0
  15. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/fs_transfer.py +0 -0
  16. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/instance_commands.py +0 -0
  17. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/instance_options.py +0 -0
  18. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/irepo_sdk.py +0 -0
  19. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/managed_ak.py +0 -0
  20. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/manifest_view.py +0 -0
  21. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/ossutil_hash.py +0 -0
  22. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/ossutil_io.py +0 -0
  23. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/profile_commands.py +0 -0
  24. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/repo_read_guard.py +0 -0
  25. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/share_api.py +0 -0
  26. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/split_publish.py +0 -0
  27. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/tbb.py +0 -0
  28. {ap_client-0.7.0.dev11 → ap_client-0.7.1b1}/ap_client/waiter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ap-client
3
- Version: 0.7.0.dev11
3
+ Version: 0.7.1b1
4
4
  Summary: Agent Platform API Client & CLI
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: irepo-artifact==0.2.4
@@ -265,6 +265,104 @@ def _parse_json_object(raw: Optional[str], option_name: str) -> Optional[dict]:
265
265
  return value
266
266
 
267
267
 
268
+ # The one escape a -p/--params key understands: a backslash-dot pair is a
269
+ # literal dot and never splits a dot-path.
270
+ _DOT_PATH_ESCAPE = "\\."
271
+
272
+
273
+ def _split_dot_path(key: str) -> tuple[Optional[str], str]:
274
+ r"""Resolve ``\.`` escapes in *key* and split it at its first bare ``.``.
275
+
276
+ Returns ``(parent, sub_key)`` for a dot-path and ``(None, key)`` when the
277
+ key has no bare dot (a flat key). Escaped dots become literal dots in the
278
+ yielded halves, so the backslash never reaches the request body; any other
279
+ backslash (``a\b``) is preserved verbatim. An empty parent or sub-key is
280
+ returned as-is so the caller can reject it.
281
+ """
282
+ parent: list[str] = []
283
+ sub_key: list[str] = []
284
+ current = parent
285
+ index = 0
286
+ while index < len(key):
287
+ if key.startswith(_DOT_PATH_ESCAPE, index):
288
+ current.append(".")
289
+ index += len(_DOT_PATH_ESCAPE)
290
+ continue
291
+ char = key[index]
292
+ index += 1
293
+ if char == "." and current is parent:
294
+ current = sub_key
295
+ continue
296
+ current.append(char)
297
+ if current is parent:
298
+ return None, "".join(parent)
299
+ return "".join(parent), "".join(sub_key)
300
+
301
+
302
+ def _expand_params_dot_paths(params: dict) -> dict:
303
+ r"""Expand one level of ``parent.subkey`` keys inside a ``-p/--params`` object.
304
+
305
+ ``{"proxy_envs.HTTPS_PROXY": "http://p"}`` becomes
306
+ ``{"proxy_envs": {"HTTPS_PROXY": "http://p"}}`` so a single dict param can be
307
+ patched without hand-escaping the whole embedded JSON string. Only the first
308
+ bare ``.`` splits, so ``a.b.c`` yields ``{"a": {"b.c": value}}``; keys without
309
+ a bare dot keep their place and their value, and values keep their JSON type
310
+ (``null`` included - the server turns a ``null`` sub-key into a deletion).
311
+
312
+ A backslash-escaped dot (``\.``) is a literal dot and never splits, and the
313
+ backslash is stripped from the resulting key: the decoded key ``kp1\.kp2``
314
+ lands as the flat key ``kp1.kp2`` while ``a.kp1\.kp2`` becomes
315
+ ``{"a": {"kp1.kp2": value}}``. Only the exact ``\.`` pair is special, so a
316
+ backslash that is not followed by a dot (``a\b``) is preserved verbatim.
317
+
318
+ Expansion is two-pass so the result never depends on JSON key order: native
319
+ objects are placed first, then dot-path entries are layered on top. Dot-path
320
+ entries win on a duplicate sub-key while unmentioned sibling sub-keys of the
321
+ native object survive.
322
+
323
+ A ``parent`` that is already a scalar / list / ``null`` cannot be read as an
324
+ object, so mixing it with ``parent.subkey`` is a hard client-side error
325
+ rather than a silent replacement. Error messages name the offending key or
326
+ parent only: params values are frequently credentials, so they must never be
327
+ echoed into stdout/stderr (and from there into logs).
328
+
329
+ ``params`` must already be a validated JSON object (see
330
+ :func:`_parse_json_object`): coercion must happen at the CLI boundary, so a
331
+ falsy non-object such as ``null`` / ``[]`` / ``false`` / ``0`` / ``""`` is
332
+ never silently rewritten into an empty patch. An empty object is a no-op.
333
+ """
334
+ expanded: dict[str, Any] = {}
335
+ dotted: dict[str, dict[str, Any]] = {}
336
+ for key, value in params.items():
337
+ if not isinstance(key, str):
338
+ expanded[key] = value
339
+ continue
340
+ parent_key, sub_key = _split_dot_path(key)
341
+ if parent_key is None:
342
+ expanded[sub_key] = value
343
+ continue
344
+ if not parent_key or not sub_key:
345
+ _emit_error(
346
+ f"invalid -p/--params key {key!r}: dot-path needs a non-empty parent and sub-key"
347
+ )
348
+ raise typer.Exit(1)
349
+ dotted.setdefault(parent_key, {})[sub_key] = value
350
+
351
+ for parent_key, sub_values in dotted.items():
352
+ base = expanded.get(parent_key)
353
+ if base is None and parent_key not in expanded:
354
+ expanded[parent_key] = dict(sub_values)
355
+ continue
356
+ if not isinstance(base, dict):
357
+ _emit_error(
358
+ f"conflicting -p/--params parent {parent_key!r}: "
359
+ "set both as a non-object value and as a dot-path parent"
360
+ )
361
+ raise typer.Exit(1)
362
+ expanded[parent_key] = {**base, **sub_values}
363
+ return expanded
364
+
365
+
268
366
  def _parse_datasources_option(raw: Optional[str]) -> Optional[list]:
269
367
  if raw is None:
270
368
  return None
@@ -2962,7 +3060,15 @@ def job_create(
2962
3060
  "--exclude-instance-ids",
2963
3061
  help="Instance IDs to exclude from the selected set (comma-separated, or @file)",
2964
3062
  ),
2965
- params: Optional[str] = typer.Option(None, "--params", "-p", help="Parameters (JSON)"),
3063
+ params: Optional[str] = typer.Option(
3064
+ None,
3065
+ "--params",
3066
+ "-p",
3067
+ help=(
3068
+ "Parameters (JSON object). A dotted key expands one level, e.g. "
3069
+ '\'{"proxy_envs.HTTPS_PROXY":"http://proxy"}\'; escape a literal dot as \\.'
3070
+ ),
3071
+ ),
2966
3072
  params_list_input: Optional[str] = typer.Option(
2967
3073
  None, "--params-list", "-l", help="Params list: JSON array string or path to a JSON file"
2968
3074
  ),
@@ -3003,22 +3109,22 @@ def job_create(
3003
3109
  meta_model: Optional[str] = typer.Option(
3004
3110
  None,
3005
3111
  "--meta-model",
3006
- help="Target model or training project this job serves; not the called model or Judge. Values: ap meta-tag get meta-model --format json",
3112
+ help="Meta model tag; omit to leave unset",
3007
3113
  ),
3008
3114
  meta_job_type: Optional[str] = typer.Option(
3009
3115
  None,
3010
3116
  "--meta-job-type",
3011
- help="Business purpose of this job. Values: ap meta-tag get meta-job-type --format json",
3117
+ help="Meta job type tag: Eval-Eval (default) or Others",
3012
3118
  ),
3013
3119
  meta_teacher_direction: Optional[str] = typer.Option(
3014
3120
  None,
3015
3121
  "--meta-teacher-direction",
3016
- help="Teacher direction this job serves; verify any dataset-derived value. Values: ap meta-tag get meta-teacher-direction --format json",
3122
+ help="Meta teacher direction tag; omit to derive from dataset_series; options: ap meta-teacher-direction list",
3017
3123
  ),
3018
3124
  meta_train_stage: Optional[str] = typer.Option(
3019
3125
  None,
3020
3126
  "--meta-train-stage",
3021
- help="Training stage this job serves; verify any dataset-derived value. Values: ap meta-tag get meta-train-stage --format json",
3127
+ help="Meta train stage tag; omit to derive from dataset run_type; options: ap meta-train-stage list",
3022
3128
  ),
3023
3129
  overrides: Optional[str] = typer.Option(None, "--overrides", help="Override config (JSON)"),
3024
3130
  concurrency: Optional[int] = typer.Option(
@@ -3190,7 +3296,7 @@ def job_create(
3190
3296
  benchmark: Optional[str] = typer.Option(
3191
3297
  None,
3192
3298
  "--benchmark",
3193
- help="Prefer the registered benchmark source ID for this run; name is also accepted. Find IDs: ap benchmark list --format json; inspect by name: ap benchmark get NAME --format json",
3299
+ help="Benchmark name from the AP registry (see 'ap benchmark list')",
3194
3300
  ),
3195
3301
  checkpoint_id: Optional[str] = typer.Option(
3196
3302
  None,
@@ -3236,41 +3342,46 @@ def job_create(
3236
3342
  ):
3237
3343
  """Submit a job.
3238
3344
 
3239
- For agents:
3240
- \b
3241
- Before submitting, you MUST ensure these five parameters are explicitly specified:
3242
- benchmark, meta-model, meta-job-type, meta-train-stage, meta-teacher-direction.
3243
- Keep specified values. Fill missing parameters using available Job, Group,
3244
- Profile, Dataset, Template, or other relevant information.
3245
- If a missing value cannot be inferred, use default for benchmark
3246
- or Others for the corresponding meta parameter.
3247
- Do not ask the user for these values.
3248
-
3249
3345
  Model configuration:
3250
3346
  Supply template parameters through --params/-p; select a managed credential with --ak-id.
3251
3347
 
3252
3348
  Examples:
3253
- Use catalog/context-selected values for the metadata variables below.
3254
-
3255
- \b
3256
- # Profile submission (PROFILE_REF is ID:vN)
3257
- ap job create --profile "$PROFILE_REF" -i "$INSTANCE_ID" \\
3258
- --benchmark "$BENCHMARK_ID" \\
3259
- --meta-model "$META_MODEL" \\
3260
- --meta-job-type "$META_JOB_TYPE" \\
3261
- --meta-train-stage "$META_TRAIN_STAGE" \\
3262
- --meta-teacher-direction "$META_TEACHER_DIRECTION"
3263
-
3264
- \b
3265
- # Batch jobs from a Dataset (first 3 instances)
3266
- ap job create claw-eval-task --dataset "$DATASET_PATH" --range 0,3 \\
3267
- -p '{"model":"qwen-max"}' \\
3268
- --benchmark "$BENCHMARK_ID" \\
3269
- --meta-model "$META_MODEL" \\
3270
- --meta-job-type "$META_JOB_TYPE" \\
3271
- --meta-train-stage "$META_TRAIN_STAGE" \\
3272
- --meta-teacher-direction "$META_TEACHER_DIRECTION"
3349
+ # Single job - full parameters
3350
+ ap job create claw-eval-task -p '{"task_id":"T02_email_triage","model":"qwen-max"}'
3351
+
3352
+ # Single job - instance_id + shared params
3353
+ ap job create claw-eval-task -i T02_email_triage -p '{"model":"qwen-max"}'
3354
+
3355
+ # Batch jobs - multiple instance_ids + shared params
3356
+ ap job create claw-eval-task -i T02_email_triage,T03zh_calendar_scheduling,T04_calendar_scheduling -p '{"model":"qwen-max"}'
3357
+
3358
+ # Batch jobs - dataset + shared params
3359
+ ap job create claw-eval-task --dataset claw-eval/claw-eval/v1@0 -p '{"model":"qwen-max"}'
3273
3360
 
3361
+ # Batch jobs - dataset subset with exclusions
3362
+ ap job create claw-eval-task --dataset claw-eval/claw-eval/v1@0 --range 0,10,2 --exclude-instance-ids T03zh_calendar_scheduling
3363
+
3364
+ # Batch jobs from a params list(inline JSON) with shared base params (-p merged into each item)
3365
+ ap job create claw-eval-task --params-list '[{"task_id":"T02_email_triage"},{"task_id":"T03zh_calendar_scheduling"}]' -p '{"model":"qwen-max"}'
3366
+
3367
+ # Batch jobs from a params list file (also supports -p for shared base params)
3368
+ ap job create claw-eval-task --params-list params.json -p '{"model":"qwen-max"}'
3369
+
3370
+ # Debug mode - keep pod alive for interactive debugging (Pod Login)
3371
+ ap job create stress-test -p '{"duration":60}' --debug
3372
+
3373
+ # Debug mode with custom keep-alive duration
3374
+ ap job create stress-test -p '{"duration":60}' --debug --debug-keep-alive-seconds 7200
3375
+
3376
+ # Apply per-instance resource settings from a Resource Profile
3377
+ ap job create claw-eval-task --dataset claw-eval/v1 --resource-profile rp-123
3378
+
3379
+ Note: benchmark+ckpt metadata (--benchmark/--checkpoint-*/--experiment) on a
3380
+ standalone single job needs no client-side group handling — the server
3381
+ auto-creates a Group (auto_created_benchmark_group) to persist the
3382
+ Group-level fields. Generating a group_id client-side would break
3383
+ idempotent retries: the server rejects a same idempotency_key with a
3384
+ different requested group_id (409 idempotency_conflict).
3274
3385
  """
3275
3386
  if transparency is not None and transparency not in {"whitebox", "blackbox"}:
3276
3387
  raise typer.BadParameter("Choose whitebox or blackbox", param_hint="--transparency")
@@ -3315,7 +3426,16 @@ def job_create(
3315
3426
  elif dry_run and wait:
3316
3427
  dry_run_warnings.append("--wait is ignored in dry-run mode")
3317
3428
 
3429
+ # Pre-change contract: ``-p ''`` is the same as omitting ``-p``. Parsing
3430
+ # stays the HEAD bare ``json.loads`` call so a malformed argument keeps its
3431
+ # original exit channel; only a validated object reaches dot-path expansion.
3318
3432
  params_dict = json.loads(params) if params else {}
3433
+ if not isinstance(params_dict, dict):
3434
+ # A non-object used to crash later (``dict.get`` on a list/None); reject
3435
+ # it explicitly here without echoing the value.
3436
+ _emit_error("--params must be a JSON object")
3437
+ raise typer.Exit(1)
3438
+ params_dict = _expand_params_dot_paths(params_dict)
3319
3439
  _reject_account_pool_template_credential_cli(
3320
3440
  account_pool,
3321
3441
  credential_type,
@@ -4736,7 +4856,11 @@ def job_retry(
4736
4856
  None,
4737
4857
  "--params",
4738
4858
  "-p",
4739
- help="Params patch (JSON object) to shallow-merge into existing params",
4859
+ help=(
4860
+ "Params patch (JSON object) to merge into existing params; "
4861
+ 'a dotted key expands one level (e.g. \'{"proxy_envs.HTTPS_PROXY":"..."}\'); '
4862
+ "escape a literal dot as \\."
4863
+ ),
4740
4864
  ),
4741
4865
  delete_params: Optional[str] = typer.Option(
4742
4866
  None,
@@ -4754,6 +4878,9 @@ def job_retry(
4754
4878
  client = get_client()
4755
4879
 
4756
4880
  params_dict = None
4881
+ # Pre-change contract: ``-p ''`` is the same as omitting ``-p``, and both
4882
+ # malformed JSON and a non-object stay on the typer.BadParameter channel
4883
+ # (ExitCode 2). Only a validated object reaches dot-path expansion.
4757
4884
  if params:
4758
4885
  try:
4759
4886
  params_dict = json.loads(params)
@@ -4761,6 +4888,7 @@ def job_retry(
4761
4888
  raise typer.BadParameter("--params must be valid JSON") from exc
4762
4889
  if not isinstance(params_dict, dict):
4763
4890
  raise typer.BadParameter("--params must be a JSON object")
4891
+ params_dict = _expand_params_dot_paths(params_dict)
4764
4892
 
4765
4893
  delete_params_list = None
4766
4894
  if delete_params:
@@ -5798,7 +5926,10 @@ def group_clone(
5798
5926
  None,
5799
5927
  "--params",
5800
5928
  "-p",
5801
- help="Top-level Job params patch (JSON object)",
5929
+ help=(
5930
+ "Top-level Job params patch (JSON object); a dotted key expands one "
5931
+ 'level (e.g. \'{"proxy_envs.HTTPS_PROXY":"..."}\'); escape a literal dot as \\.'
5932
+ ),
5802
5933
  ),
5803
5934
  delete_param: Optional[list[str]] = typer.Option(
5804
5935
  None,
@@ -5902,7 +6033,7 @@ def group_clone(
5902
6033
  if not urls:
5903
6034
  raise typer.BadParameter("--model-base-url-collection must contain at least one URL")
5904
6035
  target_group["model_base_url_collection"] = urls
5905
- params_patch = _parse_json_object(params, "--params") or {}
6036
+ params_patch = _expand_params_dot_paths(_parse_json_object(params, "--params") or {})
5906
6037
  overrides_patch = _parse_json_object(overrides, "--overrides")
5907
6038
  job_patch: dict[str, Any] = {
5908
6039
  "params": params_patch,
@@ -700,7 +700,9 @@ def _versioned_split(
700
700
  """取指定 version 里的单个 split 记录;不存在返回 ``None``(不当作错误)。
701
701
 
702
702
  与 ``_unversioned_split`` 同源,走 recordsvc 的 ``splits.get``(SDK 自带
703
- version_first 内嵌投影的 legacy 回退)。
703
+ version_first 内嵌投影的 legacy 回退)。``version`` 为空表示无版本空间
704
+ (split_first):SDK 不拼 version 参数,记录过滤条件退化为"version 为空",
705
+ 与 ``_unversioned_split`` 等价。
704
706
  """
705
707
  from .irepo_sdk import _reason
706
708
 
@@ -712,11 +714,14 @@ def _versioned_split(
712
714
  )
713
715
  except Exception as exc: # noqa: BLE001
714
716
  raise _fail(
715
- f"dataset {dataset} version {version} split {split}: query failed: {_reason(exc)}",
717
+ f"dataset {dataset} version {_version_label(version)} split {split}: "
718
+ f"query failed: {_reason(exc)}",
716
719
  f"Check the dataset name and permission: ap dataset get {dataset}",
717
720
  ) from exc
718
721
  detail = _model_dict(record) if record is not None else None
719
- return detail if detail is not None and _version_value(detail.get("version")) == version else None
722
+ return (
723
+ detail if detail is not None and _version_value(detail.get("version")) == version else None
724
+ )
720
725
 
721
726
 
722
727
  def _versioned_splits(
@@ -1286,8 +1291,9 @@ def dataset_get(
1286
1291
 
1287
1292
  def dataset_create(
1288
1293
  dataset: str = typer.Argument(
1289
- ..., help="Dataset name: L1, L1/L2, or a deeper path "
1290
- "(e.g. my-bench, alibaba/my-bench, or gdpval/synthetic/my-bench)"
1294
+ ...,
1295
+ help="Dataset name: L1, L1/L2, or a deeper path "
1296
+ "(e.g. my-bench, alibaba/my-bench, or gdpval/synthetic/my-bench)",
1291
1297
  ),
1292
1298
  benchmark: str = typer.Option(..., "--benchmark", help="Benchmark name or source_id"),
1293
1299
  description: Optional[str] = typer.Option(None, "--description", help="Dataset description"),
@@ -1946,9 +1952,7 @@ def dataset_split_get(
1946
1952
  resolved_version = _version_value(version)
1947
1953
 
1948
1954
  if resolved_version:
1949
- record = _versioned_split(
1950
- dataset, resolved_version, split, environment=environment
1951
- )
1955
+ record = _versioned_split(dataset, resolved_version, split, environment=environment)
1952
1956
  if record is not None:
1953
1957
  payload = dict(record)
1954
1958
  payload.setdefault("dataset", dataset)
@@ -2002,30 +2006,19 @@ def dataset_split_create(
2002
2006
  environment: Optional[str] = typer.Option(None, "--environment", help=_ENVIRONMENT_HELP),
2003
2007
  output_format: str = typer.Option(None, "--format", help=_FORMAT_HELP),
2004
2008
  ):
2005
- """Add a split to a version (PATCH version.splits; no split resource exists)."""
2009
+ """Add a split to a version, or to the version-less space when --version is omitted."""
2006
2010
  output_format = _fmt(output_format)
2007
2011
  resolved_version = _version_value(version)
2008
2012
  resolved_run_type = _check_choice(run_type, _RUN_TYPES, "--run-type") if run_type else ""
2009
-
2010
- if not resolved_version:
2011
- # 无版本空间**没有创建接口**:recordsvc 的 /datasets/splits 只有 GET/GET detail/
2012
- # PATCH detail(仅 run_type),split 记录由 ingest 扫 OSS 时落库;而
2013
- # PATCH /datasets/versions/detail 又不接受空 version。迁移前后都是如此,不是 SDK 限制。
2014
- raise _fail(
2015
- f"Failed to create split {split} of dataset {dataset}: the version-less space has no create API",
2016
- f"Split records in the version-less space are produced by the data plane: instance files "
2017
- f"must exist under {dataset}/{split}/ first, then run ingest (console, or SDK "
2018
- f"versions.ingest(dataset, splits=['{split}'], "
2019
- f'metadata_model="split_first")); the record appears afterwards, then use ap dataset split update '
2020
- f"to set run_type; the server rejects an empty directory (split path has no instance files); "
2021
- f"to create an empty split manually, pass --version <version>",
2022
- exit_code=2,
2023
- )
2024
-
2025
- # 版本化创建走独立 Split API(POST /datasets/splits),与 split-first 服务端
2026
- # 契约对齐——旧 Version PATCH(splits 全量替换 / split_run_types)已被服务端
2027
- # 拒绝("split-first Version group updates are not supported")。
2028
2013
  env = _environment(environment)
2014
+
2015
+ # 有/无版本创建都走独立 Split API(POST /datasets/splits,version 可空):服务端
2016
+ # 按 version 是否为空写 dataset/split 或 dataset/version/split,SDK 把空 version
2017
+ # 转成不带 version 的请求,因此不需要分支。无版本路径直接落 recordsvc 的
2018
+ # unversioned split record,不要求 OSS 上先有实例文件(空 split 壳也能建);
2019
+ # ingest 只是另一条产出记录的路径。旧 Version PATCH(splits 全量替换 /
2020
+ # split_run_types)已被服务端拒绝("split-first Version group updates are
2021
+ # not supported")。
2029
2022
  existing = _versioned_split(dataset, resolved_version, split, environment=environment)
2030
2023
  if existing is not None:
2031
2024
  # 幂等:已存在同名 split(设计 §4.3)。
@@ -2047,8 +2040,9 @@ def dataset_split_create(
2047
2040
  record = repo.splits.create(dataset, split, version=resolved_version, **create_kwargs)
2048
2041
  except Exception as exc: # noqa: BLE001 - 统一走设计 §5.1 的映射
2049
2042
  raise _fail(
2050
- f"Failed to create split {split} of dataset {dataset} version {resolved_version}: {_reason(exc)}",
2051
- "Check the version name and write permission, then retry",
2043
+ f"Failed to create split {split} of dataset {dataset} "
2044
+ f"version {_version_label(resolved_version)}: {_reason(exc)}",
2045
+ "Check the dataset name, version name and write permission, then retry",
2052
2046
  ) from exc
2053
2047
  payload = _model_dict(record) if record is not None else {}
2054
2048
  payload.setdefault("dataset", dataset)
@@ -2151,7 +2145,9 @@ def dataset_split_update(
2151
2145
  ", ".join(
2152
2146
  _split_names_of(
2153
2147
  _versioned_splits(
2154
- dataset, resolved_version, stage="split update precheck",
2148
+ dataset,
2149
+ resolved_version,
2150
+ stage="split update precheck",
2155
2151
  environment=environment,
2156
2152
  )
2157
2153
  )
@@ -2171,7 +2167,9 @@ def dataset_split_update(
2171
2167
  repo = _dataset_repo()
2172
2168
  update_kwargs = _sdk_read_kwargs(repo.splits, "update", environment=env, metadata_model="")
2173
2169
  try:
2174
- repo.splits.update(dataset, split, version=resolved_version, run_type=resolved_run_type, **update_kwargs)
2170
+ repo.splits.update(
2171
+ dataset, split, version=resolved_version, run_type=resolved_run_type, **update_kwargs
2172
+ )
2175
2173
  except Exception as exc: # noqa: BLE001 - 统一走设计 §5.1 的映射
2176
2174
  raise _fail(
2177
2175
  f"Failed to update split {split} of dataset {dataset} version {resolved_version}: {_reason(exc)}",
@@ -121,8 +121,7 @@ def _create_owned_dataset(repo: Any, dataset: str, benchmark_id: str) -> dict:
121
121
  raise datasets._fail(
122
122
  f"Failed to create dataset {dataset}: the name must be one or more "
123
123
  "canonical path segments",
124
- "Use a dataset name such as my-bench, your-team/my-bench, "
125
- "or gdpval/synthetic/my-bench",
124
+ "Use a dataset name such as my-bench, your-team/my-bench, or gdpval/synthetic/my-bench",
126
125
  exit_code=2,
127
126
  )
128
127
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ap-client"
7
- version = "0.7.0.dev11"
7
+ version = "0.7.1b1"
8
8
  description = "Agent Platform API Client & CLI"
9
9
  readme = { text = "A lightweight Python SDK and command line interface for Agent Platform. It provides helpers for configuring API access and managing templates, datasets, jobs, and groups.", content-type = "text/markdown" }
10
10
  requires-python = ">=3.10"