logo

Embeddings và Rerank

Embeddings

Yêu cầu embedding tương thích OpenAI sử dụng POST /v1/embeddings.

curl https://llmoxy.com/v1/embeddings \
  -H "Authorization: Bearer <LLMOXY_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": ["first document", "second document"],
    "encoding_format": "float"
  }'

Các trường thường dùng:

TrườngMô tả
modelBắt buộc, ID mô hình Embedding.
inputChuỗi hoặc mảng chuỗi.
encoding_formatCó thể là float hoặc base64 khi nhà cung cấp hỗ trợ.
dimensionsMô hình hỗ trợ có thể chỉ định số chiều đầu ra.
userĐịnh danh theo dõi tùy chọn.

Yêu cầu Embedding kiểu Gemini có thể sử dụng:

POST /v1/engines/{model}/embeddings

Rerank

Sử dụng POST /v1/rerank để gọi các mô hình Rerank như Jina, Cohere.

curl https://llmoxy.com/v1/rerank \
  -H "Authorization: Bearer <LLMOXY_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jina-reranker-v2-base-multilingual",
    "query": "What is LLMoxy?",
    "documents": [
      "LLMoxy is an LLM gateway.",
      "A database stores rows."
    ],
    "top_n": 1,
    "return_documents": true
  }'

Các trường thường dùng:

TrườngMô tả
modelBắt buộc, ID mô hình Rerank.
queryVăn bản truy vấn.
documentsMảng chuỗi hoặc đối tượng tài liệu.
top_nSố lượng kết quả sắp xếp tối đa trả về.
return_documentsCó bao gồm tài liệu gốc trong phản hồi hay không.