Class TitanEmbeddingBedrockApi
java.lang.Object
org.springframework.ai.bedrock.api.AbstractBedrockApi<TitanEmbeddingBedrockApi.TitanEmbeddingRequest,TitanEmbeddingBedrockApi.TitanEmbeddingResponse,TitanEmbeddingBedrockApi.TitanEmbeddingResponse>
org.springframework.ai.bedrock.titan.api.TitanEmbeddingBedrockApi
public class TitanEmbeddingBedrockApi
extends AbstractBedrockApi<TitanEmbeddingBedrockApi.TitanEmbeddingRequest,TitanEmbeddingBedrockApi.TitanEmbeddingResponse,TitanEmbeddingBedrockApi.TitanEmbeddingResponse>
Java client for the Bedrock Titan Embedding model.
https://docs.aws.amazon.com/bedrock/latest/userguide/titan-multiemb-models.html
- Since:
- 0.8.0
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Titan Embedding model ids.static final record
Titan Embedding request parameters.static final record
Titan Embedding response.Nested classes/interfaces inherited from class org.springframework.ai.bedrock.api.AbstractBedrockApi
AbstractBedrockApi.AmazonBedrockInvocationMetrics
-
Constructor Summary
ConstructorsConstructorDescriptionTitanEmbeddingBedrockApi
(String modelId, String region) Create a new TitanEmbeddingBedrockApi instance using the default credentials provider and default object mapper.TitanEmbeddingBedrockApi
(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, String region, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a new TitanEmbeddingBedrockApi instance. -
Method Summary
Modifier and TypeMethodDescriptionCompute the embedding for the given text.Methods inherited from class org.springframework.ai.bedrock.api.AbstractBedrockApi
chatCompletion, chatCompletionStream, getModelId, getRegion, internalInvocation, internalInvocationStream
-
Constructor Details
-
TitanEmbeddingBedrockApi
Create a new TitanEmbeddingBedrockApi instance using the default credentials provider and default object mapper.- Parameters:
modelId
- The model id to use. See theTitanEmbeddingBedrockApi.TitanEmbeddingModel
for the supported models.region
- The AWS region to use.
-
TitanEmbeddingBedrockApi
public TitanEmbeddingBedrockApi(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, String region, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a new TitanEmbeddingBedrockApi instance.- Parameters:
modelId
- The model id to use. See theTitanEmbeddingBedrockApi.TitanEmbeddingModel
for the supported models.credentialsProvider
- The credentials provider to connect to AWS.region
- The AWS region to use.objectMapper
- The object mapper to use for JSON serialization and deserialization.
-
-
Method Details
-
embedding
public TitanEmbeddingBedrockApi.TitanEmbeddingResponse embedding(TitanEmbeddingBedrockApi.TitanEmbeddingRequest request) Description copied from class:AbstractBedrockApi
Compute the embedding for the given text.- Overrides:
embedding
in classAbstractBedrockApi<TitanEmbeddingBedrockApi.TitanEmbeddingRequest,
TitanEmbeddingBedrockApi.TitanEmbeddingResponse, TitanEmbeddingBedrockApi.TitanEmbeddingResponse> - Parameters:
request
- The embedding request.- Returns:
- Returns the embedding response.
-