Upload a file to the `files` API and then attach it to the given vector store. Note the file will be asynchronously processed (you can use the alternative polling helper method to wait for processing to complete).
(
self,
*,
vector_store_id: str,
file: FileTypes,
chunking_strategy: FileChunkingStrategyParam | Omit = omit,
)
| 853 | return file |
| 854 | |
| 855 | async def upload( |
| 856 | self, |
| 857 | *, |
| 858 | vector_store_id: str, |
| 859 | file: FileTypes, |
| 860 | chunking_strategy: FileChunkingStrategyParam | Omit = omit, |
| 861 | ) -> VectorStoreFile: |
| 862 | """Upload a file to the `files` API and then attach it to the given vector store. |
| 863 | |
| 864 | Note the file will be asynchronously processed (you can use the alternative |
| 865 | polling helper method to wait for processing to complete). |
| 866 | """ |
| 867 | file_obj = await self._client.files.create(file=file, purpose="assistants") |
| 868 | return await self.create( |
| 869 | vector_store_id=vector_store_id, file_id=file_obj.id, chunking_strategy=chunking_strategy |
| 870 | ) |
| 871 | |
| 872 | async def upload_and_poll( |
| 873 | self, |