Embeddings & reranking
Helmcode gives you the two retrieval primitives RAG needs — embeddings to find candidate passages, reranking to order them by true relevance. Pipeline: embed → search → rerank → LLM.
Embeddings
Generate vectors with qwen3-embedding (8B, 4096 dimensions, 100+ languages) at the OpenAI-compatible /v1/embeddings endpoint.
Python
from openai import OpenAI
client = OpenAI(base_url="https://api.helmcode.com/v1", api_key="sk-your-key-here")
emb = client.embeddings.create(
model="qwen3-embedding",
input=["Helmcode runs in the EU.", "Tokens are unlimited on open models."],
)
print(len(emb.data[0].embedding)) # 4096
cURL
curl https://api.helmcode.com/v1/embeddings \
-H "Authorization: Bearer sk-your-key-here" \
-H "Content-Type: application/json" \
-d '{"model": "qwen3-embedding", "input": "Helmcode runs in the EU."}'
qwen3-embeddingis multilingual (ES↔EN similarity 0.915) and handles code. Limits: 60 rpm, batch size 32.
Reranking
Reorder retrieved documents by relevance to a query with the rerank model at /v1/rerank.
curl https://api.helmcode.com/v1/rerank \
-H "Authorization: Bearer sk-your-key-here" \
-H "Content-Type: application/json" \
-d '{
"model": "rerank",
"query": "How are tokens billed?",
"documents": [
"Helmcode charges a flat rate per API key.",
"Whisper transcribes 99+ languages.",
"Open models have unlimited tokens."
],
"top_n": 2
}'
The response returns each document with a relevance_score, highest first:
{
"results": [
{ "index": 0, "relevance_score": 0.98 },
{ "index": 2, "relevance_score": 0.74 }
]
}
Use the returned index to select the top passages, then pass them to a language model as context. See Examples for the full chat call.