POST
/v1/embeddingsEmbeddings
Create vector embeddings for semantic search, similarity detection, and RAG applications. Returns dense vectors that capture the semantic meaning of your text.
Request
Example Request
curl https://api.assisters.dev/v1/embeddings \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "bge-large-en",
"input": "The quick brown fox jumps over the lazy dog"
}'Parameters
modelrequiredstringID of the embedding model to use.
Available models:
bge-large-en- High quality English embeddings (1024 dimensions)bge-base-en- Balanced performance/speed (768 dimensions)all-minilm-l6- Fast, lightweight (384 dimensions)multilingual-e5- 100+ languages support (768 dimensions)
inputrequiredstring | arrayText to embed. Can be a single string or array of strings for batch processing. Maximum 8192 tokens per input string.
encoding_formatoptionalstringdefault: floatFormat for the embeddings. float for full precision, base64 for compressed.
Response
Example Response
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [0.0023, -0.0094, 0.0152, ...],
"index": 0
}
],
"model": "bge-large-en",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}Use Cases
Semantic Search
Find documents with similar meaning, not just matching keywords.
RAG Applications
Retrieve relevant context for LLM responses from your knowledge base.
Recommendations
Find similar products, articles, or content based on embeddings.
Duplicate Detection
Identify near-duplicate content even with different wording.
Code Examples
Python
embeddings.py
from assisters import Assisters
client = Assisters(api_key="YOUR_API_KEY")
# Single embedding
response = client.embeddings.create(
model="bge-large-en",
input="What is machine learning?"
)
embedding = response.data[0].embedding
print(f"Embedding dimension: {len(embedding)}")
# Batch embeddings
texts = ["First document", "Second document", "Third document"]
response = client.embeddings.create(
model="bge-large-en",
input=texts
)
for i, data in enumerate(response.data):
print(f"Document {i}: {len(data.embedding)} dimensions")