Class VertexAiTextEmbeddingModel
java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingModel
org.springframework.ai.vertexai.embedding.text.VertexAiTextEmbeddingModel
- All Implemented Interfaces:
EmbeddingModel
,Model<EmbeddingRequest,
EmbeddingResponse>
A class representing a Vertex AI Text Embedding Model.
- Since:
- 1.0.0
- Author:
- Christian Tzolov, Mark Pollack
-
Field Summary
Fields inherited from class org.springframework.ai.embedding.AbstractEmbeddingModel
embeddingDimensions
-
Constructor Summary
ConstructorDescriptionVertexAiTextEmbeddingModel
(VertexAiEmbeddingConnectionDetails connectionDetails, VertexAiTextEmbeddingOptions defaultEmbeddingOptions) VertexAiTextEmbeddingModel
(VertexAiEmbeddingConnectionDetails connectionDetails, VertexAiTextEmbeddingOptions defaultEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate) VertexAiTextEmbeddingModel
(VertexAiEmbeddingConnectionDetails connectionDetails, VertexAiTextEmbeddingOptions 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.int
float[]
Embeds the given document's content into a vector.protected com.google.cloud.aiplatform.v1.PredictRequest.Builder
getPredictRequestBuilder
(EmbeddingRequest request, com.google.cloud.aiplatform.v1.EndpointName endpointName, VertexAiTextEmbeddingOptions finalOptions) void
setObservationConvention
(EmbeddingModelObservationConvention observationConvention) Use the provided convention for reporting observation dataMethods inherited from class org.springframework.ai.embedding.AbstractEmbeddingModel
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
-
Field Details
-
defaultOptions
-
-
Constructor Details
-
VertexAiTextEmbeddingModel
public VertexAiTextEmbeddingModel(VertexAiEmbeddingConnectionDetails connectionDetails, VertexAiTextEmbeddingOptions defaultEmbeddingOptions) -
VertexAiTextEmbeddingModel
public VertexAiTextEmbeddingModel(VertexAiEmbeddingConnectionDetails connectionDetails, VertexAiTextEmbeddingOptions defaultEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate) -
VertexAiTextEmbeddingModel
public VertexAiTextEmbeddingModel(VertexAiEmbeddingConnectionDetails connectionDetails, VertexAiTextEmbeddingOptions defaultEmbeddingOptions, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry)
-
-
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
-
getPredictRequestBuilder
protected com.google.cloud.aiplatform.v1.PredictRequest.Builder getPredictRequestBuilder(EmbeddingRequest request, com.google.cloud.aiplatform.v1.EndpointName endpointName, VertexAiTextEmbeddingOptions finalOptions) -
dimensions
public int dimensions()- Specified by:
dimensions
in interfaceEmbeddingModel
- Overrides:
dimensions
in classAbstractEmbeddingModel
- Returns:
- the number of dimensions of the embedded vectors. It is generative specific.
-
setObservationConvention
Use the provided convention for reporting observation data- Parameters:
observationConvention
- The provided convention
-