Skip to content

Commit df9183a

Browse files
feat(files): fix Files API gaps for OpenAI spec parity
1 parent e932a74 commit df9183a

4 files changed

Lines changed: 11 additions & 27 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 67
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack/llama-stack-client-7f49892b4f9f8b421343f703c14da6fd5a93bba1baada52c1fe72da0e79fcf8e.yml
3-
openapi_spec_hash: 9c2a6e9e73f135654d42469299b01daa
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack/llama-stack-client-fc9526103a5b5694beadb96747682d8a3ccc8390d1c3b1e40720ebc9a8a33fb0.yml
3+
openapi_spec_hash: 916928d4ba727df210b4a28166ff2047
44
config_hash: 3d294831d7b8066ba59a8934b980a943

src/ogx_client/resources/files.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def create(
5454
*,
5555
file: FileTypes,
5656
purpose: Literal["assistants", "batch", "fine-tune", "vision", "user_data", "evals"],
57-
expires_after: Optional[file_create_params.ExpiresAfter] | Omit = omit,
57+
expires_after: Optional[str] | Omit = omit,
5858
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5959
# The extra values given here take precedence over values defined on the client or passed to this method.
6060
extra_headers: Headers | None = None,
@@ -70,7 +70,7 @@ def create(
7070
7171
purpose: The intended purpose of the uploaded file.
7272
73-
expires_after: Control expiration of uploaded files.
73+
expires_after: Optional expiration settings for the file.
7474
7575
extra_headers: Send extra headers
7676
@@ -305,7 +305,7 @@ async def create(
305305
*,
306306
file: FileTypes,
307307
purpose: Literal["assistants", "batch", "fine-tune", "vision", "user_data", "evals"],
308-
expires_after: Optional[file_create_params.ExpiresAfter] | Omit = omit,
308+
expires_after: Optional[str] | Omit = omit,
309309
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
310310
# The extra values given here take precedence over values defined on the client or passed to this method.
311311
extra_headers: Headers | None = None,
@@ -321,7 +321,7 @@ async def create(
321321
322322
purpose: The intended purpose of the uploaded file.
323323
324-
expires_after: Control expiration of uploaded files.
324+
expires_after: Optional expiration settings for the file.
325325
326326
extra_headers: Send extra headers
327327

src/ogx_client/types/file_create_params.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from .._types import FileTypes
99

10-
__all__ = ["FileCreateParams", "ExpiresAfter"]
10+
__all__ = ["FileCreateParams"]
1111

1212

1313
class FileCreateParams(TypedDict, total=False):
@@ -17,15 +17,5 @@ class FileCreateParams(TypedDict, total=False):
1717
purpose: Required[Literal["assistants", "batch", "fine-tune", "vision", "user_data", "evals"]]
1818
"""The intended purpose of the uploaded file."""
1919

20-
expires_after: Optional[ExpiresAfter]
21-
"""Control expiration of uploaded files."""
22-
23-
24-
class ExpiresAfter(TypedDict, total=False):
25-
"""Control expiration of uploaded files."""
26-
27-
anchor: Required[Literal["created_at"]]
28-
"""The anchor point for expiration, must be 'created_at'."""
29-
30-
seconds: Required[int]
31-
"""Seconds until expiration, between 3600 (1 hour) and 2592000 (30 days)."""
20+
expires_after: Optional[str]
21+
"""Optional expiration settings for the file."""

tests/api_resources/test_files.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ def test_method_create_with_all_params(self, client: OgxClient) -> None:
3131
file = client.files.create(
3232
file=b"Example data",
3333
purpose="assistants",
34-
expires_after={
35-
"anchor": "created_at",
36-
"seconds": 3600,
37-
},
34+
expires_after="expires_after",
3835
)
3936
assert_matches_type(File, file, path=["response"])
4037

@@ -232,10 +229,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOgxClient)
232229
file = await async_client.files.create(
233230
file=b"Example data",
234231
purpose="assistants",
235-
expires_after={
236-
"anchor": "created_at",
237-
"seconds": 3600,
238-
},
232+
expires_after="expires_after",
239233
)
240234
assert_matches_type(File, file, path=["response"])
241235

0 commit comments

Comments
 (0)