Skip to main content
Call NewEmbedding on a model bound to an embedding-capable provider. Import github.com/hastekit/agent-sdk-go/pkg/gateway/llm/embeddings. Given client and ctx:
For one string, use Input.OfString. Set only one input-union branch. Use each response entry’s Index to associate vectors with inputs.

Dimensions and encoding

Dimensions requests a dimension count where the model supports it. EncodingFormat can request floating-point values or base64 where supported. Inspect Embedding.OfFloat or Embedding.OfBase64 accordingly; do not treat an empty float slice as proof of an empty embedding. Store model identity, dimensions, and preprocessing choices with an index. Query vectors must be compatible with the document vectors. Changing models or dimensions generally requires rebuilding the affected index rather than mixing vectors.

Batching and limits

Batch within provider input and request-size limits, and handle per-request failures before writing index entries. The SDK does not automatically chunk documents, choose a vector database, or manage your retrieval policy. Usage is available when the provider reports it.