nufi-python 1.1.2__tar.gz → 1.1.3__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.
- {nufi_python-1.1.2/src/nufi_python.egg-info → nufi_python-1.1.3}/PKG-INFO +27 -25
- {nufi_python-1.1.2 → nufi_python-1.1.3}/README.md +26 -24
- {nufi_python-1.1.2 → nufi_python-1.1.3}/pyproject.toml +1 -1
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/auth.py +6 -6
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/auth.py +13 -7
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/common.py +12 -5
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/compiles.py +28 -18
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/custom_evaluation_templates.py +17 -9
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/datasets.py +56 -30
- nufi_python-1.1.3/src/nufi/cli/commands/doctor.py +415 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/evaluations.py +64 -30
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/leaderboards.py +24 -17
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/models.py +49 -46
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/monitoring.py +9 -3
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/profile.py +11 -5
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/projects.py +35 -19
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/servings.py +18 -8
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/main.py +2 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/client.py +1 -1
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/config.py +10 -8
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/evaluator.py +139 -27
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/exceptions.py +1 -1
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/models/__init__.py +4 -0
- nufi_python-1.1.3/src/nufi/models/custom_evaluation_templates.py +324 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/models/evaluations.py +12 -1
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/models/registry.py +3 -3
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/compiles.py +4 -4
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/datasets.py +1 -1
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/leaderboards.py +6 -6
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/models.py +9 -9
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/projects.py +2 -2
- {nufi_python-1.1.2 → nufi_python-1.1.3/src/nufi_python.egg-info}/PKG-INFO +27 -25
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi_python.egg-info/SOURCES.txt +1 -0
- nufi_python-1.1.2/src/nufi/models/custom_evaluation_templates.py +0 -111
- {nufi_python-1.1.2 → nufi_python-1.1.3}/LICENSE +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/setup.cfg +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/__init__.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/__init__.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/__init__.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/http_utils.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/models/compiles.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/models/datasets.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/models/leaderboards.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/models/monitoring.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/models/pagination.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/models/projects.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/models/servings.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/py.typed +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/__init__.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/base.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/custom_evaluation_templates.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/evaluations.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/monitoring.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/resources/servings.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/transport.py +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi_python.egg-info/dependency_links.txt +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi_python.egg-info/entry_points.txt +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi_python.egg-info/requires.txt +0 -0
- {nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi_python.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nufi-python
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
4
4
|
Summary: Python SDK and CLI for the NuFi platform.
|
|
5
5
|
Author: Dudaji Inc.
|
|
6
6
|
License-Expression: MIT
|
|
@@ -42,8 +42,8 @@ python -m pip install "nufi-python[evaluator]"
|
|
|
42
42
|
|
|
43
43
|
## Configure access
|
|
44
44
|
|
|
45
|
-
Ask your NuFi
|
|
46
|
-
access. Create a
|
|
45
|
+
Ask your NuFi Administrator for the installation's base domain and a Project you can
|
|
46
|
+
access. Create a CLI Profile, log in, and select the project once:
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
49
|
nufi profile create production --base-domain nufi.example
|
|
@@ -114,10 +114,10 @@ with NuFi.from_profile() as client:
|
|
|
114
114
|
entries = client.leaderboards.entries(leaderboard.id)
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
##
|
|
117
|
+
## Model Evaluation
|
|
118
118
|
|
|
119
|
-
Dataset import
|
|
120
|
-
|
|
119
|
+
Dataset import and Dataset Profiling complete independently. Wait for the Dataset
|
|
120
|
+
Profile before previewing or creating an Evaluation Method:
|
|
121
121
|
|
|
122
122
|
```bash
|
|
123
123
|
nufi dataset version create mmlu mmlu-aa-test --source huggingface \
|
|
@@ -126,8 +126,8 @@ nufi dataset version profile mmlu mmlu-aa-test --wait --output json
|
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
The SDK uses the import result's `dataset_version_id` for the same workflow. A failed
|
|
129
|
-
|
|
130
|
-
without sending an Evaluation Method request:
|
|
129
|
+
Dataset Profile is returned as a terminal object so the caller can report its server
|
|
130
|
+
error without sending an Evaluation Method request:
|
|
131
131
|
|
|
132
132
|
```python
|
|
133
133
|
from nufi import NuFi
|
|
@@ -148,7 +148,7 @@ if not imported.dataset_version_id:
|
|
|
148
148
|
version_id = imported.dataset_version_id
|
|
149
149
|
profile = client.datasets.versions.wait_for_profile(dataset_id, version_id)
|
|
150
150
|
if profile.status != "ready":
|
|
151
|
-
raise RuntimeError(profile.error or "Dataset
|
|
151
|
+
raise RuntimeError(profile.error or "Dataset Profiling failed")
|
|
152
152
|
|
|
153
153
|
config = {
|
|
154
154
|
"schemaVersion": "nufi.evaluation.method.v2",
|
|
@@ -174,17 +174,17 @@ method = client.evaluations.methods.create(
|
|
|
174
174
|
client.close()
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
Evaluation Method metadata is unconditional and v2-only. Method config is
|
|
178
|
-
validated by the API; the SDK forwards the mapping and any caller-supplied
|
|
179
|
-
without a client-side allowlist.
|
|
177
|
+
Evaluation Method metadata is unconditional and v2-only. Evaluation Method config is
|
|
178
|
+
owned and validated by the API; the SDK forwards the mapping and any caller-supplied
|
|
179
|
+
Evaluation Method type without a client-side allowlist.
|
|
180
180
|
|
|
181
|
-
The `nufi.evaluator.run` helper exits non-zero when
|
|
182
|
-
fails. NuFi determines Run success from Job success
|
|
183
|
-
evaluator output is diagnostic only.
|
|
181
|
+
The `nufi.evaluator.run` helper exits non-zero when an Evaluation Run or result
|
|
182
|
+
submission fails. NuFi determines Evaluation Run success from Kubernetes Job success
|
|
183
|
+
and durable API acceptance; evaluator output is diagnostic only.
|
|
184
184
|
|
|
185
185
|
`evaluation method templates` currently exposes lm-eval templates, metrics, and
|
|
186
|
-
filters. It is an optional discovery command and is not needed when you already have
|
|
187
|
-
Method
|
|
186
|
+
filters. It is an optional discovery command and is not needed when you already have an
|
|
187
|
+
Evaluation Method configuration.
|
|
188
188
|
|
|
189
189
|
```python
|
|
190
190
|
from nufi import NuFi
|
|
@@ -224,8 +224,9 @@ client.evaluations.cancel(run.id, project=project)
|
|
|
224
224
|
client.close()
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
The CLI accepts Dataset, Dataset Version, and Evaluation Method names or UUIDs.
|
|
228
|
-
arguments remain UUIDs because Runs have no name. Select a
|
|
227
|
+
The CLI accepts Dataset, Dataset Version, and Evaluation Method names or UUIDs.
|
|
228
|
+
Evaluation Run arguments remain UUIDs because Evaluation Runs have no name. Select a
|
|
229
|
+
Model Artifact with
|
|
229
230
|
`--model`, `--model-version`, and `--artifact`; `--model-artifact-id` remains available
|
|
230
231
|
for automation. Config, default-runtime, and runner-config files may be JSON or YAML
|
|
231
232
|
and must have a mapping at the document root.
|
|
@@ -263,10 +264,11 @@ nufi evaluation run get RUN_ID --project team-a
|
|
|
263
264
|
nufi evaluation run cancel RUN_ID --yes --project team-a
|
|
264
265
|
```
|
|
265
266
|
|
|
266
|
-
Run creation defaults to `--cpu 4`, `--memory 8Gi`, and
|
|
267
|
-
pass any option to override its default.
|
|
267
|
+
Evaluation Run creation defaults to `--cpu 4`, `--memory 8Gi`, and
|
|
268
|
+
`--accelerator-count 1`; pass any option to override its default.
|
|
268
269
|
|
|
269
|
-
Run detail table output shows aggregate and diagnostic summaries only. Use
|
|
270
|
-
`--output json` to include the authorized bounded diagnostic input, output,
|
|
271
|
-
score, and error fields returned by the API. Additive response fields are
|
|
272
|
-
legacy Method/Run responses missing required v2
|
|
270
|
+
Evaluation Run detail table output shows aggregate and diagnostic summaries only. Use
|
|
271
|
+
explicit `--output json` to include the authorized bounded diagnostic input, output,
|
|
272
|
+
reference, score, and error fields returned by the API. Additive response fields are
|
|
273
|
+
preserved; legacy Evaluation Method/Evaluation Run responses missing required v2
|
|
274
|
+
fields are rejected.
|
|
@@ -20,8 +20,8 @@ python -m pip install "nufi-python[evaluator]"
|
|
|
20
20
|
|
|
21
21
|
## Configure access
|
|
22
22
|
|
|
23
|
-
Ask your NuFi
|
|
24
|
-
access. Create a
|
|
23
|
+
Ask your NuFi Administrator for the installation's base domain and a Project you can
|
|
24
|
+
access. Create a CLI Profile, log in, and select the project once:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
nufi profile create production --base-domain nufi.example
|
|
@@ -92,10 +92,10 @@ with NuFi.from_profile() as client:
|
|
|
92
92
|
entries = client.leaderboards.entries(leaderboard.id)
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
##
|
|
95
|
+
## Model Evaluation
|
|
96
96
|
|
|
97
|
-
Dataset import
|
|
98
|
-
|
|
97
|
+
Dataset import and Dataset Profiling complete independently. Wait for the Dataset
|
|
98
|
+
Profile before previewing or creating an Evaluation Method:
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
101
|
nufi dataset version create mmlu mmlu-aa-test --source huggingface \
|
|
@@ -104,8 +104,8 @@ nufi dataset version profile mmlu mmlu-aa-test --wait --output json
|
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
The SDK uses the import result's `dataset_version_id` for the same workflow. A failed
|
|
107
|
-
|
|
108
|
-
without sending an Evaluation Method request:
|
|
107
|
+
Dataset Profile is returned as a terminal object so the caller can report its server
|
|
108
|
+
error without sending an Evaluation Method request:
|
|
109
109
|
|
|
110
110
|
```python
|
|
111
111
|
from nufi import NuFi
|
|
@@ -126,7 +126,7 @@ if not imported.dataset_version_id:
|
|
|
126
126
|
version_id = imported.dataset_version_id
|
|
127
127
|
profile = client.datasets.versions.wait_for_profile(dataset_id, version_id)
|
|
128
128
|
if profile.status != "ready":
|
|
129
|
-
raise RuntimeError(profile.error or "Dataset
|
|
129
|
+
raise RuntimeError(profile.error or "Dataset Profiling failed")
|
|
130
130
|
|
|
131
131
|
config = {
|
|
132
132
|
"schemaVersion": "nufi.evaluation.method.v2",
|
|
@@ -152,17 +152,17 @@ method = client.evaluations.methods.create(
|
|
|
152
152
|
client.close()
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
Evaluation Method metadata is unconditional and v2-only. Method config is
|
|
156
|
-
validated by the API; the SDK forwards the mapping and any caller-supplied
|
|
157
|
-
without a client-side allowlist.
|
|
155
|
+
Evaluation Method metadata is unconditional and v2-only. Evaluation Method config is
|
|
156
|
+
owned and validated by the API; the SDK forwards the mapping and any caller-supplied
|
|
157
|
+
Evaluation Method type without a client-side allowlist.
|
|
158
158
|
|
|
159
|
-
The `nufi.evaluator.run` helper exits non-zero when
|
|
160
|
-
fails. NuFi determines Run success from Job success
|
|
161
|
-
evaluator output is diagnostic only.
|
|
159
|
+
The `nufi.evaluator.run` helper exits non-zero when an Evaluation Run or result
|
|
160
|
+
submission fails. NuFi determines Evaluation Run success from Kubernetes Job success
|
|
161
|
+
and durable API acceptance; evaluator output is diagnostic only.
|
|
162
162
|
|
|
163
163
|
`evaluation method templates` currently exposes lm-eval templates, metrics, and
|
|
164
|
-
filters. It is an optional discovery command and is not needed when you already have
|
|
165
|
-
Method
|
|
164
|
+
filters. It is an optional discovery command and is not needed when you already have an
|
|
165
|
+
Evaluation Method configuration.
|
|
166
166
|
|
|
167
167
|
```python
|
|
168
168
|
from nufi import NuFi
|
|
@@ -202,8 +202,9 @@ client.evaluations.cancel(run.id, project=project)
|
|
|
202
202
|
client.close()
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
The CLI accepts Dataset, Dataset Version, and Evaluation Method names or UUIDs.
|
|
206
|
-
arguments remain UUIDs because Runs have no name. Select a
|
|
205
|
+
The CLI accepts Dataset, Dataset Version, and Evaluation Method names or UUIDs.
|
|
206
|
+
Evaluation Run arguments remain UUIDs because Evaluation Runs have no name. Select a
|
|
207
|
+
Model Artifact with
|
|
207
208
|
`--model`, `--model-version`, and `--artifact`; `--model-artifact-id` remains available
|
|
208
209
|
for automation. Config, default-runtime, and runner-config files may be JSON or YAML
|
|
209
210
|
and must have a mapping at the document root.
|
|
@@ -241,10 +242,11 @@ nufi evaluation run get RUN_ID --project team-a
|
|
|
241
242
|
nufi evaluation run cancel RUN_ID --yes --project team-a
|
|
242
243
|
```
|
|
243
244
|
|
|
244
|
-
Run creation defaults to `--cpu 4`, `--memory 8Gi`, and
|
|
245
|
-
pass any option to override its default.
|
|
245
|
+
Evaluation Run creation defaults to `--cpu 4`, `--memory 8Gi`, and
|
|
246
|
+
`--accelerator-count 1`; pass any option to override its default.
|
|
246
247
|
|
|
247
|
-
Run detail table output shows aggregate and diagnostic summaries only. Use
|
|
248
|
-
`--output json` to include the authorized bounded diagnostic input, output,
|
|
249
|
-
score, and error fields returned by the API. Additive response fields are
|
|
250
|
-
legacy Method/Run responses missing required v2
|
|
248
|
+
Evaluation Run detail table output shows aggregate and diagnostic summaries only. Use
|
|
249
|
+
explicit `--output json` to include the authorized bounded diagnostic input, output,
|
|
250
|
+
reference, score, and error fields returned by the API. Additive response fields are
|
|
251
|
+
preserved; legacy Evaluation Method/Evaluation Run responses missing required v2
|
|
252
|
+
fields are rejected.
|
|
@@ -42,12 +42,12 @@ class TokenStore:
|
|
|
42
42
|
def path_for(self, profile_name: str) -> Path:
|
|
43
43
|
if not is_valid_profile_name(profile_name):
|
|
44
44
|
raise AuthenticationError(
|
|
45
|
-
"Invalid
|
|
45
|
+
"Invalid CLI Profile name. Use letters, numbers, dot, underscore, or dash."
|
|
46
46
|
)
|
|
47
47
|
path = (self.token_dir / f"{profile_name}.json").resolve()
|
|
48
48
|
token_dir = self.token_dir.resolve()
|
|
49
49
|
if not path.is_relative_to(token_dir):
|
|
50
|
-
raise AuthenticationError("Invalid
|
|
50
|
+
raise AuthenticationError("Invalid CLI Profile name.")
|
|
51
51
|
return path
|
|
52
52
|
|
|
53
53
|
def save(
|
|
@@ -79,13 +79,13 @@ class TokenStore:
|
|
|
79
79
|
path = self.path_for(profile_name)
|
|
80
80
|
if not path.exists():
|
|
81
81
|
raise AuthenticationError(
|
|
82
|
-
f"No token found for
|
|
82
|
+
f"No token found for CLI Profile '{profile_name}'. Run 'nufi login'."
|
|
83
83
|
)
|
|
84
84
|
try:
|
|
85
85
|
return json.loads(path.read_text())
|
|
86
86
|
except json.JSONDecodeError as exc:
|
|
87
87
|
raise AuthenticationError(
|
|
88
|
-
f"Token file for
|
|
88
|
+
f"Token file for CLI Profile '{profile_name}' is invalid."
|
|
89
89
|
) from exc
|
|
90
90
|
|
|
91
91
|
def delete(self, profile_name: str) -> None:
|
|
@@ -111,7 +111,7 @@ def _request_error_message(
|
|
|
111
111
|
hint = ""
|
|
112
112
|
if host:
|
|
113
113
|
hint = (
|
|
114
|
-
f" Check DNS or /etc/hosts for '{host}', or recreate the
|
|
114
|
+
f" Check DNS or /etc/hosts for '{host}', or recreate the CLI Profile with "
|
|
115
115
|
"`nufi profile create <name> --keycloak-issuer <url>`."
|
|
116
116
|
)
|
|
117
117
|
return f"{context}: could not reach Keycloak issuer {issuer}.{hint} Original error: {exc}"
|
|
@@ -235,7 +235,7 @@ def refresh_access_token(
|
|
|
235
235
|
token_store: TokenStore | None = None,
|
|
236
236
|
now: int | Callable[[], int] | None = None,
|
|
237
237
|
) -> str:
|
|
238
|
-
"""Refresh a
|
|
238
|
+
"""Refresh a CLI Profile access token after the API rejects it."""
|
|
239
239
|
token_store = token_store or TokenStore()
|
|
240
240
|
tokens = token_store.load(profile_name)
|
|
241
241
|
refresh_token = tokens.get("refresh_token")
|
|
@@ -17,7 +17,9 @@ def _resolve(profile_name: str | None) -> tuple[str, config.Profile]:
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def login(
|
|
20
|
-
profile_name: str | None = typer.Option(
|
|
20
|
+
profile_name: str | None = typer.Option(
|
|
21
|
+
None, "--profile", help="CLI Profile name."
|
|
22
|
+
),
|
|
21
23
|
open_browser: bool = typer.Option(
|
|
22
24
|
True,
|
|
23
25
|
"--browser/--no-browser",
|
|
@@ -49,7 +51,9 @@ def login(
|
|
|
49
51
|
|
|
50
52
|
|
|
51
53
|
def logout(
|
|
52
|
-
profile_name: str | None = typer.Option(
|
|
54
|
+
profile_name: str | None = typer.Option(
|
|
55
|
+
None, "--profile", help="CLI Profile name."
|
|
56
|
+
),
|
|
53
57
|
):
|
|
54
58
|
try:
|
|
55
59
|
resolved_name, _ = _resolve(profile_name)
|
|
@@ -61,7 +65,9 @@ def logout(
|
|
|
61
65
|
|
|
62
66
|
|
|
63
67
|
def whoami(
|
|
64
|
-
profile_name: str | None = typer.Option(
|
|
68
|
+
profile_name: str | None = typer.Option(
|
|
69
|
+
None, "--profile", help="CLI Profile name."
|
|
70
|
+
),
|
|
65
71
|
):
|
|
66
72
|
try:
|
|
67
73
|
resolved_name, _ = _resolve(profile_name)
|
|
@@ -88,10 +94,10 @@ def whoami(
|
|
|
88
94
|
or str(UUID(token_id)) != token_id
|
|
89
95
|
):
|
|
90
96
|
raise AuthenticationError(
|
|
91
|
-
"NUFI_TOKEN is not a NuFi
|
|
97
|
+
"NUFI_TOKEN is not a NuFi Project Access Token."
|
|
92
98
|
)
|
|
93
99
|
project = projects[0]
|
|
94
|
-
console.print("Authentication:
|
|
100
|
+
console.print("Authentication: Project Access Token")
|
|
95
101
|
console.print(f"Token ID: {token_id}")
|
|
96
102
|
console.print(f"Project: {project.name} ({project.id})")
|
|
97
103
|
return
|
|
@@ -100,7 +106,7 @@ def whoami(
|
|
|
100
106
|
raise typer.Exit(code=1) from exc
|
|
101
107
|
except ValueError as exc:
|
|
102
108
|
console.print(
|
|
103
|
-
"[bold red]Error:[/] NUFI_TOKEN is not a NuFi
|
|
109
|
+
"[bold red]Error:[/] NUFI_TOKEN is not a NuFi Project Access Token."
|
|
104
110
|
)
|
|
105
111
|
raise typer.Exit(code=1) from exc
|
|
106
112
|
except Exception as exc:
|
|
@@ -108,6 +114,6 @@ def whoami(
|
|
|
108
114
|
|
|
109
115
|
username = claims.get("preferred_username") or claims.get("sub") or "-"
|
|
110
116
|
email = claims.get("email") or "-"
|
|
111
|
-
console.print(f"Profile: {resolved_name}")
|
|
117
|
+
console.print(f"CLI Profile: {resolved_name}")
|
|
112
118
|
console.print(f"Username: {username}")
|
|
113
119
|
console.print(f"Email: {email}")
|
|
@@ -165,18 +165,25 @@ def resolve_named_resource(
|
|
|
165
165
|
raise ValidationError(
|
|
166
166
|
f"Multiple {resource}s named '{target}'; matching IDs: {ids}{suffix}."
|
|
167
167
|
)
|
|
168
|
-
raise NotFoundError(f"{resource
|
|
168
|
+
raise NotFoundError(f"{resource} not found: {target}")
|
|
169
169
|
|
|
170
170
|
|
|
171
|
-
def
|
|
172
|
-
*,
|
|
171
|
+
def confirm_action(
|
|
172
|
+
*,
|
|
173
|
+
resource: str,
|
|
174
|
+
target: str,
|
|
175
|
+
profile_name: str | None,
|
|
176
|
+
yes: bool,
|
|
177
|
+
action: str = "Delete",
|
|
173
178
|
) -> None:
|
|
174
179
|
if yes:
|
|
175
180
|
return
|
|
176
181
|
|
|
177
|
-
profile_label =
|
|
182
|
+
profile_label = (
|
|
183
|
+
f"CLI Profile '{profile_name}'" if profile_name else "active CLI Profile"
|
|
184
|
+
)
|
|
178
185
|
if typer.confirm(
|
|
179
|
-
f"
|
|
186
|
+
f"{action} {resource} '{target}' from {profile_label}?",
|
|
180
187
|
default=False,
|
|
181
188
|
):
|
|
182
189
|
return
|
|
@@ -5,7 +5,7 @@ import typer
|
|
|
5
5
|
from nufi.cli.commands import common
|
|
6
6
|
|
|
7
7
|
app = typer.Typer(
|
|
8
|
-
help="Manage NuFi
|
|
8
|
+
help="Manage NuFi Compile Runs.",
|
|
9
9
|
invoke_without_command=True,
|
|
10
10
|
context_settings=common.CONTEXT_SETTINGS,
|
|
11
11
|
)
|
|
@@ -76,7 +76,7 @@ def list_compiles(
|
|
|
76
76
|
version: str | None = typer.Option(
|
|
77
77
|
None,
|
|
78
78
|
"--version",
|
|
79
|
-
help="Model
|
|
79
|
+
help="Model Version.",
|
|
80
80
|
show_default=False,
|
|
81
81
|
),
|
|
82
82
|
phase: list[str] | None = typer.Option(
|
|
@@ -97,10 +97,12 @@ def list_compiles(
|
|
|
97
97
|
"--limit",
|
|
98
98
|
min=1,
|
|
99
99
|
max=100,
|
|
100
|
-
help="Runs per page.",
|
|
100
|
+
help="Compile Runs per page.",
|
|
101
101
|
show_default=False,
|
|
102
102
|
),
|
|
103
|
-
profile_name: str | None = typer.Option(
|
|
103
|
+
profile_name: str | None = typer.Option(
|
|
104
|
+
None, "--profile", help="CLI Profile name."
|
|
105
|
+
),
|
|
104
106
|
output: common.OutputChoice = typer.Option(
|
|
105
107
|
common.OutputChoice.table,
|
|
106
108
|
"--output",
|
|
@@ -178,7 +180,7 @@ def create_compile(
|
|
|
178
180
|
help="Project ID.",
|
|
179
181
|
show_default=False,
|
|
180
182
|
),
|
|
181
|
-
version: str = typer.Option(..., "--version", "-v", help="Model
|
|
183
|
+
version: str = typer.Option(..., "--version", "-v", help="Model Version."),
|
|
182
184
|
tensor_parallel_size: int | None = typer.Option(
|
|
183
185
|
None,
|
|
184
186
|
"--tensor-parallel-size",
|
|
@@ -240,7 +242,9 @@ def create_compile(
|
|
|
240
242
|
interval: float = typer.Option(
|
|
241
243
|
5, "--interval", min=0.001, help="Polling interval in seconds."
|
|
242
244
|
),
|
|
243
|
-
profile_name: str | None = typer.Option(
|
|
245
|
+
profile_name: str | None = typer.Option(
|
|
246
|
+
None, "--profile", help="CLI Profile name."
|
|
247
|
+
),
|
|
244
248
|
output: common.OutputChoice = typer.Option(
|
|
245
249
|
common.OutputChoice.table,
|
|
246
250
|
"--output",
|
|
@@ -272,7 +276,7 @@ def create_compile(
|
|
|
272
276
|
)
|
|
273
277
|
if wait:
|
|
274
278
|
typer.echo(
|
|
275
|
-
f"Compile created: {run.cr_name} (ID: {run.id}); resume with "
|
|
279
|
+
f"Compile Run created: {run.cr_name} (ID: {run.id}); resume with "
|
|
276
280
|
f"'nufi compile wait {run.cr_name}'",
|
|
277
281
|
err=True,
|
|
278
282
|
)
|
|
@@ -292,7 +296,7 @@ def create_compile(
|
|
|
292
296
|
_print_run(run, output)
|
|
293
297
|
else:
|
|
294
298
|
common.console.print(
|
|
295
|
-
f"[bold green]Compile created:[/] {run.cr_name} (ID: {run.id})"
|
|
299
|
+
f"[bold green]Compile Run created:[/] {run.cr_name} (ID: {run.id})"
|
|
296
300
|
)
|
|
297
301
|
if run.phase == "Failed" or run.registration_error:
|
|
298
302
|
raise typer.Exit(code=1)
|
|
@@ -300,12 +304,12 @@ def create_compile(
|
|
|
300
304
|
|
|
301
305
|
@app.command("get")
|
|
302
306
|
def get_compile(
|
|
303
|
-
name: str | None = typer.Argument(None, help="Compile
|
|
307
|
+
name: str | None = typer.Argument(None, help="Compile Run name."),
|
|
304
308
|
run_id: int | None = typer.Option(
|
|
305
309
|
None,
|
|
306
310
|
"--run-id",
|
|
307
311
|
min=1,
|
|
308
|
-
help="Compile
|
|
312
|
+
help="Compile Run ID.",
|
|
309
313
|
show_default=False,
|
|
310
314
|
),
|
|
311
315
|
project: str | None = typer.Option(
|
|
@@ -321,7 +325,9 @@ def get_compile(
|
|
|
321
325
|
help="Project ID.",
|
|
322
326
|
show_default=False,
|
|
323
327
|
),
|
|
324
|
-
profile_name: str | None = typer.Option(
|
|
328
|
+
profile_name: str | None = typer.Option(
|
|
329
|
+
None, "--profile", help="CLI Profile name."
|
|
330
|
+
),
|
|
325
331
|
output: common.OutputChoice = typer.Option(
|
|
326
332
|
common.OutputChoice.table,
|
|
327
333
|
"--output",
|
|
@@ -355,7 +361,7 @@ def get_compile(
|
|
|
355
361
|
|
|
356
362
|
@app.command("wait")
|
|
357
363
|
def wait_compile(
|
|
358
|
-
target: str = typer.Argument(..., help="Compile
|
|
364
|
+
target: str = typer.Argument(..., help="Compile Run name or numeric ID."),
|
|
359
365
|
project: str | None = typer.Option(
|
|
360
366
|
None,
|
|
361
367
|
"--project",
|
|
@@ -375,7 +381,9 @@ def wait_compile(
|
|
|
375
381
|
interval: float = typer.Option(
|
|
376
382
|
5, "--interval", min=0.001, help="Polling interval in seconds."
|
|
377
383
|
),
|
|
378
|
-
profile_name: str | None = typer.Option(
|
|
384
|
+
profile_name: str | None = typer.Option(
|
|
385
|
+
None, "--profile", help="CLI Profile name."
|
|
386
|
+
),
|
|
379
387
|
output: common.OutputChoice = typer.Option(
|
|
380
388
|
common.OutputChoice.table,
|
|
381
389
|
"--output",
|
|
@@ -411,7 +419,7 @@ def wait_compile(
|
|
|
411
419
|
|
|
412
420
|
@app.command("delete")
|
|
413
421
|
def delete_compile(
|
|
414
|
-
name: str = typer.Argument(..., help="Compile
|
|
422
|
+
name: str = typer.Argument(..., help="Compile Run name."),
|
|
415
423
|
project: str | None = typer.Option(
|
|
416
424
|
None,
|
|
417
425
|
"--project",
|
|
@@ -425,7 +433,9 @@ def delete_compile(
|
|
|
425
433
|
help="Project ID.",
|
|
426
434
|
show_default=False,
|
|
427
435
|
),
|
|
428
|
-
profile_name: str | None = typer.Option(
|
|
436
|
+
profile_name: str | None = typer.Option(
|
|
437
|
+
None, "--profile", help="CLI Profile name."
|
|
438
|
+
),
|
|
429
439
|
yes: bool = typer.Option(False, "--yes", help="Skip delete confirmation."),
|
|
430
440
|
verbose: bool = typer.Option(False, "--verbose", help="Show detailed errors."),
|
|
431
441
|
):
|
|
@@ -438,8 +448,8 @@ def delete_compile(
|
|
|
438
448
|
except Exception as exc:
|
|
439
449
|
common.handle_cli_error(exc, verbose=verbose)
|
|
440
450
|
|
|
441
|
-
common.
|
|
442
|
-
resource="
|
|
451
|
+
common.confirm_action(
|
|
452
|
+
resource="Compile Run",
|
|
443
453
|
target=f"{resolved_project}/{name}",
|
|
444
454
|
profile_name=profile_name,
|
|
445
455
|
yes=yes,
|
|
@@ -454,7 +464,7 @@ def delete_compile(
|
|
|
454
464
|
if client is not None:
|
|
455
465
|
client.close()
|
|
456
466
|
|
|
457
|
-
common.console.print(f"[bold green]Compile deleted:[/] {name}")
|
|
467
|
+
common.console.print(f"[bold green]Compile Run deleted:[/] {name}")
|
|
458
468
|
|
|
459
469
|
|
|
460
470
|
def _parse_env(entries: list[str] | None) -> list[dict[str, str]] | None:
|
{nufi_python-1.1.2 → nufi_python-1.1.3}/src/nufi/cli/commands/custom_evaluation_templates.py
RENAMED
|
@@ -12,7 +12,7 @@ from nufi.cli.commands import common
|
|
|
12
12
|
from nufi.resources import CustomEvaluationTemplatesResource
|
|
13
13
|
|
|
14
14
|
app = typer.Typer(
|
|
15
|
-
help="Manage Evaluation Templates.",
|
|
15
|
+
help="Manage Custom Evaluation Templates.",
|
|
16
16
|
invoke_without_command=True,
|
|
17
17
|
context_settings=common.CONTEXT_SETTINGS,
|
|
18
18
|
)
|
|
@@ -25,7 +25,7 @@ ProjectID = Annotated[
|
|
|
25
25
|
int | None,
|
|
26
26
|
typer.Option("--project-id", min=1, help="Project ID.", show_default=False),
|
|
27
27
|
]
|
|
28
|
-
Profile = Annotated[str | None, typer.Option("--profile", help="Profile name.")]
|
|
28
|
+
Profile = Annotated[str | None, typer.Option("--profile", help="CLI Profile name.")]
|
|
29
29
|
Output = Annotated[
|
|
30
30
|
common.OutputChoice,
|
|
31
31
|
typer.Option("--output", help="Output format."),
|
|
@@ -89,7 +89,7 @@ def register_template(
|
|
|
89
89
|
if result.image_policy == "mutable":
|
|
90
90
|
common.error_console.print(
|
|
91
91
|
"[yellow]Warning:[/] this image reference is mutable; different content "
|
|
92
|
-
"may run across Runs."
|
|
92
|
+
"may run across Evaluation Runs."
|
|
93
93
|
)
|
|
94
94
|
if output == common.OutputChoice.json:
|
|
95
95
|
common.print_json(result)
|
|
@@ -141,7 +141,9 @@ def list_templates(
|
|
|
141
141
|
|
|
142
142
|
@app.command("get")
|
|
143
143
|
def get_template(
|
|
144
|
-
template_id: Annotated[
|
|
144
|
+
template_id: Annotated[
|
|
145
|
+
str, typer.Argument(help="Custom Evaluation Template UUID.")
|
|
146
|
+
],
|
|
145
147
|
project: Project = None,
|
|
146
148
|
project_id: ProjectID = None,
|
|
147
149
|
profile_name: Profile = None,
|
|
@@ -163,7 +165,9 @@ def get_template(
|
|
|
163
165
|
|
|
164
166
|
@app.command("archive")
|
|
165
167
|
def archive_template(
|
|
166
|
-
template_id: Annotated[
|
|
168
|
+
template_id: Annotated[
|
|
169
|
+
str, typer.Argument(help="Custom Evaluation Template UUID.")
|
|
170
|
+
],
|
|
167
171
|
project: Project = None,
|
|
168
172
|
project_id: ProjectID = None,
|
|
169
173
|
profile_name: Profile = None,
|
|
@@ -171,7 +175,9 @@ def archive_template(
|
|
|
171
175
|
verbose: Verbose = False,
|
|
172
176
|
):
|
|
173
177
|
try:
|
|
174
|
-
if not yes and not typer.confirm(
|
|
178
|
+
if not yes and not typer.confirm(
|
|
179
|
+
f"Archive Custom Evaluation Template '{template_id}'?"
|
|
180
|
+
):
|
|
175
181
|
raise typer.Exit()
|
|
176
182
|
with _resource(profile_name) as resource:
|
|
177
183
|
resource.archive(
|
|
@@ -182,13 +188,15 @@ def archive_template(
|
|
|
182
188
|
except Exception as exc:
|
|
183
189
|
common.handle_cli_error(exc, verbose=verbose)
|
|
184
190
|
common.console.print(
|
|
185
|
-
f"[bold green]Custom
|
|
191
|
+
f"[bold green]Custom Evaluation Template archived:[/] {escape(template_id)}"
|
|
186
192
|
)
|
|
187
193
|
|
|
188
194
|
|
|
189
195
|
@app.command("restore")
|
|
190
196
|
def restore_template(
|
|
191
|
-
template_id: Annotated[
|
|
197
|
+
template_id: Annotated[
|
|
198
|
+
str, typer.Argument(help="Custom Evaluation Template UUID.")
|
|
199
|
+
],
|
|
192
200
|
project: Project = None,
|
|
193
201
|
project_id: ProjectID = None,
|
|
194
202
|
profile_name: Profile = None,
|
|
@@ -202,5 +210,5 @@ def restore_template(
|
|
|
202
210
|
except Exception as exc:
|
|
203
211
|
common.handle_cli_error(exc, verbose=verbose)
|
|
204
212
|
common.console.print(
|
|
205
|
-
f"[bold green]Custom
|
|
213
|
+
f"[bold green]Custom Evaluation Template restored:[/] {escape(template_id)}"
|
|
206
214
|
)
|