org.llm4s.springai.Llm4sEmbeddingModel
See theLlm4sEmbeddingModel companion object
@Experimental
final class Llm4sEmbeddingModel(client: JEmbeddingClient) extends EmbeddingModel
An llm4s embedding client as a Spring AI EmbeddingModel (#2278), so a Spring AI vector store or evaluator embeds through any llm4s embedding provider.
EmbeddingModel model = new Llm4sEmbeddingModel(Llm4s.createEmbeddingClient(config).get());
float[] vector = model.embed("hello");
The request's texts are sent in one llm4s request, as documents; its options are not read (the model is the client's own). The response's metadata names the model that answered. A failure throws the LlmException the client's result holds. dimensions() is the model's declared length when its provider module lists it, and otherwise Spring AI's default, which embeds a test string.
Attributes
- Companion
- object
- Source
- Llm4sEmbeddingModel.scala
- Graph
-
- Supertypes
-
trait EmbeddingModeltrait Model[EmbeddingRequest, EmbeddingResponse]class Objecttrait Matchableclass Any
Members list
In this article
