Commit 48121221

Robert Craigie <robert@craigie.dev>
2025-07-07 20:39:27
fix(vector stores): add missing arguments to files.upload_and_poll
1 parent 77d5ac2
Changed files (2)
src
openai
resources
vector_stores
tests
api_resources
vector_stores
src/openai/resources/vector_stores/files.py
@@ -380,6 +380,7 @@ class Files(SyncAPIResource):
         *,
         vector_store_id: str,
         file: FileTypes,
+        attributes: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
         poll_interval_ms: int | NotGiven = NOT_GIVEN,
         chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
     ) -> VectorStoreFile:
@@ -390,6 +391,7 @@ class Files(SyncAPIResource):
             file_id=file_obj.id,
             chunking_strategy=chunking_strategy,
             poll_interval_ms=poll_interval_ms,
+            attributes=attributes,
         )
 
     def content(
@@ -788,6 +790,7 @@ class AsyncFiles(AsyncAPIResource):
         *,
         vector_store_id: str,
         file: FileTypes,
+        attributes: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
         poll_interval_ms: int | NotGiven = NOT_GIVEN,
         chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
     ) -> VectorStoreFile:
@@ -798,6 +801,7 @@ class AsyncFiles(AsyncAPIResource):
             file_id=file_obj.id,
             poll_interval_ms=poll_interval_ms,
             chunking_strategy=chunking_strategy,
+            attributes=attributes,
         )
 
     def content(
tests/api_resources/vector_stores/test_files.py
@@ -637,3 +637,14 @@ def test_create_and_poll_method_in_sync(sync: bool, client: OpenAI, async_client
         checking_client.vector_stores.files.create_and_poll,
         exclude_params={"extra_headers", "extra_query", "extra_body", "timeout"},
     )
+
+
+@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"])
+def test_upload_and_poll_method_in_sync(sync: bool, client: OpenAI, async_client: AsyncOpenAI) -> None:
+    checking_client: OpenAI | AsyncOpenAI = client if sync else async_client
+
+    assert_signatures_in_sync(
+        checking_client.vector_stores.files.create,
+        checking_client.vector_stores.files.upload_and_poll,
+        exclude_params={"file_id", "extra_headers", "extra_query", "extra_body", "timeout"},
+    )