Gemini 向量嵌入
post/v1/engines/{model}/embeddings
使用指定的引擎或模型建立向量嵌入。
驗證
把 OLETOKEN 的 API Key 作為 Bearer Token 放進 Authorization 請求標頭。金鑰在控制台的「API 金鑰」頁建立。
Authorization: Bearer $OLETOKEN_API_KEY請求參數
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| modelpath | string | 模型或引擎 ID |
請求主體
Content-Type:application/json
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| model | string | — | |
| input | string | string[] | 要產生向量嵌入的文字 | |
| encoding_format | stringdefault: floatfloatbase64 | — | — |
| dimensions | integer | — | 輸出向量維度 |
回應
200已建立向量嵌入
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| object | string | — | — |
| data | object[] | — | — |
| object | string | — | — |
| index | integer | — | — |
| embedding | number[] | — | — |
| model | string | — | — |
| usage | object | — | — |
| prompt_tokens | integer | — | — |
| total_tokens | integer | — | — |
請求範例
curl -X POST 'https://api.oletoken.ai/v1/engines/{model}/embeddings' \
-H "Authorization: Bearer $OLETOKEN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "text-embedding-ada-002",
"input": "string"
}'
