Class GoogleGenAiTextEmbeddingModel
java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingModel
org.springframework.ai.google.genai.text.GoogleGenAiTextEmbeddingModel
- All Implemented Interfaces:
EmbeddingModel,Model<EmbeddingRequest,EmbeddingResponse>
A class representing a Vertex AI Text Embedding Model using the new Google Gen AI SDK.
- Since:
- 1.0.0
- Author:
- Christian Tzolov, Mark Pollack, Rodrigo Malara, Soby Chacko, Dan Dobrin
-
Field Summary
FieldsFields inherited from class org.springframework.ai.embedding.AbstractEmbeddingModel
embeddingDimensions -
Constructor Summary
ConstructorsConstructorDescriptionGoogleGenAiTextEmbeddingModel(GoogleGenAiEmbeddingConnectionDetails connectionDetails, GoogleGenAiTextEmbeddingOptions defaultEmbeddingOptions) GoogleGenAiTextEmbeddingModel(GoogleGenAiEmbeddingConnectionDetails connectionDetails, GoogleGenAiTextEmbeddingOptions defaultEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate) GoogleGenAiTextEmbeddingModel(GoogleGenAiEmbeddingConnectionDetails connectionDetails, GoogleGenAiTextEmbeddingOptions defaultEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptioncall(EmbeddingRequest request) Executes a method call to the AI model.intGet the number of dimensions of the embedded vectors.float[]Embeds the given document's content into a vector.voidsetObservationConvention(EmbeddingModelObservationConvention observationConvention) Use the provided convention for reporting observation dataMethods inherited from class org.springframework.ai.embedding.AbstractEmbeddingModel
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
-
Field Details
-
defaultOptions
-
-
Constructor Details
-
GoogleGenAiTextEmbeddingModel
public GoogleGenAiTextEmbeddingModel(GoogleGenAiEmbeddingConnectionDetails connectionDetails, GoogleGenAiTextEmbeddingOptions defaultEmbeddingOptions) -
GoogleGenAiTextEmbeddingModel
public GoogleGenAiTextEmbeddingModel(GoogleGenAiEmbeddingConnectionDetails connectionDetails, GoogleGenAiTextEmbeddingOptions defaultEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate) -
GoogleGenAiTextEmbeddingModel
public GoogleGenAiTextEmbeddingModel(GoogleGenAiEmbeddingConnectionDetails connectionDetails, GoogleGenAiTextEmbeddingOptions defaultEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry)
-
-
Method Details
-
embed
Description copied from interface:EmbeddingModelEmbeds the given document's content into a vector.- Parameters:
document- the document to embed.- Returns:
- the embedded vector.
-
call
Description copied from interface:ModelExecutes 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
-
dimensions
public int dimensions()Description copied from interface:EmbeddingModelGet 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:
dimensionsin interfaceEmbeddingModel- Overrides:
dimensionsin classAbstractEmbeddingModel- Returns:
- the number of dimensions of the embedded vectors.
-
setObservationConvention
Use the provided convention for reporting observation data- Parameters:
observationConvention- The provided convention
-