4Z API

重排序

接口: POST https://4zapi.com/v1/rerank

给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。

为提供的提示和参数创建完成

官方文档:https://docs.siliconflow.cn/cn/api-reference/rerank/create-rerank

参数

  • Content-Type (header, string, 必填): 请求体 Content-Type,一般为 application/json
  • Accept (header, string, 必填): 期望的响应 Content-Type
  • Authorization (header, string): Bearer API Key
  • X-Forwarded-Host (header, string): 转发原始 Host(代理场景)

请求体 (application/json)

  • documents (array<string>, 必填): 待重排的文档列表
  • instruct (string, 必填): 重排指令 / 附加说明
  • model (string, 必填): 模型名称 / 型号 ID
  • query (string, 必填): 查询文本
  • top_n (integer, 必填): 返回前 N 条结果

请求示例

{
  "documents": [
    "文本排序模型广泛用于搜索引擎 and 推荐系统中,它们根据文本相关性对候选文本进行排序",
    "量子计算是计算科学的一个前沿领域",
    "预训练语言模型的发展给文本排序模型带来了新的进展"
  ],
  "instruct": "Given a web search query, retrieve relevant passages that answer the query.",
  "model": "qwen3-rerank",
  "query": "什么是文本排序模型",
  "top_n": 2
}