Create vector store
Create a vector store.
Request body
file_idsarray
A list of File IDs that the vector store should use. Useful for tools like
file_searchthat can access files.itemsstring
namestring
The name of the vector store.expires_afterobject
The expiration policy for a vector store.anchorstringRequired
Anchor timestamp after which the expiration policy applies. Supported anchors:
last_active_at.last_active_atstring
daysintegerRequired
The number of days after the anchor time that the vector store will expire.
chunking_strategyobject
The chunking strategy used to chunk the file(s). If not set, will use the
autostrategy. Only applicable iffile_idsis non-empty.Auto Chunking Strategyobject
The default strategy. This strategy currently uses a
max_chunk_size_tokensof800andchunk_overlap_tokensof400.typestringRequired
Always
auto.autostring
Static Chunking Strategyobject
Customize your own chunking strategy by setting chunk size and chunk overlap.typestringRequired
Always
static.staticstring
staticobjectRequired
max_chunk_size_tokensintegerRequired
The maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.chunk_overlap_tokensintegerRequired
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.
metadataobject 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.
Response
A vector store object.
1 curl https://api.openai.com/v1/vector_stores \2 -H "Authorization: Bearer $OPENAI_API_KEY" \3 -H "Content-Type: application/json" \4 -H "OpenAI-Beta: assistants=v2" \5 -d '{6 "name": "Support FAQ"7 }'
1 {2 "id": "vs_abc123",3 "object": "vector_store",4 "created_at": 1699061776,5 "name": "Support FAQ",6 "bytes": 139920,7 "file_counts": {8 "in_progress": 0,9 "completed": 3,10 "failed": 0,11 "cancelled": 0,12 "total": 313 }14 }