跳过至正文
POST
/
api
/
embed
curl https://:11434/api/embed -d '{
  "model": "embeddinggemma",
  "input": "Why is the sky blue?"
}'
{
  "model": "embeddinggemma",
  "embeddings": [
    [
      0.010071029,
      -0.0017594862,
      0.05007221,
      0.04692972,
      0.054916814,
      0.008599704,
      0.105441414,
      -0.025878139,
      0.12958129,
      0.031952348
    ]
  ],
  "total_duration": 14143917,
  "load_duration": 1019500,
  "prompt_eval_count": 8
}

主体 (Body)

application/json
model
string
必填

模型名称

input
必填

用于生成嵌入的文本或文本数组

truncate
boolean
默认:true

如果为 true,则截断超过上下文窗口的输入。如果为 false,则返回错误。

dimensions
integer

生成嵌入的维度数量

keep_alive
string

模型保活时长

options
object

控制文本生成的运行时选项

响应

200 - application/json

输入文本的向量嵌入

model
string

生成嵌入的模型

embeddings
number[][]

向量嵌入数组

total_duration
integer

生成的总耗时(以纳秒为单位)

load_duration
integer

加载耗时(以纳秒为单位)

prompt_eval_count
integer

用于生成嵌入的处理输入 token 数量