Client.vector_stores.file_batches.create_and_poll documentation

Vector store batch upload provides this example Retrieval | OpenAI API:

client.vector_stores.file_batches.create_and_poll(
    vector_store_id="vs_123",
    files=[
        {
            "file_id": "file_123",
            "attributes": {"department": "finance"}
        },
        {
            "file_id": "file_456",
            "chunking_strategy": {
                "type": "static",
                "max_chunk_size_tokens": 1200,
                "chunk_overlap_tokens": 200
            }
        }
    ]
)

but I am strangely enough getting this error message “Error: FileBatches.create_and_poll() got an unexpected keyword argument ‘files’“. Anyone else having the same problem uploading several files to a vector store?

Also, I am using OpenAI SDK 2.8.0

2 Likes

I was able to reproduce this and cross-checked it against the Node SDK:

  • Python (openai==2.16.0 and 2.8.0): client.vector_stores.file_batches.create_and_poll(..., files=[...]) fails immediately with TypeError: unexpected keyword argument 'files' (so it’s the helper signature, before any request is sent).
  • Node (openai@^6.18.0): client.vectorStores.fileBatches.createAndPoll(vectorStoreId, { files: [...] }) works and completes successfully.

This looks like a Python SDK helper parity bug: the backend supports files for batch create (and Node’s helper exposes it), but Python’s create_and_poll helper currently only supports file_ids.

Workarounds on Python:

  • If you don’t need per-file overrides, use file_ids=[...] with create_and_poll.
  • If you do need attributes / per-file chunking_strategy, call create(..., files=[...]) and then poll(...) as a second step (same end result, just not via the combined helper).

I’ll flag this as a Python SDK issue so create_and_poll can accept files as documented.

3 Likes

A fix for this particular issue will be rolled out with the next update.

1 Like