Embedding Gemini
post/v1/engines/{model}/embeddings
Tạo embedding bằng engine hoặc mô hình được chỉ định.
Xác thực
Gửi khóa API OLETOKEN dưới dạng token Bearer. Khóa được tạo tại trang API Keys trong bảng điều khiển.
Authorization: Bearer $OLETOKEN_API_KEYTham số
| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| modelpath | string | ID mô hình hoặc engine |
Nội dung yêu cầu
Content-Type:application/json
| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| model | string | — | |
| input | string | string[] | Văn bản cần tạo embedding | |
| encoding_format | stringdefault: floatfloatbase64 | — | — |
| dimensions | integer | — | Số chiều của vector đầu ra |
Phản hồi
200Đã tạo embedding
| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| object | string | — | — |
| data | object[] | — | — |
| object | string | — | — |
| index | integer | — | — |
| embedding | number[] | — | — |
| model | string | — | — |
| usage | object | — | — |
| prompt_tokens | integer | — | — |
| total_tokens | integer | — | — |
Ví dụ yêu cầu
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"
}'
