feat(files, s3, expiration): add expires_after support to S3 files provider (#3283)

This commit is contained in:
Matthew Farrellee 2025-08-29 19:17:24 -04:00 committed by GitHub
parent 78a78264a7
commit 3370d8e557
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 372 additions and 81 deletions

View file

@ -86,11 +86,16 @@ class LocalfsFilesImpl(Files):
self,
file: Annotated[UploadFile, File()],
purpose: Annotated[OpenAIFilePurpose, Form()],
expires_after_anchor: Annotated[str | None, Form(alias="expires_after[anchor]")] = None,
expires_after_seconds: Annotated[int | None, Form(alias="expires_after[seconds]")] = None,
) -> OpenAIFileObject:
"""Upload a file that can be used across various endpoints."""
if not self.sql_store:
raise RuntimeError("Files provider not initialized")
if expires_after_anchor is not None or expires_after_seconds is not None:
raise NotImplementedError("File expiration is not supported by this provider")
file_id = self._generate_file_id()
file_path = self._get_file_path(file_id)