Vector store filesBeta
Vector store files represent files inside a vector store.
Related guide: File Search
Create vector store fileBeta
Create a vector store file by attaching a File to a vector store.
Request body
A File ID that the vector store should use. Useful for tools like file_search
that can access files.
Returns
A vector store file object.
1
2
3
4
5
6
7
curl https://api.openai.com/v1/vector_stores/vs_abc123/files \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v2" \
-d '{
"file_id": "file-abc123"
}'
1
2
3
4
5
6
7
8
9
{
"id": "file-abc123",
"object": "vector_store.file",
"created_at": 1699061776,
"usage_bytes": 1234,
"vector_store_id": "vs_abcd",
"status": "completed",
"last_error": null
}
List vector store filesBeta
Returns a list of vector store files.
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.
A cursor for use in pagination. before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
Returns
A list of vector store file objects.
1
2
3
4
curl https://api.openai.com/v1/vector_stores/vs_abc123/files \
-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
{
"object": "list",
"data": [
{
"id": "file-abc123",
"object": "vector_store.file",
"created_at": 1699061776,
"vector_store_id": "vs_abc123"
},
{
"id": "file-abc456",
"object": "vector_store.file",
"created_at": 1699061776,
"vector_store_id": "vs_abc123"
}
],
"first_id": "file-abc123",
"last_id": "file-abc456",
"has_more": false
}
Retrieve vector store fileBeta
Retrieves a vector store file.
Path parameters
Returns
The vector store file object.
1
2
3
4
curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v2"
1
2
3
4
5
6
7
8
{
"id": "file-abc123",
"object": "vector_store.file",
"created_at": 1699061776,
"vector_store_id": "vs_abcd",
"status": "completed",
"last_error": null
}
Delete vector store fileBeta
Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the delete file endpoint.
Path parameters
Returns
Deletion status
1
2
3
4
5
curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-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: "file-abc123",
object: "vector_store.file.deleted",
deleted: true
}
The vector store file objectBeta
A list of files attached to a vector store.
The total vector store usage in bytes. Note that this may be different from the original file size.
The ID of the vector store that the File is attached to.
The status of the vector store file, which can be either in_progress
, completed
, cancelled
, or failed
. The status completed
indicates that the vector store file is ready for use.
The last error associated with this vector store file. Will be null
if there are no errors.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"id": "file-abc123",
"object": "vector_store.file",
"usage_bytes": 1234,
"created_at": 1698107661,
"vector_store_id": "vs_abc123",
"status": "completed",
"last_error": null,
"chunking_strategy": {
"type": "static",
"static": {
"max_chunk_size_tokens": 800,
"chunk_overlap_tokens": 400
}
}
}