Class GoogleGenAiTextEmbeddingModel
java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingModel
org.springframework.ai.google.genai.text.GoogleGenAiTextEmbeddingModel
- 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 GoogleGenAiTextEmbeddingModel
extends org.springframework.ai.embedding.AbstractEmbeddingModel
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, Sebastien Deleuze
-
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.core.retry.RetryTemplate retryTemplate) GoogleGenAiTextEmbeddingModel(GoogleGenAiEmbeddingConnectionDetails connectionDetails, GoogleGenAiTextEmbeddingOptions defaultEmbeddingOptions, org.springframework.core.retry.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.ai.embedding.EmbeddingResponsecall(org.springframework.ai.embedding.EmbeddingRequest request) intfloat[]embed(org.springframework.ai.document.Document document) voidsetObservationConvention(@Nullable org.springframework.ai.embedding.observation.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, getEmbeddingContent
-
Field Details
-
options
-
-
Constructor Details
-
GoogleGenAiTextEmbeddingModel
public GoogleGenAiTextEmbeddingModel(GoogleGenAiEmbeddingConnectionDetails connectionDetails, GoogleGenAiTextEmbeddingOptions defaultEmbeddingOptions) -
GoogleGenAiTextEmbeddingModel
public GoogleGenAiTextEmbeddingModel(GoogleGenAiEmbeddingConnectionDetails connectionDetails, GoogleGenAiTextEmbeddingOptions defaultEmbeddingOptions, org.springframework.core.retry.RetryTemplate retryTemplate) -
GoogleGenAiTextEmbeddingModel
public GoogleGenAiTextEmbeddingModel(GoogleGenAiEmbeddingConnectionDetails connectionDetails, GoogleGenAiTextEmbeddingOptions defaultEmbeddingOptions, org.springframework.core.retry.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) -
dimensions
public int dimensions()- Specified by:
dimensionsin interfaceorg.springframework.ai.embedding.EmbeddingModel- Overrides:
dimensionsin classorg.springframework.ai.embedding.AbstractEmbeddingModel
-
setObservationConvention
public void setObservationConvention(@Nullable org.springframework.ai.embedding.observation.EmbeddingModelObservationConvention observationConvention) Use the provided convention for reporting observation data- Parameters:
observationConvention- The provided convention
-