Class DashScopeEmbeddingModel

java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingModel
com.alibaba.cloud.ai.dashscope.embedding.DashScopeEmbeddingModel
All Implemented Interfaces:
org.springframework.ai.embedding.EmbeddingModel, org.springframework.ai.model.Model<org.springframework.ai.embedding.EmbeddingRequest,org.springframework.ai.embedding.EmbeddingResponse>

public class DashScopeEmbeddingModel extends org.springframework.ai.embedding.AbstractEmbeddingModel
DashScope Embedding Model implementation.
Since:
2024/7/31 10:57
Author:
nuocheng.lxm, why_ohh, yuluo, why_ohh, yyyhhx, guanxu
  • Constructor Details

    • DashScopeEmbeddingModel

      public DashScopeEmbeddingModel(DashScopeApi dashScopeApi)
    • DashScopeEmbeddingModel

      public DashScopeEmbeddingModel(DashScopeApi dashScopeApi, org.springframework.ai.document.MetadataMode metadataMode)
    • DashScopeEmbeddingModel

      public DashScopeEmbeddingModel(DashScopeApi dashScopeApi, org.springframework.ai.document.MetadataMode metadataMode, DashScopeEmbeddingOptions dashScopeEmbeddingOptions)
    • DashScopeEmbeddingModel

      public DashScopeEmbeddingModel(DashScopeApi dashScopeApi, org.springframework.ai.document.MetadataMode metadataMode, DashScopeEmbeddingOptions dashScopeEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate)
    • DashScopeEmbeddingModel

      public DashScopeEmbeddingModel(DashScopeApi dashScopeApi, org.springframework.ai.document.MetadataMode metadataMode, DashScopeEmbeddingOptions options, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry)
  • Method Details

    • embed

      public float[] embed(org.springframework.ai.document.Document document)
    • call

      public org.springframework.ai.embedding.EmbeddingResponse call(org.springframework.ai.embedding.EmbeddingRequest request)
    • setObservationConvention

      public void setObservationConvention(org.springframework.ai.embedding.observation.EmbeddingModelObservationConvention observationConvention)
      Use the provided convention for reporting observation data
      Parameters:
      observationConvention - The provided convention
    • embed

      public List<float[]> embed(List<String> texts)
      Embed the provided texts and return the embeddings.
      Returns:
      The embeddings
    • embed

      public List<float[]> embed(List<org.springframework.ai.document.Document> documents, org.springframework.ai.embedding.EmbeddingOptions options, org.springframework.ai.embedding.BatchingStrategy batchingStrategy)
      Embed the provided documents and return the embeddings.
      Returns:
      The embeddings
    • embedForResponse

      public org.springframework.ai.embedding.EmbeddingResponse embedForResponse(List<String> texts)
      Embed the provided documents and return the response.
      Returns:
      The embedding response
    • dimensions

      public int dimensions()
      Specified by:
      dimensions in interface org.springframework.ai.embedding.EmbeddingModel
      Overrides:
      dimensions in class org.springframework.ai.embedding.AbstractEmbeddingModel
    • mutate

      Returns a builder pre-populated with the current configuration for mutation.
    • clone

      public DashScopeEmbeddingModel clone()
      Overrides:
      clone in class Object
    • builder

      public static DashScopeEmbeddingModel.Builder builder()