文件上传接口
POST
/v1/files限制:单个文档限制 50MB,文档数量上限 100 个。
知识库目前支持 pdf、doc、docx 类型文件。
如果您收到速率限制的报错,则表示您在短时间内发出了太多请求,API 会拒绝新请求,直到经过指定的时间。
请求参数
Header 参数
Authorization
string
必需
请求鉴权的 APIKey,由百川提供。Bearer 开头
示例值:
Bearer $API_KEY
Body 参数multipart/form-data
purpose
string
文件意图
示例值:
knowledge-base
file
string
上传的文件内容
示例值:
mydata.pdf
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
id
string
必需
文件唯一标识,用于文件接口
object
string
必需
类型,文件对象类型为'file'
bytes
integer
文件字节数大小
created_at
integer
必需
创建时间,Unix 时间戳(秒)
filename
string
文件名称
purpose
string
必需
文件的使用意图。如'knowledge-base'
示例
{
"id": "file-abc123",
"object": "file",
"bytes": 120000,
"created_at": 1677610602,
"filename": "mydata.pdf",
"purpose": "knowledge-base"
}
修改于 9 个月前