POST /v1/research
研究
检索、阅读并给出带来源引用的答案。fast 在请求内返回答案,deep 在后台运行,auto 自动选择。
请求体
- query
- string
- 必填。要搜索或研究的内容。不能为空,最多 2,000 个字符。
- mode
- string
- fast 快速作答,deep 深入研究,auto 根据问题自动选择。默认值:auto
响应
- id
- string
- Run id,用于查询、取消或删除该 Run。
- status
- string
- queued、running、completed、failed 或 cancelled。
- created_
at - string
- Run 的创建时间。
- started_
at - string | null
- Run 的开始时间;开始前为 null。
- completed_
at - string | null
- Run 的结束时间;结束前为 null。
- mode
- string
- Run 实际使用的模式:fast 或 deep。
- message
- string
- Run 进行中时附带的轮询提示。
- requested_
mode - string
- 请求时指定的模式。
- error.
code - string
- 失败原因,仅在 status 为 failed 时返回。
- error.
retryable - boolean
- 用相同问题重试是否可能成功。
- result.
answer - string
- 答案,Run 完成后返回。
- result.
sources - object[]
- 引用的来源,每项包含 title 和 url。
Run
fast 请求最多等待 20 秒,返回 200 和已结束的 Run。deep,或等待结束时仍在进行的 Run,返回 202 和 Run id:查询它,直到 status 为 completed、failed 或 cancelled。请求头 Prefer: respond-async 立即返回,Prefer: wait=N 最多等待 N 秒。
- 查询
GET /v1/research/{id} - 返回 Run 的当前状态。queued 或 running 时,等待 Retry-After 后再查询。
- 取消
POST /v1/research/{id}/cancel - 已取消返回 200,取消进行中返回 202。已结束的 Run 返回 409 run_not_cancellable。
- 删除
DELETE /v1/research/{id} - 已删除返回 204。运行中的 Run 返回 202,停止并删除后查询会返回 404。
对 Run 的所有操作都要使用创建它的 API 密钥。