Skip to content

Commit 62c459a

Browse files
feat!: improve consistency of post-training API endpoints
1 parent acd5e64 commit 62c459a

File tree

4 files changed

+210
-36
lines changed

4 files changed

+210
-36
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 108
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-958e990011d6b4c27513743a151ec4c80c3103650a80027380d15f1d6b108e32.yml
3-
openapi_spec_hash: 5b49d825dbc2a26726ca752914a65114
4-
config_hash: 19b84a0a93d566334ae134dafc71991f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-7082771a4cef842834c167a755a9eafb9e9f412349e06abae9ee0331adcc8c49.yml
3+
openapi_spec_hash: 711015fd57cb31962ee3683ea7dafe32
4+
config_hash: 07e70c7f1980785685ea4f2618dfde62

api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,9 @@ from llama_stack_client.types.alpha.post_training import (
474474
Methods:
475475

476476
- <code title="get /v1alpha/post-training/jobs">client.alpha.post_training.job.<a href="./src/llama_stack_client/resources/alpha/post_training/job.py">list</a>() -> <a href="./src/llama_stack_client/types/alpha/post_training/job_list_response.py">JobListResponse</a></code>
477-
- <code title="get /v1alpha/post-training/job/artifacts">client.alpha.post_training.job.<a href="./src/llama_stack_client/resources/alpha/post_training/job.py">artifacts</a>() -> <a href="./src/llama_stack_client/types/alpha/post_training/job_artifacts_response.py">JobArtifactsResponse</a></code>
478-
- <code title="post /v1alpha/post-training/job/cancel">client.alpha.post_training.job.<a href="./src/llama_stack_client/resources/alpha/post_training/job.py">cancel</a>() -> None</code>
479-
- <code title="get /v1alpha/post-training/job/status">client.alpha.post_training.job.<a href="./src/llama_stack_client/resources/alpha/post_training/job.py">status</a>() -> <a href="./src/llama_stack_client/types/alpha/post_training/job_status_response.py">JobStatusResponse</a></code>
477+
- <code title="get /v1alpha/post-training/jobs/{job_uuid}/artifacts">client.alpha.post_training.job.<a href="./src/llama_stack_client/resources/alpha/post_training/job.py">artifacts</a>(job_uuid) -> <a href="./src/llama_stack_client/types/alpha/post_training/job_artifacts_response.py">JobArtifactsResponse</a></code>
478+
- <code title="post /v1alpha/post-training/jobs/{job_uuid}/cancel">client.alpha.post_training.job.<a href="./src/llama_stack_client/resources/alpha/post_training/job.py">cancel</a>(job_uuid) -> None</code>
479+
- <code title="get /v1alpha/post-training/jobs/{job_uuid}/status">client.alpha.post_training.job.<a href="./src/llama_stack_client/resources/alpha/post_training/job.py">status</a>(job_uuid) -> <a href="./src/llama_stack_client/types/alpha/post_training/job_status_response.py">JobStatusResponse</a></code>
480480

481481
## Benchmarks
482482

src/llama_stack_client/resources/alpha/post_training/job.py

Lines changed: 108 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def list(
7575

7676
def artifacts(
7777
self,
78+
job_uuid: str,
7879
*,
7980
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
8081
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -83,9 +84,24 @@ def artifacts(
8384
extra_body: Body | None = None,
8485
timeout: float | httpx.Timeout | None | NotGiven = not_given,
8586
) -> JobArtifactsResponse:
86-
"""Get the artifacts of a training job."""
87+
"""
88+
Get the artifacts of a training job.
89+
90+
Args:
91+
job_uuid: The UUID of the job to get the artifacts of.
92+
93+
extra_headers: Send extra headers
94+
95+
extra_query: Add additional query parameters to the request
96+
97+
extra_body: Add additional JSON properties to the request
98+
99+
timeout: Override the client-level default timeout for this request, in seconds
100+
"""
101+
if not job_uuid:
102+
raise ValueError(f"Expected a non-empty value for `job_uuid` but received {job_uuid!r}")
87103
return self._get(
88-
"/v1alpha/post-training/job/artifacts",
104+
f"/v1alpha/post-training/jobs/{job_uuid}/artifacts",
89105
options=make_request_options(
90106
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
91107
),
@@ -94,6 +110,7 @@ def artifacts(
94110

95111
def cancel(
96112
self,
113+
job_uuid: str,
97114
*,
98115
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
99116
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -102,10 +119,25 @@ def cancel(
102119
extra_body: Body | None = None,
103120
timeout: float | httpx.Timeout | None | NotGiven = not_given,
104121
) -> None:
105-
"""Cancel a training job."""
122+
"""
123+
Cancel a training job.
124+
125+
Args:
126+
job_uuid: The UUID of the job to cancel.
127+
128+
extra_headers: Send extra headers
129+
130+
extra_query: Add additional query parameters to the request
131+
132+
extra_body: Add additional JSON properties to the request
133+
134+
timeout: Override the client-level default timeout for this request, in seconds
135+
"""
136+
if not job_uuid:
137+
raise ValueError(f"Expected a non-empty value for `job_uuid` but received {job_uuid!r}")
106138
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
107139
return self._post(
108-
"/v1alpha/post-training/job/cancel",
140+
f"/v1alpha/post-training/jobs/{job_uuid}/cancel",
109141
options=make_request_options(
110142
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
111143
),
@@ -114,6 +146,7 @@ def cancel(
114146

115147
def status(
116148
self,
149+
job_uuid: str,
117150
*,
118151
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
119152
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -122,9 +155,24 @@ def status(
122155
extra_body: Body | None = None,
123156
timeout: float | httpx.Timeout | None | NotGiven = not_given,
124157
) -> JobStatusResponse:
125-
"""Get the status of a training job."""
158+
"""
159+
Get the status of a training job.
160+
161+
Args:
162+
job_uuid: The UUID of the job to get the status of.
163+
164+
extra_headers: Send extra headers
165+
166+
extra_query: Add additional query parameters to the request
167+
168+
extra_body: Add additional JSON properties to the request
169+
170+
timeout: Override the client-level default timeout for this request, in seconds
171+
"""
172+
if not job_uuid:
173+
raise ValueError(f"Expected a non-empty value for `job_uuid` but received {job_uuid!r}")
126174
return self._get(
127-
"/v1alpha/post-training/job/status",
175+
f"/v1alpha/post-training/jobs/{job_uuid}/status",
128176
options=make_request_options(
129177
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
130178
),
@@ -177,6 +225,7 @@ async def list(
177225

178226
async def artifacts(
179227
self,
228+
job_uuid: str,
180229
*,
181230
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
182231
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -185,9 +234,24 @@ async def artifacts(
185234
extra_body: Body | None = None,
186235
timeout: float | httpx.Timeout | None | NotGiven = not_given,
187236
) -> JobArtifactsResponse:
188-
"""Get the artifacts of a training job."""
237+
"""
238+
Get the artifacts of a training job.
239+
240+
Args:
241+
job_uuid: The UUID of the job to get the artifacts of.
242+
243+
extra_headers: Send extra headers
244+
245+
extra_query: Add additional query parameters to the request
246+
247+
extra_body: Add additional JSON properties to the request
248+
249+
timeout: Override the client-level default timeout for this request, in seconds
250+
"""
251+
if not job_uuid:
252+
raise ValueError(f"Expected a non-empty value for `job_uuid` but received {job_uuid!r}")
189253
return await self._get(
190-
"/v1alpha/post-training/job/artifacts",
254+
f"/v1alpha/post-training/jobs/{job_uuid}/artifacts",
191255
options=make_request_options(
192256
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
193257
),
@@ -196,6 +260,7 @@ async def artifacts(
196260

197261
async def cancel(
198262
self,
263+
job_uuid: str,
199264
*,
200265
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
201266
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -204,10 +269,25 @@ async def cancel(
204269
extra_body: Body | None = None,
205270
timeout: float | httpx.Timeout | None | NotGiven = not_given,
206271
) -> None:
207-
"""Cancel a training job."""
272+
"""
273+
Cancel a training job.
274+
275+
Args:
276+
job_uuid: The UUID of the job to cancel.
277+
278+
extra_headers: Send extra headers
279+
280+
extra_query: Add additional query parameters to the request
281+
282+
extra_body: Add additional JSON properties to the request
283+
284+
timeout: Override the client-level default timeout for this request, in seconds
285+
"""
286+
if not job_uuid:
287+
raise ValueError(f"Expected a non-empty value for `job_uuid` but received {job_uuid!r}")
208288
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
209289
return await self._post(
210-
"/v1alpha/post-training/job/cancel",
290+
f"/v1alpha/post-training/jobs/{job_uuid}/cancel",
211291
options=make_request_options(
212292
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
213293
),
@@ -216,6 +296,7 @@ async def cancel(
216296

217297
async def status(
218298
self,
299+
job_uuid: str,
219300
*,
220301
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
221302
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -224,9 +305,24 @@ async def status(
224305
extra_body: Body | None = None,
225306
timeout: float | httpx.Timeout | None | NotGiven = not_given,
226307
) -> JobStatusResponse:
227-
"""Get the status of a training job."""
308+
"""
309+
Get the status of a training job.
310+
311+
Args:
312+
job_uuid: The UUID of the job to get the status of.
313+
314+
extra_headers: Send extra headers
315+
316+
extra_query: Add additional query parameters to the request
317+
318+
extra_body: Add additional JSON properties to the request
319+
320+
timeout: Override the client-level default timeout for this request, in seconds
321+
"""
322+
if not job_uuid:
323+
raise ValueError(f"Expected a non-empty value for `job_uuid` but received {job_uuid!r}")
228324
return await self._get(
229-
"/v1alpha/post-training/job/status",
325+
f"/v1alpha/post-training/jobs/{job_uuid}/status",
230326
options=make_request_options(
231327
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
232328
),

0 commit comments

Comments
 (0)