Package org.springframework.ai.embedding
Interface EmbeddingClient
- All Superinterfaces:
ModelClient<EmbeddingRequest,
EmbeddingResponse>
- All Known Implementing Classes:
AbstractEmbeddingClient
,AzureOpenAiEmbeddingClient
,BedrockCohereEmbeddingClient
,BedrockTitanEmbeddingClient
,OllamaEmbeddingClient
,OpenAiEmbeddingClient
,PostgresMlEmbeddingClient
,TransformersEmbeddingClient
,VertexAiEmbeddingClient
EmbeddingClient is a generic interface for embedding clients.
-
Method Summary
Modifier and TypeMethodDescriptioncall
(EmbeddingRequest request) Executes a method call to the AI model.default int
Embeds the given text into a vector.Embeds a batch of texts into vectors.Embeds the given document's content into a vector.default EmbeddingResponse
embedForResponse
(List<String> texts) Embeds a batch of texts into vectors and returns theEmbeddingResponse
.
-
Method Details
-
call
Description copied from interface:ModelClient
Executes a method call to the AI model.- Specified by:
call
in interfaceModelClient<EmbeddingRequest,
EmbeddingResponse> - Parameters:
request
- the request object to be sent to the AI model- Returns:
- the response from the AI model
-
embed
Embeds the given text into a vector.- Parameters:
text
- the text to embed.- Returns:
- the embedded vector.
-
embed
Embeds the given document's content into a vector.- Parameters:
document
- the document to embed.- Returns:
- the embedded vector.
-
embed
Embeds a batch of texts into vectors.- Parameters:
texts
- list of texts to embed.- Returns:
- list of list of embedded vectors.
-
embedForResponse
Embeds a batch of texts into vectors and returns theEmbeddingResponse
.- Parameters:
texts
- list of texts to embed.- Returns:
- the embedding response.
-
dimensions
default int dimensions()- Returns:
- the number of dimensions of the embedded vectors. It is generative specific.
-