矢量存储文件批处理试用版
试用版
向量存储文件批次表示将多个文件添加到向量存储的作。 相关指南: 文件搜索
创建矢量存储文件批处理试用版
试用版
POST https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches
创建向量存储文件批处理。
请求正文
矢量存储应使用的文件 ID 列表。适用于以下工具file_search
可以访问文件。
返回
矢量存储文件批处理对象。
示例请求
1
2
3
4
5
6
7
curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json \
-H "OpenAI-Beta: assistants=v2" \
-d '{
"file_ids": ["file-abc123", "file-abc456"]
}'
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"id": "vsfb_abc123",
"object": "vector_store.file_batch",
"created_at": 1699061776,
"vector_store_id": "vs_abc123",
"status": "in_progress",
"file_counts": {
"in_progress": 1,
"completed": 1,
"failed": 0,
"cancelled": 0,
"total": 0,
}
}
检索向量存储文件批处理试用版
试用版
获取 https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}
检索向量存储文件批次。
返回
矢量存储文件批处理对象。
示例请求
1
2
3
4
curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_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
9
10
11
12
13
14
{
"id": "vsfb_abc123",
"object": "vector_store.file_batch",
"created_at": 1699061776,
"vector_store_id": "vs_abc123",
"status": "in_progress",
"file_counts": {
"in_progress": 1,
"completed": 1,
"failed": 0,
"cancelled": 0,
"total": 0,
}
}
取消向量存储文件批处理试用版
试用版
post https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel
取消矢量存储文件批处理。这将尝试尽快取消此批处理中的文件的处理。
返回
修改后的 vector store file 批处理对象。
示例请求
1
2
3
4
5
curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v2" \
-X POST
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"id": "vsfb_abc123",
"object": "vector_store.file_batch",
"created_at": 1699061776,
"vector_store_id": "vs_abc123",
"status": "cancelling",
"file_counts": {
"in_progress": 12,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 15,
}
}
批量列出向量存储文件试用版
试用版
获取 https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_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_batches/vsfb_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
}
向量存储文件批处理对象试用版
试用版
附加到向量存储的一批文件。
OBJECT 向量存储文件批处理对象
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"id": "vsfb_123",
"object": "vector_store.files_batch",
"created_at": 1698107661,
"vector_store_id": "vs_abc123",
"status": "completed",
"file_counts": {
"in_progress": 0,
"completed": 100,
"failed": 0,
"cancelled": 0,
"total": 100
}
}