Embeddings
MarkdownBiểu diễn văn bản bằng vector để tìm kiếm, RAG và phân cụm.
Hướng dẫn đầy đủ
POST
https://api.ailoot.ai/v1/embeddingscurl https://api.ailoot.ai/v1/embeddings \
-H "Authorization: Bearer $AILOOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "nvidia/nemotron-3-embed-1b", "input": ["Tài liệu thứ nhất", "Tài liệu thứ hai"]}' emb = client.embeddings.create(
model="nvidia/nemotron-3-embed-1b",
input=["Tài liệu thứ nhất", "Tài liệu thứ hai"],
)
vectors = [d.embedding for d in emb.data]{
"object": "list",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, 0.0789, …] },
{ "object": "embedding", "index": 1, "embedding": [-0.0321, 0.0654, 0.0987, …] }
],
"model": "nvidia/nemotron-3-embed-1b",
"usage": { "prompt_tokens": 8, "total_tokens": 8 }
}Xác thực
- Authorizationheaderbắt buộc
Khóa có dạng
Bearer sk-…. Cũng có thể dùng các headerx-api-keyhoặcx-goog-api-key.
Phần thân yêu cầu
- modelstringbắt buộc
Mô hình embedding:
nvidia/nemotron-3-embed-1b,nvidia/llama-nemotron-embed-vl-1b-v2. - inputstring | arraybắt buộc
Chuỗi hoặc mảng chuỗi. Độ dài mỗi đầu vào bị giới hạn bởi cửa sổ ngữ cảnh của mô hình (với mô hình NVIDIA — 4096 token).
- encoding_formatstringkhông bắt buộc
float(mặc định) hoặcbase64— nếu mô hình hỗ trợ.
Phản hồi
- data[].embeddingarray
Vector số cho từng đầu vào, theo cùng thứ tự.
- usageobject
Số token đầu vào. Đầu ra của embedding không bị tính phí.
Còn câu hỏi? Hãy gửi Request ID và mô tả — chúng tôi sẽ giúp tìm hiểu.Liên hệ hỗ trợ