MCPcopy
hub / github.com/openai/openai-python / upload

Method upload

src/openai/resources/vector_stores/files.py:401–414  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

399 return file
400
401 def upload(
402 self,
403 *,
404 vector_store_id: str,
405 file: FileTypes,
406 chunking_strategy: FileChunkingStrategyParam | Omit = omit,
407 ) -> VectorStoreFile:
408 """Upload a file to the `files` API and then attach it to the given vector store.
409
410 Note the file will be asynchronously processed (you can use the alternative
411 polling helper method to wait for processing to complete).
412 """
413 file_obj = self._client.files.create(file=file, purpose="assistants")
414 return self.create(vector_store_id=vector_store_id, file_id=file_obj.id, chunking_strategy=chunking_strategy)
415
416 def upload_and_poll(
417 self,

Callers

nothing calls this directly

Calls 1

createMethod · 0.95

Tested by

no test coverage detected