Interface EmbeddingClient

All Superinterfaces:
ModelClient<EmbeddingRequest,EmbeddingResponse>
All Known Implementing Classes:
AbstractEmbeddingClient, AzureOpenAiEmbeddingClient, BedrockCohereEmbeddingClient, BedrockTitanEmbeddingClient, OllamaEmbeddingClient, OpenAiEmbeddingClient, PostgresMlEmbeddingClient, TransformersEmbeddingClient, VertexAiEmbeddingClient

public interface EmbeddingClient extends ModelClient<EmbeddingRequest,EmbeddingResponse>
EmbeddingClient is a generic interface for embedding clients.
  • Method Details

    • call

      Description copied from interface: ModelClient
      Executes a method call to the AI model.
      Specified by:
      call in interface ModelClient<EmbeddingRequest,EmbeddingResponse>
      Parameters:
      request - the request object to be sent to the AI model
      Returns:
      the response from the AI model
    • embed

      default List<Double> embed(String text)
      Embeds the given text into a vector.
      Parameters:
      text - the text to embed.
      Returns:
      the embedded vector.
    • embed

      List<Double> embed(Document document)
      Embeds the given document's content into a vector.
      Parameters:
      document - the document to embed.
      Returns:
      the embedded vector.
    • embed

      default List<List<Double>> embed(List<String> texts)
      Embeds a batch of texts into vectors.
      Parameters:
      texts - list of texts to embed.
      Returns:
      list of list of embedded vectors.
    • embedForResponse

      default EmbeddingResponse embedForResponse(List<String> texts)
      Embeds a batch of texts into vectors and returns the EmbeddingResponse.
      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.