v1

latestOpenAPI 3.1.02026-07-2634132204.7 KB
Embeddings

文本/图片嵌入向量生成接口

将文本/图片转换为向量表示的接口

post/embeddings

Request body

modelstring required

嵌入模型

intent'search_document' | 'search_query' | 'classification' | 'clustering' | 'image'

嵌入意图,用于指定嵌入的使用场景,目前仅 Cohere 向量模型支持该字段,当对图片进行向量化需要指定为 image

dimensionsinteger

输出向量维度

retriesinteger

自动重试次数,默认0,表示失败不重试

Example request

{
  "model": "text-embedding-3-small",
  "dimensions": 1536
}

Response

成功响应

modelstring required

使用的嵌入模型

object'list'

响应对象类型

Example response

{
  "model": "text-embedding-3-small",
  "data": [
    {
      "embedding": [
        -0.006929,
        0.0023415,
        "..."
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}