AI Gateway

Embeddings

Turn text into vectors for RAG and semantic search
View as Markdown

Use titan-embed-text-v2 on the embeddings endpoint for RAG and vector search. It returns a 1024-dimension vector per input.

resp = client.embeddings.create(
model="titan-embed-text-v2",
input="Astro AI deploys agents as containers.",
)
vector = resp.data[0].embedding # list[float], length 1024

The client is constructed the same way as for chat completions: base URL ${ASTRO_GATEWAY_URL}/v1, bearer ASTRO_GATEWAY_API_KEY.

Next steps