Class CohereEmbeddingBedrockApi
java.lang.Object
org.springframework.ai.bedrock.api.AbstractBedrockApi<CohereEmbeddingBedrockApi.CohereEmbeddingRequest,CohereEmbeddingBedrockApi.CohereEmbeddingResponse,CohereEmbeddingBedrockApi.CohereEmbeddingResponse>
org.springframework.ai.bedrock.cohere.api.CohereEmbeddingBedrockApi
public class CohereEmbeddingBedrockApi
extends AbstractBedrockApi<CohereEmbeddingBedrockApi.CohereEmbeddingRequest,CohereEmbeddingBedrockApi.CohereEmbeddingResponse,CohereEmbeddingBedrockApi.CohereEmbeddingResponse>
Cohere Embedding API. AWS
Bedrock Cohere Embedding API Based on the
Cohere Embedding API
- Since:
- 0.8.0
- Author:
- Christian Tzolov, Wei Jiang
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Cohere Embedding model ids.static final record
The Cohere Embed model request.static final record
Cohere Embedding response.Nested classes/interfaces inherited from class org.springframework.ai.bedrock.api.AbstractBedrockApi
AbstractBedrockApi.AmazonBedrockInvocationMetrics
-
Field Summary
Fields inherited from class org.springframework.ai.bedrock.api.AbstractBedrockApi
DEFAULT_EMIT_FAILURE_HANDLER
-
Constructor Summary
ConstructorsConstructorDescriptionCohereEmbeddingBedrockApi
(String modelId, String region) Create a new CohereEmbeddingBedrockApi instance using the default credentials provider chain, the default object mapper, default temperature and topP values.CohereEmbeddingBedrockApi
(String modelId, String region, Duration timeout) Create a new CohereEmbeddingBedrockApi instance using the default credentials provider chain, the default object mapper, default temperature and topP values.CohereEmbeddingBedrockApi
(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, String region, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a new CohereEmbeddingBedrockApi instance using the provided credentials provider, region and object mapper.CohereEmbeddingBedrockApi
(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, String region, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Duration timeout) Create a new CohereEmbeddingBedrockApi instance using the provided credentials provider, region and object mapper.CohereEmbeddingBedrockApi
(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, software.amazon.awssdk.regions.Region region, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Duration timeout) Create a new CohereEmbeddingBedrockApi instance using the provided credentials provider, region and object mapper. -
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
-
CohereEmbeddingBedrockApi
Create a new CohereEmbeddingBedrockApi instance using the default credentials provider chain, the default object mapper, default temperature and topP values.- Parameters:
modelId
- The model id to use. See theCohereEmbeddingBedrockApi.CohereEmbeddingModel
for the supported models.region
- The AWS region to use.
-
CohereEmbeddingBedrockApi
public CohereEmbeddingBedrockApi(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, String region, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a new CohereEmbeddingBedrockApi instance using the provided credentials provider, region and object mapper.- Parameters:
modelId
- The model id to use. See theCohereEmbeddingBedrockApi.CohereEmbeddingModel
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.
-
CohereEmbeddingBedrockApi
Create a new CohereEmbeddingBedrockApi instance using the default credentials provider chain, the default object mapper, default temperature and topP values.- Parameters:
modelId
- The model id to use. See theCohereEmbeddingBedrockApi.CohereEmbeddingModel
for the supported models.region
- The AWS region to use.timeout
- The timeout to use.
-
CohereEmbeddingBedrockApi
public CohereEmbeddingBedrockApi(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, String region, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Duration timeout) Create a new CohereEmbeddingBedrockApi instance using the provided credentials provider, region and object mapper.- Parameters:
modelId
- The model id to use. See theCohereEmbeddingBedrockApi.CohereEmbeddingModel
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.timeout
- The timeout to use.
-
CohereEmbeddingBedrockApi
public CohereEmbeddingBedrockApi(String modelId, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider, software.amazon.awssdk.regions.Region region, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Duration timeout) Create a new CohereEmbeddingBedrockApi instance using the provided credentials provider, region and object mapper.- Parameters:
modelId
- The model id to use. See theCohereEmbeddingBedrockApi.CohereEmbeddingModel
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.timeout
- The timeout to use.
-
-
Method Details
-
embedding
public CohereEmbeddingBedrockApi.CohereEmbeddingResponse embedding(CohereEmbeddingBedrockApi.CohereEmbeddingRequest request) Description copied from class:AbstractBedrockApi
Compute the embedding for the given text.- Overrides:
embedding
in classAbstractBedrockApi<CohereEmbeddingBedrockApi.CohereEmbeddingRequest,
CohereEmbeddingBedrockApi.CohereEmbeddingResponse, CohereEmbeddingBedrockApi.CohereEmbeddingResponse> - Parameters:
request
- The embedding request.- Returns:
- Returns the embedding response.
-