Class ZhiPuAiEmbeddingModel

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

public class ZhiPuAiEmbeddingModel extends AbstractEmbeddingModel
ZhiPuAI Embedding Model implementation.
Since:
1.0.0 M1
Author:
Geng Rong
  • Constructor Details

    • ZhiPuAiEmbeddingModel

      public ZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi)
      Constructor for the ZhiPuAiEmbeddingModel class.
      Parameters:
      zhiPuAiApi - The ZhiPuAiApi instance to use for making API requests.
    • ZhiPuAiEmbeddingModel

      public ZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi, MetadataMode metadataMode)
      Initializes a new instance of the ZhiPuAiEmbeddingModel class.
      Parameters:
      zhiPuAiApi - The ZhiPuAiApi instance to use for making API requests.
      metadataMode - The mode for generating metadata.
    • ZhiPuAiEmbeddingModel

      public ZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi, MetadataMode metadataMode, ZhiPuAiEmbeddingOptions zhiPuAiEmbeddingOptions)
      Initializes a new instance of the ZhiPuAiEmbeddingModel class.
      Parameters:
      zhiPuAiApi - The ZhiPuAiApi instance to use for making API requests.
      metadataMode - The mode for generating metadata.
      zhiPuAiEmbeddingOptions - The options for ZhiPuAI embedding.
    • ZhiPuAiEmbeddingModel

      public ZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi, MetadataMode metadataMode, ZhiPuAiEmbeddingOptions zhiPuAiEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate)
      Initializes a new instance of the ZhiPuAiEmbeddingModel class.
      Parameters:
      zhiPuAiApi - The ZhiPuAiApi instance to use for making API requests.
      metadataMode - The mode for generating metadata.
      zhiPuAiEmbeddingOptions - The options for ZhiPuAI embedding.
      retryTemplate - - The RetryTemplate for retrying failed API requests.
    • ZhiPuAiEmbeddingModel

      public ZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi, MetadataMode metadataMode, ZhiPuAiEmbeddingOptions options, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry)
      Initializes a new instance of the ZhiPuAiEmbeddingModel class.
      Parameters:
      zhiPuAiApi - - The ZhiPuAiApi instance to use for making API requests.
      metadataMode - - The mode for generating metadata.
      options - - The options for ZhiPuAI embedding.
      retryTemplate - - The RetryTemplate for retrying failed API requests.
      observationRegistry - - The ObservationRegistry used for instrumentation.
  • 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
    • setObservationConvention

      public void setObservationConvention(EmbeddingModelObservationConvention observationConvention)