สร้าง embedding
post/v1/embeddings
แปลงข้อความเป็นเวกเตอร์ embedding
การยืนยันตัวตน
ส่งคีย์ API ของ OLETOKEN เป็น Bearer token สร้างคีย์ได้ที่หน้า API Keys ในคอนโซล
Authorization: Bearer $OLETOKEN_API_KEYเนื้อหาคำขอ
Content-Type:application/json
| ฟิลด์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
| model | string | — | |
| input | string | string[] | ข้อความที่ต้องการแปลงเป็น embedding | |
| encoding_format | stringdefault: floatfloatbase64 | — | — |
| dimensions | integer | — | จำนวนมิติของเวกเตอร์เอาต์พุต |
การตอบกลับ
200สร้าง embedding แล้ว
| ฟิลด์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
| 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/embeddings' \
-H "Authorization: Bearer $OLETOKEN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "text-embedding-ada-002",
"input": "string"
}'
