Package org.springframework.ai.zhipuai
Class ZhiPuAiEmbeddingModel
java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingModel
org.springframework.ai.zhipuai.ZhiPuAiEmbeddingModel
- 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 ZhiPuAiEmbeddingModel
extends org.springframework.ai.embedding.AbstractEmbeddingModel
ZhiPuAI Embedding Model implementation.
- Since:
- 1.0.0
- Author:
- Geng Rong, Soby Chacko
-
Field Summary
Fields inherited from class org.springframework.ai.embedding.AbstractEmbeddingModel
embeddingDimensions -
Constructor Summary
ConstructorsConstructorDescriptionZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi) Constructor for the ZhiPuAiEmbeddingModel class.ZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi, org.springframework.ai.document.MetadataMode metadataMode) Initializes a new instance of the ZhiPuAiEmbeddingModel class.ZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi, org.springframework.ai.document.MetadataMode metadataMode, ZhiPuAiEmbeddingOptions zhiPuAiEmbeddingOptions) Initializes a new instance of the ZhiPuAiEmbeddingModel class.ZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi, org.springframework.ai.document.MetadataMode metadataMode, ZhiPuAiEmbeddingOptions zhiPuAiEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate) Initializes a new instance of the ZhiPuAiEmbeddingModel class.ZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi, org.springframework.ai.document.MetadataMode metadataMode, ZhiPuAiEmbeddingOptions options, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) Initializes a new instance of the ZhiPuAiEmbeddingModel class. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.ai.embedding.EmbeddingResponsecall(org.springframework.ai.embedding.EmbeddingRequest request) float[]embed(org.springframework.ai.document.Document document) voidsetObservationConvention(org.springframework.ai.embedding.observation.EmbeddingModelObservationConvention observationConvention) Methods inherited from class org.springframework.ai.embedding.AbstractEmbeddingModel
dimensions, dimensionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.embedding.EmbeddingModel
embed, embed, embed, embedForResponse
-
Constructor Details
-
ZhiPuAiEmbeddingModel
Constructor for the ZhiPuAiEmbeddingModel class.- Parameters:
zhiPuAiApi- The ZhiPuAiApi instance to use for making API requests.
-
ZhiPuAiEmbeddingModel
public ZhiPuAiEmbeddingModel(ZhiPuAiApi zhiPuAiApi, org.springframework.ai.document.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, org.springframework.ai.document.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, org.springframework.ai.document.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, org.springframework.ai.document.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(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)
-