切换主题
原生Gemini格式
使用指定引擎/模型创建嵌入
原生Gemini格式
POST /v1/engines/{model}/embeddings
使用指定引擎/模型创建嵌入
认证
BearerAuth
请求参数
| 名称 | 位置 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
| model | path | 是 | string | 模型/引擎 ID |
请求体
必填:否
application/json
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| model | 是 | string | Examples: text-embedding-ada-002 |
| input | 是 | oneOf<string | array<string>> | 要嵌入的文本 |
| encoding_format | 否 | enum: float | base64 | Default: float |
| dimensions | 否 | integer | 输出向量维度 |
原始 Schema
json
{
"type": "object",
"required": [
"model",
"input"
],
"properties": {
"model": {
"type": "string",
"examples": [
"text-embedding-ada-002"
]
},
"input": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"description": "要嵌入的文本"
},
"encoding_format": {
"type": "string",
"enum": [
"float",
"base64"
],
"default": "float"
},
"dimensions": {
"type": "integer",
"description": "输出向量维度"
}
},
"x-apifox-orders": [
"model",
"input",
"encoding_format",
"dimensions"
]
}响应
200 成功创建嵌入
application/json
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| object | 否 | string | Examples: list |
| data | 否 | array<object> | - |
| data[].object | 否 | string | Examples: embedding |
| data[].index | 否 | integer | - |
| data[].embedding | 否 | array<number> | - |
| model | 否 | string | - |
| usage | 否 | object | - |
| usage.prompt_tokens | 否 | integer | - |
| usage.total_tokens | 否 | integer | - |
原始 Schema
json
{
"type": "object",
"properties": {
"object": {
"type": "string",
"examples": [
"list"
]
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"object": {
"type": "string",
"examples": [
"embedding"
]
},
"index": {
"type": "integer"
},
"embedding": {
"type": "array",
"items": {
"type": "number"
}
}
},
"x-apifox-orders": [
"object",
"index",
"embedding"
]
}
},
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"prompt_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
}
},
"x-apifox-orders": [
"prompt_tokens",
"total_tokens"
]
}
},
"x-apifox-orders": [
"object",
"data",
"model",
"usage"
]
}