Interface EmbeddingClient
- All Known Implementing Classes:
OnnxEmbeddingClient, OpenAiEmbeddingClient
public interface EmbeddingClient
Pluggable backend that converts text into dense floating-point vectors.
All implementations must be thread-safe (the index build may call
batchEmbed(List) from a background thread while searches run on the
calling thread).
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionList<float[]> batchEmbed(List<String> texts) Embeds multiple text chunks in one or more batched calls.float[]Embeds a single text chunk and returns a unit-length float vector.intGets the number of dimensions in every returned vector.Gets the model identifier for this embedding client.
-
Method Details
-
embed
Embeds a single text chunk and returns a unit-length float vector.- Parameters:
text- the text to embed (non-null, non-blank)- Returns:
- float vector of length
getDimension() - Throws:
IOException- on transport or API errors
-
batchEmbed
Embeds multiple text chunks in one or more batched calls.The returned list has the same size and ordering as
texts.- Parameters:
texts- the texts to embed- Returns:
- list of float vectors, one per input text
- Throws:
IOException- on transport or API errors
-
getDimension
int getDimension()Gets the number of dimensions in every returned vector.- Returns:
- number of dimensions in every returned vector
-
getModelId
String getModelId()Gets the model identifier for this embedding client.- Returns:
- human-readable model identifier (e.g.
"text-embedding-3-small")
-