Package org.springframework.ai.qianfan
Class QianFanEmbeddingModel
java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingModel
org.springframework.ai.qianfan.QianFanEmbeddingModel
- All Implemented Interfaces:
EmbeddingModel
,Model<EmbeddingRequest,
EmbeddingResponse>
QianFan Embedding Client implementation.
- Since:
- 1.0
- Author:
- Geng Rong, Thomas Vitale
-
Field Summary
Fields inherited from class org.springframework.ai.embedding.AbstractEmbeddingModel
embeddingDimensions
-
Constructor Summary
ConstructorDescriptionQianFanEmbeddingModel
(QianFanApi qianFanApi) Constructor for the QianFanEmbeddingModel class.QianFanEmbeddingModel
(QianFanApi qianFanApi, MetadataMode metadataMode) Initializes a new instance of the QianFanEmbeddingModel class.QianFanEmbeddingModel
(QianFanApi qianFanApi, MetadataMode metadataMode, QianFanEmbeddingOptions qianFanEmbeddingOptions) Initializes a new instance of the QianFanEmbeddingModel class.QianFanEmbeddingModel
(QianFanApi qianFanApi, MetadataMode metadataMode, QianFanEmbeddingOptions qianFanEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate) Initializes a new instance of the QianFanEmbeddingModel class.QianFanEmbeddingModel
(QianFanApi qianFanApi, MetadataMode metadataMode, QianFanEmbeddingOptions options, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) Initializes a new instance of the QianFanEmbeddingModel class. -
Method Summary
Modifier and TypeMethodDescriptioncall
(EmbeddingRequest request) Executes a method call to the AI model.float[]
Embeds the given document's content into a vector.void
setObservationConvention
(EmbeddingModelObservationConvention observationConvention) Methods inherited from class org.springframework.ai.embedding.AbstractEmbeddingModel
dimensions, dimensions
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.ai.embedding.EmbeddingModel
embed, embed, embed, embedForResponse
-
Constructor Details
-
QianFanEmbeddingModel
Constructor for the QianFanEmbeddingModel class.- Parameters:
qianFanApi
- The QianFanApi instance to use for making API requests.
-
QianFanEmbeddingModel
Initializes a new instance of the QianFanEmbeddingModel class.- Parameters:
qianFanApi
- The QianFanApi instance to use for making API requests.metadataMode
- The mode for generating metadata.
-
QianFanEmbeddingModel
public QianFanEmbeddingModel(QianFanApi qianFanApi, MetadataMode metadataMode, QianFanEmbeddingOptions qianFanEmbeddingOptions) Initializes a new instance of the QianFanEmbeddingModel class.- Parameters:
qianFanApi
- The QianFanApi instance to use for making API requests.metadataMode
- The mode for generating metadata.qianFanEmbeddingOptions
- The options for QianFan embedding.
-
QianFanEmbeddingModel
public QianFanEmbeddingModel(QianFanApi qianFanApi, MetadataMode metadataMode, QianFanEmbeddingOptions qianFanEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate) Initializes a new instance of the QianFanEmbeddingModel class.- Parameters:
qianFanApi
- The QianFanApi instance to use for making API requests.metadataMode
- The mode for generating metadata.qianFanEmbeddingOptions
- The options for QianFan embedding.retryTemplate
- - The RetryTemplate for retrying failed API requests.
-
QianFanEmbeddingModel
public QianFanEmbeddingModel(QianFanApi qianFanApi, MetadataMode metadataMode, QianFanEmbeddingOptions options, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) Initializes a new instance of the QianFanEmbeddingModel class.- Parameters:
qianFanApi
- - The QianFanApi instance to use for making API requests.metadataMode
- - The mode for generating metadata.options
- - The options for QianFan embedding.retryTemplate
- - The RetryTemplate for retrying failed API requests.observationRegistry
- - The ObservationRegistry used for instrumentation.
-
-
Method Details
-
embed
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
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
-