Create vector store file batch

POSThttps:/api.openai.com/v1/vector_stores/{vector_store_id}/file_batches

Create a vector store file batch.

Path parameters

  • vector_store_id
    string
    Required
    The ID of the vector store for which to create a File Batch.

Request body

  • file_ids
    array
    Required

    A list of File IDs that the vector store should use. Useful for tools like file_search that can access files.

    • items
      string
  • chunking_strategy
    object

    The chunking strategy used to chunk the file(s). If not set, will use the auto strategy.

    • Auto Chunking Strategy
      object

      The default strategy. This strategy currently uses a max_chunk_size_tokens of 800 and chunk_overlap_tokens of 400.

      • type
        string
        Required

        Always auto.

        • auto
          string
    • Static Chunking Strategy
      object
      Customize your own chunking strategy by setting chunk size and chunk overlap.
      • type
        string
        Required

        Always static.

        • static
          string
      • static
        object
        Required
        • max_chunk_size_tokens
          integer
          Required

          The maximum number of tokens in each chunk. The default value is 800. The minimum value is 100 and the maximum value is 4096.

        • chunk_overlap_tokens
          integer
          Required

          The number of tokens that overlap between chunks. The default value is 400.

          Note that the overlap must not exceed half of max_chunk_size_tokens.

  • attributes
    object or null
    Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.

Response

Example request
1
curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \
2
-H "Authorization: Bearer $OPENAI_API_KEY" \
3
-H "Content-Type: application/json \
4
-H "OpenAI-Beta: assistants=v2" \
5
-d '{
6
"file_ids": ["file-abc123", "file-abc456"]
7
}'
Example response
1
{
2
"id": "vsfb_abc123",
3
"object": "vector_store.file_batch",
4
"created_at": 1699061776,
5
"vector_store_id": "vs_abc123",
6
"status": "in_progress",
7
"file_counts": {
8
"in_progress": 1,
9
"completed": 1,
10
"failed": 0,
11
"cancelled": 0,
12
"total": 0,
13
}
14
}
Built with