Chat OpenAI(ChatGPT)中文文档
  1. Rerank API
Chat OpenAI(ChatGPT)中文文档
  • 发出请求
  • 模型接口
    • 完成对象
    • OpenAI接口(Chat)
      • 列出模型
      • 聊天接口(通用)
      • 官方Function calling调用
      • 官方N测试
      • 官方最新response_format
      • 识图接口(通用)
    • Anthropic Claude
      • 官方Function calling调用
      • 聊天接口
      • 聊天接口(原生API格式请求)
      • 识图接口
    • 谷歌Gemini
      • 聊天接口
      • 识图接口
    • Midjourney
      • 提交swap_face任务
      • 执行Action动作
      • 根据ID列表查询任务
      • 提交Blend任务
      • 指定ID获取任务
      • 提交Describe任务
      • 获取任务图片的seed
      • 提交Imagine任务
      • 提交Modal
      • 上传文件到discord
    • GPTs 相关
      • GPTs对话
      • 搜索相关 GPTs
      • 查询 GPTs 详情
      • 批量查询 GPTs 详情
      • gpt-4-all(分析图片)
      • gpt-4-all(生成图片)
    • 文生音乐 Suno
      • 生成歌曲(API格式)
      • 生成歌词(API格式)
      • 查询单个任务(API格式)
      • 文生音乐(Chat格式)
    • 文生视频
      • 智谱清言GLM
      • 文生视频(luma)
      • 文生视频(runway)
    • Rerank API
      • Rerank API
        POST
    • 自动补全接口(Completions)
      • 内容补全接口
    • 文生图接口
      • DALL·E 3
      • Flux(OpenAI dall-e-3格式)
      • ideogram
      • Stable-Diffusion
    • 向量生成接口(Embeddings)
      • 创建嵌入
    • 音频接口(Audio)
      • 创建转录
      • 创建翻译
      • TTS文本转语音
    • 审查(Moderations)
      • 创建内容审核
  • 帮助中心
    • 常见问题及解决办法
  1. Rerank API

Rerank API

POST
/rerank
模型供应商选择Jina,按要求填写模型信息即可接入Dify。

请求参数

Header 参数
Content-Type
string 
必需
示例值:
application/json
Accept
string 
必需
示例值:
application/json
Authorization
string 
必需
示例值:
Bearer {{YOUR_API_KEY}}
Body 参数application/json
model
string 
必需
要使用的模型的 ID。有关哪些模型适用于聊天 API 的详细信息,请参阅模型端点兼容性表。
messages
array [object {2}] 
必需
以聊天格式生成聊天完成的消息。
role
string 
可选
content
string 
可选
temperature
integer 
可选
使用什么采样温度,介于 0 和 2 之间。较高的值(如 0.8)将使输出更加随机,而较低的值(如 0.2)将使输出更加集中和确定。 我们通常建议改变这个或top_p但不是两者。
top_p
integer 
可选
一种替代温度采样的方法,称为核采样,其中模型考虑具有 top_p 概率质量的标记的结果。所以 0.1 意味着只考虑构成前 10% 概率质量的标记。 我们通常建议改变这个或temperature但不是两者。
n
integer 
可选
为每个输入消息生成多少个聊天完成选项。
stream
boolean 
可选
如果设置,将发送部分消息增量,就像在 ChatGPT 中一样。当令牌可用时,令牌将作为纯数据服务器发送事件data: [DONE]发送,流由消息终止。有关示例代码,请参阅 OpenAI Cookbook 。
stop
string 
可选
API 将停止生成更多令牌的最多 4 个序列。
max_tokens
integer 
可选
聊天完成时生成的最大令牌数。 输入标记和生成标记的总长度受模型上下文长度的限制。
presence_penalty
number 
可选
-2.0 和 2.0 之间的数字。正值会根据到目前为止是否出现在文本中来惩罚新标记,从而增加模型谈论新主题的可能性。 查看有关频率和存在惩罚的更多信息。
frequency_penalty
number 
可选
-2.0 和 2.0 之间的数字。正值会根据新标记在文本中的现有频率对其进行惩罚,从而降低模型逐字重复同一行的可能性。 查看有关频率和存在惩罚的更多信息。
logit_bias
null 
可选
修改指定标记出现在完成中的可能性。 接受一个 json 对象,该对象将标记(由标记器中的标记 ID 指定)映射到从 -100 到 100 的关联偏差值。从数学上讲,偏差会在采样之前添加到模型生成的 logits 中。确切的效果因模型而异,但 -1 和 1 之间的值应该会减少或增加选择的可能性;像 -100 或 100 这样的值应该导致相关令牌的禁止或独占选择。
user
string 
可选
代表您的最终用户的唯一标识符,可以帮助 OpenAI 监控和检测滥用行为。了解更多。
示例
{
  "model": "rerank-multilingual-v3.0",
  "query": "What is the capital of the United States?",
  "top_n": 3,
  "documents": [
    "Carson City is the capital city of the American state of Nevada.",
    "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.",
    "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.",
    "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.",
    "Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states."
  ]
}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://gitaigc.com/v1/rerank' \
--header 'Accept: application/json' \
--header 'Accept;' \
--header 'Authorization: Bearer ' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "rerank-multilingual-v3.0",
  "query": "What is the capital of the United States?",
  "top_n": 3,
  "documents": [
    "Carson City is the capital city of the American state of Nevada.",
    "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.",
    "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.",
    "Capitalization or capitalisation in English grammar is the use of a capital letter at the start of a word. English usage varies from capitalization in other languages.",
    "Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states."
  ]
}'

返回响应

🟢200OK
application/json
Body
id
string 
必需
object
string 
必需
created
integer 
必需
choices
array [object {3}] 
必需
index
integer 
可选
message
object 
可选
finish_reason
string 
可选
usage
object 
必需
prompt_tokens
integer 
必需
completion_tokens
integer 
必需
total_tokens
integer 
必需
示例
{
    "id": "chatcmpl-123",
    "object": "chat.completion",
    "created": 1677652288,
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "\n\nHello there, how may I assist you today?"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 9,
        "completion_tokens": 12,
        "total_tokens": 21
    }
}
上一页
文生视频(runway)
下一页
内容补全接口
Built with