Embeddings

Tạo vector embeddings từ text — dùng cho semantic search, RAG, clustering.

POST https://bizgpt.vn/wp-json/bizcity/v1/llm/embeddings

Request Body

model string required

Model embedding. Ví dụ: openai/text-embedding-3-small, openai/text-embedding-ada-002

input string | array required

Đoạn text hoặc mảng texts cần tạo embedding.

Ví dụ

bash
curl -X POST https://bizgpt.vn/wp-json/bizcity/v1/llm/embeddings \
  -H "Authorization: Bearer biz-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/text-embedding-3-small",
    "input": "BizCity là nền tảng AI cho WordPress"
  }'

Response

json
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0091, 0.0157, "... 1536 dimensions"]
    }
  ],
  "model": "openai/text-embedding-3-small",
  "usage": {
    "prompt_tokens": 12,
    "total_tokens": 12
  }
}

Batch Embeddings

Gửi nhiều texts cùng lúc bằng mảng input:

json
{
  "model": "openai/text-embedding-3-small",
  "input": [
    "Câu thứ nhất",
    "Câu thứ hai",
    "Câu thứ ba"
  ]
}

Response sẽ trả về mảng data tương ứng với từng input.

Use Cases

Use CaseMô tả
Semantic SearchTìm kiếm nội dung theo ý nghĩa thay vì keyword
RAGRetrieval-Augmented Generation — bổ sung context từ tài liệu
ClusteringPhân nhóm văn bản tự động
ClassificationPhân loại nội dung (spam, topic, sentiment)
RecommendationGợi ý nội dung tương tự