Skip to content

Commit 7cdbd06

Browse files
chore(internal): reduce warnings
1 parent b1de941 commit 7cdbd06

7 files changed

Lines changed: 361 additions & 38 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 148
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-b879fff3f51e71e4f1ce17f03efc017a46d888a1bfd88eb655a6210a86f02acf.yml
33
openapi_spec_hash: cbf649cc2c944fb3f77450ec752ab1e9
4-
config_hash: 7ce3344e237b57dccafe71cb9413ddd4
4+
config_hash: 9c56fcc7ff64785b5cd448d9a754b4b3

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ Types:
309309
from openai.types.fine_tuning.checkpoints import (
310310
PermissionCreateResponse,
311311
PermissionRetrieveResponse,
312+
PermissionListResponse,
312313
PermissionDeleteResponse,
313314
)
314315
```
@@ -317,6 +318,7 @@ Methods:
317318

318319
- <code title="post /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">create</a>(fine_tuned_model_checkpoint, \*\*<a href="src/openai/types/fine_tuning/checkpoints/permission_create_params.py">params</a>) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_create_response.py">SyncPage[PermissionCreateResponse]</a></code>
319320
- <code title="get /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">retrieve</a>(fine_tuned_model_checkpoint, \*\*<a href="src/openai/types/fine_tuning/checkpoints/permission_retrieve_params.py">params</a>) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_retrieve_response.py">PermissionRetrieveResponse</a></code>
321+
- <code title="get /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">list</a>(fine_tuned_model_checkpoint, \*\*<a href="src/openai/types/fine_tuning/checkpoints/permission_list_params.py">params</a>) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_list_response.py">SyncConversationCursorPage[PermissionListResponse]</a></code>
320322
- <code title="delete /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">delete</a>(permission_id, \*, fine_tuned_model_checkpoint) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_delete_response.py">PermissionDeleteResponse</a></code>
321323

322324
## Alpha

src/openai/resources/fine_tuning/checkpoints/permissions.py

Lines changed: 164 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import typing_extensions
56
from typing_extensions import Literal
67

78
import httpx
@@ -12,9 +13,14 @@
1213
from ...._compat import cached_property
1314
from ...._resource import SyncAPIResource, AsyncAPIResource
1415
from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
15-
from ....pagination import SyncPage, AsyncPage
16+
from ....pagination import SyncPage, AsyncPage, SyncConversationCursorPage, AsyncConversationCursorPage
1617
from ...._base_client import AsyncPaginator, make_request_options
17-
from ....types.fine_tuning.checkpoints import permission_create_params, permission_retrieve_params
18+
from ....types.fine_tuning.checkpoints import (
19+
permission_list_params,
20+
permission_create_params,
21+
permission_retrieve_params,
22+
)
23+
from ....types.fine_tuning.checkpoints.permission_list_response import PermissionListResponse
1824
from ....types.fine_tuning.checkpoints.permission_create_response import PermissionCreateResponse
1925
from ....types.fine_tuning.checkpoints.permission_delete_response import PermissionDeleteResponse
2026
from ....types.fine_tuning.checkpoints.permission_retrieve_response import PermissionRetrieveResponse
@@ -88,6 +94,7 @@ def create(
8894
method="post",
8995
)
9096

97+
@typing_extensions.deprecated("Retrieve is deprecated. Please swap to the paginated list method instead.")
9198
def retrieve(
9299
self,
93100
fine_tuned_model_checkpoint: str,
@@ -150,6 +157,69 @@ def retrieve(
150157
cast_to=PermissionRetrieveResponse,
151158
)
152159

160+
def list(
161+
self,
162+
fine_tuned_model_checkpoint: str,
163+
*,
164+
after: str | Omit = omit,
165+
limit: int | Omit = omit,
166+
order: Literal["ascending", "descending"] | Omit = omit,
167+
project_id: str | Omit = omit,
168+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
169+
# The extra values given here take precedence over values defined on the client or passed to this method.
170+
extra_headers: Headers | None = None,
171+
extra_query: Query | None = None,
172+
extra_body: Body | None = None,
173+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
174+
) -> SyncConversationCursorPage[PermissionListResponse]:
175+
"""
176+
**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
177+
178+
Organization owners can use this endpoint to view all permissions for a
179+
fine-tuned model checkpoint.
180+
181+
Args:
182+
after: Identifier for the last permission ID from the previous pagination request.
183+
184+
limit: Number of permissions to retrieve.
185+
186+
order: The order in which to retrieve permissions.
187+
188+
project_id: The ID of the project to get permissions for.
189+
190+
extra_headers: Send extra headers
191+
192+
extra_query: Add additional query parameters to the request
193+
194+
extra_body: Add additional JSON properties to the request
195+
196+
timeout: Override the client-level default timeout for this request, in seconds
197+
"""
198+
if not fine_tuned_model_checkpoint:
199+
raise ValueError(
200+
f"Expected a non-empty value for `fine_tuned_model_checkpoint` but received {fine_tuned_model_checkpoint!r}"
201+
)
202+
return self._get_api_list(
203+
f"/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions",
204+
page=SyncConversationCursorPage[PermissionListResponse],
205+
options=make_request_options(
206+
extra_headers=extra_headers,
207+
extra_query=extra_query,
208+
extra_body=extra_body,
209+
timeout=timeout,
210+
query=maybe_transform(
211+
{
212+
"after": after,
213+
"limit": limit,
214+
"order": order,
215+
"project_id": project_id,
216+
},
217+
permission_list_params.PermissionListParams,
218+
),
219+
),
220+
model=PermissionListResponse,
221+
)
222+
153223
def delete(
154224
self,
155225
permission_id: str,
@@ -258,6 +328,7 @@ def create(
258328
method="post",
259329
)
260330

331+
@typing_extensions.deprecated("Retrieve is deprecated. Please swap to the paginated list method instead.")
261332
async def retrieve(
262333
self,
263334
fine_tuned_model_checkpoint: str,
@@ -320,6 +391,69 @@ async def retrieve(
320391
cast_to=PermissionRetrieveResponse,
321392
)
322393

394+
def list(
395+
self,
396+
fine_tuned_model_checkpoint: str,
397+
*,
398+
after: str | Omit = omit,
399+
limit: int | Omit = omit,
400+
order: Literal["ascending", "descending"] | Omit = omit,
401+
project_id: str | Omit = omit,
402+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
403+
# The extra values given here take precedence over values defined on the client or passed to this method.
404+
extra_headers: Headers | None = None,
405+
extra_query: Query | None = None,
406+
extra_body: Body | None = None,
407+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
408+
) -> AsyncPaginator[PermissionListResponse, AsyncConversationCursorPage[PermissionListResponse]]:
409+
"""
410+
**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
411+
412+
Organization owners can use this endpoint to view all permissions for a
413+
fine-tuned model checkpoint.
414+
415+
Args:
416+
after: Identifier for the last permission ID from the previous pagination request.
417+
418+
limit: Number of permissions to retrieve.
419+
420+
order: The order in which to retrieve permissions.
421+
422+
project_id: The ID of the project to get permissions for.
423+
424+
extra_headers: Send extra headers
425+
426+
extra_query: Add additional query parameters to the request
427+
428+
extra_body: Add additional JSON properties to the request
429+
430+
timeout: Override the client-level default timeout for this request, in seconds
431+
"""
432+
if not fine_tuned_model_checkpoint:
433+
raise ValueError(
434+
f"Expected a non-empty value for `fine_tuned_model_checkpoint` but received {fine_tuned_model_checkpoint!r}"
435+
)
436+
return self._get_api_list(
437+
f"/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions",
438+
page=AsyncConversationCursorPage[PermissionListResponse],
439+
options=make_request_options(
440+
extra_headers=extra_headers,
441+
extra_query=extra_query,
442+
extra_body=extra_body,
443+
timeout=timeout,
444+
query=maybe_transform(
445+
{
446+
"after": after,
447+
"limit": limit,
448+
"order": order,
449+
"project_id": project_id,
450+
},
451+
permission_list_params.PermissionListParams,
452+
),
453+
),
454+
model=PermissionListResponse,
455+
)
456+
323457
async def delete(
324458
self,
325459
permission_id: str,
@@ -369,8 +503,13 @@ def __init__(self, permissions: Permissions) -> None:
369503
self.create = _legacy_response.to_raw_response_wrapper(
370504
permissions.create,
371505
)
372-
self.retrieve = _legacy_response.to_raw_response_wrapper(
373-
permissions.retrieve,
506+
self.retrieve = ( # pyright: ignore[reportDeprecated]
507+
_legacy_response.to_raw_response_wrapper(
508+
permissions.retrieve, # pyright: ignore[reportDeprecated],
509+
)
510+
)
511+
self.list = _legacy_response.to_raw_response_wrapper(
512+
permissions.list,
374513
)
375514
self.delete = _legacy_response.to_raw_response_wrapper(
376515
permissions.delete,
@@ -384,8 +523,13 @@ def __init__(self, permissions: AsyncPermissions) -> None:
384523
self.create = _legacy_response.async_to_raw_response_wrapper(
385524
permissions.create,
386525
)
387-
self.retrieve = _legacy_response.async_to_raw_response_wrapper(
388-
permissions.retrieve,
526+
self.retrieve = ( # pyright: ignore[reportDeprecated]
527+
_legacy_response.async_to_raw_response_wrapper(
528+
permissions.retrieve, # pyright: ignore[reportDeprecated],
529+
)
530+
)
531+
self.list = _legacy_response.async_to_raw_response_wrapper(
532+
permissions.list,
389533
)
390534
self.delete = _legacy_response.async_to_raw_response_wrapper(
391535
permissions.delete,
@@ -399,8 +543,13 @@ def __init__(self, permissions: Permissions) -> None:
399543
self.create = to_streamed_response_wrapper(
400544
permissions.create,
401545
)
402-
self.retrieve = to_streamed_response_wrapper(
403-
permissions.retrieve,
546+
self.retrieve = ( # pyright: ignore[reportDeprecated]
547+
to_streamed_response_wrapper(
548+
permissions.retrieve, # pyright: ignore[reportDeprecated],
549+
)
550+
)
551+
self.list = to_streamed_response_wrapper(
552+
permissions.list,
404553
)
405554
self.delete = to_streamed_response_wrapper(
406555
permissions.delete,
@@ -414,8 +563,13 @@ def __init__(self, permissions: AsyncPermissions) -> None:
414563
self.create = async_to_streamed_response_wrapper(
415564
permissions.create,
416565
)
417-
self.retrieve = async_to_streamed_response_wrapper(
418-
permissions.retrieve,
566+
self.retrieve = ( # pyright: ignore[reportDeprecated]
567+
async_to_streamed_response_wrapper(
568+
permissions.retrieve, # pyright: ignore[reportDeprecated],
569+
)
570+
)
571+
self.list = async_to_streamed_response_wrapper(
572+
permissions.list,
419573
)
420574
self.delete = async_to_streamed_response_wrapper(
421575
permissions.delete,

src/openai/types/fine_tuning/checkpoints/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
from __future__ import annotations
44

5+
from .permission_list_params import PermissionListParams as PermissionListParams
56
from .permission_create_params import PermissionCreateParams as PermissionCreateParams
7+
from .permission_list_response import PermissionListResponse as PermissionListResponse
68
from .permission_create_response import PermissionCreateResponse as PermissionCreateResponse
79
from .permission_delete_response import PermissionDeleteResponse as PermissionDeleteResponse
810
from .permission_retrieve_params import PermissionRetrieveParams as PermissionRetrieveParams
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal, TypedDict
6+
7+
__all__ = ["PermissionListParams"]
8+
9+
10+
class PermissionListParams(TypedDict, total=False):
11+
after: str
12+
"""Identifier for the last permission ID from the previous pagination request."""
13+
14+
limit: int
15+
"""Number of permissions to retrieve."""
16+
17+
order: Literal["ascending", "descending"]
18+
"""The order in which to retrieve permissions."""
19+
20+
project_id: str
21+
"""The ID of the project to get permissions for."""
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing_extensions import Literal
4+
5+
from ...._models import BaseModel
6+
7+
__all__ = ["PermissionListResponse"]
8+
9+
10+
class PermissionListResponse(BaseModel):
11+
"""
12+
The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.
13+
"""
14+
15+
id: str
16+
"""The permission identifier, which can be referenced in the API endpoints."""
17+
18+
created_at: int
19+
"""The Unix timestamp (in seconds) for when the permission was created."""
20+
21+
object: Literal["checkpoint.permission"]
22+
"""The object type, which is always "checkpoint.permission"."""
23+
24+
project_id: str
25+
"""The project identifier that the permission is for."""

0 commit comments

Comments
 (0)