Vector storesBeta
Vector stores are used to store files for use by the file_search
tool.
Related guide: File Search
Create vector storeBeta
Create a vector store.
Request body
A list of File IDs that the vector store should use. Useful for tools like file_search
that can access files.
The chunking strategy used to chunk the file(s). If not set, will use the auto
strategy. Only applicable if file_ids
is non-empty.
Returns
A vector store object.
1
2
3
4
5
6
7
curl https://api.openai.com/v1/vector_stores \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v2"
-d '{
"name": "Support FAQ"
}'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"id": "vs_abc123",
"object": "vector_store",
"created_at": 1699061776,
"name": "Support FAQ",
"bytes": 139920,
"file_counts": {
"in_progress": 0,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 3
}
}
List vector storesBeta
Returns a list of vector stores.
Query parameters
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Sort order by the created_at
timestamp of the objects. asc
for ascending order and desc
for descending order.
A cursor for use in pagination. after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
Returns
A list of vector store objects.
1
2
3
4
curl https://api.openai.com/v1/vector_stores \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v2"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
"object": "list",
"data": [
{
"id": "vs_abc123",
"object": "vector_store",
"created_at": 1699061776,
"name": "Support FAQ",
"bytes": 139920,
"file_counts": {
"in_progress": 0,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 3
}
},
{
"id": "vs_abc456",
"object": "vector_store",
"created_at": 1699061776,
"name": "Support FAQ v2",
"bytes": 139920,
"file_counts": {
"in_progress": 0,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 3
}
}
],
"first_id": "vs_abc123",
"last_id": "vs_abc456",
"has_more": false
}
Retrieve vector storeBeta
Retrieves a vector store.
Returns
The vector store object matching the specified ID.
1
2
3
4
curl https://api.openai.com/v1/vector_stores/vs_abc123 \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v2"
1
2
3
4
5
{
"id": "vs_abc123",
"object": "vector_store",
"created_at": 1699061776
}
Modify vector storeBeta
Modifies a vector store.
Request body
Returns
The modified vector store object.
1
2
3
4
5
6
7
curl https://api.openai.com/v1/vector_stores/vs_abc123 \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v2"
-d '{
"name": "Support FAQ"
}'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"id": "vs_abc123",
"object": "vector_store",
"created_at": 1699061776,
"name": "Support FAQ",
"bytes": 139920,
"file_counts": {
"in_progress": 0,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 3
}
}
Delete vector storeBeta
Delete a vector store.
Returns
Deletion status
1
2
3
4
5
curl https://api.openai.com/v1/vector_stores/vs_abc123 \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v2" \
-X DELETE
1
2
3
4
5
{
id: "vs_abc123",
object: "vector_store.deleted",
deleted: true
}
The vector store objectBeta
A vector store is a collection of processed files can be used by the file_search
tool.
The status of the vector store, which can be either expired
, in_progress
, or completed
. A status of completed
indicates that the vector store is ready for use.
The Unix timestamp (in seconds) for when the vector store was last active.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"id": "vs_123",
"object": "vector_store",
"created_at": 1698107661,
"usage_bytes": 123456,
"last_active_at": 1698107661,
"name": "my_vector_store",
"status": "completed",
"file_counts": {
"in_progress": 0,
"completed": 100,
"cancelled": 0,
"failed": 0,
"total": 100
},
"metadata": {},
"last_used_at": 1698107661
}