Class VertexAiTextEmbeddingModel

java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingModel
org.springframework.ai.vertexai.embedding.text.VertexAiTextEmbeddingModel
All Implemented Interfaces:
EmbeddingModel, Model<EmbeddingRequest,EmbeddingResponse>

public class VertexAiTextEmbeddingModel extends AbstractEmbeddingModel
A class representing a Vertex AI Text Embedding Model.
Since:
1.0.0
Author:
Christian Tzolov, Mark Pollack
  • Field Details

  • Constructor Details

  • Method Details

    • embed

      public float[] embed(Document document)
      Description copied from interface: EmbeddingModel
      Embeds the given document's content into a vector.
      Parameters:
      document - the document to embed.
      Returns:
      the embedded vector.
    • call

      public EmbeddingResponse call(EmbeddingRequest request)
      Description copied from interface: Model
      Executes a method call to the AI model.
      Parameters:
      request - the request object to be sent to the AI model
      Returns:
      the response from the AI model
    • getPredictRequestBuilder

      protected com.google.cloud.aiplatform.v1.PredictRequest.Builder getPredictRequestBuilder(EmbeddingRequest request, com.google.cloud.aiplatform.v1.EndpointName endpointName, VertexAiTextEmbeddingOptions finalOptions)
    • dimensions

      public int dimensions()
      Description copied from interface: EmbeddingModel
      Get the number of dimensions of the embedded vectors. Note that by default, this method will call the remote Embedding endpoint to get the dimensions of the embedded vectors. If the dimensions are known ahead of time, it is recommended to override this method.
      Specified by:
      dimensions in interface EmbeddingModel
      Overrides:
      dimensions in class AbstractEmbeddingModel
      Returns:
      the number of dimensions of the embedded vectors.
    • setObservationConvention

      public void setObservationConvention(EmbeddingModelObservationConvention observationConvention)
      Use the provided convention for reporting observation data
      Parameters:
      observationConvention - The provided convention