矢量存储文件试用版
试用版
矢量存储文件表示矢量存储中的文件。
相关指南: 文件搜索
创建矢量存储文件试用版
试用版
发布 https://api.openai.com/v1/vector_stores/{vector_store_id}/files
请求正文
矢量存储应使用的文件 ID。适用于以下工具file_search
可以访问文件。
返回
矢量存储文件对象。
示例请求
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
}
列出向量存储文件试用版
试用版
获取 https://api.openai.com/v1/vector_stores/{vector_store_id}/files
返回矢量存储文件的列表。
查询参数
用于分页的游标。after
是定义您在列表中的位置的对象 ID。例如,如果您发出列表请求并收到 100 个对象,以 obj_foo 结尾,则您的后续调用可以包含 after=obj_foo 以便获取列表的下一页。
用于分页的游标。before
是定义您在列表中的位置的对象 ID。例如,如果您发出一个列表请求并收到 100 个对象,以 obj_foo 开头,则您的后续调用可以包含 before=obj_foo 以便获取列表的上一页。
返回
矢量存储文件对象的列表。
示例请求
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
}
检索向量存储文件试用版
试用版
示例请求
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
}
删除 vector store 文件试用版
试用版
删除 https://api.openai.com/v1/vector_stores/{vector_store_id}/files/{file_id}
删除 vector store 文件。这将从矢量存储中删除文件,但不会删除文件本身。要删除文件,请使用 delete file 端点。
返回
删除状态
示例请求
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
}
矢量存储文件对象试用版
试用版
附加到矢量存储的文件列表。
OBJECT 向量存储文件对象
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
}
}
}