Embeddings
Convert text into vectors for semantic search, RAG, and content recommendations.
Overview
Embeddings convert text into vectors so applications can retrieve content by semantic similarity. Common uses include semantic search, retrieval-augmented generation (RAG), and related-content recommendations.
Embeddings retrieve candidates from a large collection. Rerank receives a query and candidate documents and refines their order. You can use either capability independently or combine them into a two-stage retrieval pipeline.
API access
Base URL
https://api.agtcloud.cn/v1Create embeddings
curl 'https://api.agtcloud.cn/v1/embeddings' \
-H 'Authorization: Bearer your-api-key' \
-H 'Content-Type: application/json' \
--data '{
"model": "MODEL_ID",
"input": [
"AGTCloud provides a unified model API.",
"Embeddings can power semantic retrieval."
]
}'| Parameter | Required | Description |
|---|---|---|
model | Yes | Embedding model ID |
input | Yes | A text value, text array, or token array |
encoding_format | No | Encoding format for returned vectors |
dimensions | No | Requested output dimensions; supported by selected models only |
Read the result
data[].embedding: generated vector.data[].index: input index associated with the vector.usage: token usage for the request.
Keep indexing and queries consistent
| Setting | Possible result when inconsistent |
|---|---|
| Model and version | Old and new vectors use different spaces and cannot be compared reliably |
| Vector dimensions | Vector-store writes or similarity calculations fail |
| Text preprocessing | Query and document representations drift apart |
| Distance metric | Score meaning and ranking change |