diff --git a/models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock/cohere/BedrockCohereEmbeddingModel.java b/models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock/cohere/BedrockCohereEmbeddingModel.java index d1b76a609..3623260bc 100644 --- a/models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock/cohere/BedrockCohereEmbeddingModel.java +++ b/models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock/cohere/BedrockCohereEmbeddingModel.java @@ -95,13 +95,14 @@ public class BedrockCohereEmbeddingModel extends AbstractEmbeddingModel { // Handle truncation based on option return switch (optionsToUse.getTruncate()) { - case END -> text.substring(0, COHERE_MAX_CHARACTERS); // Keep first 2048 chars + case END -> text.substring(0, COHERE_MAX_CHARACTERS); // Keep first 2048 + // chars case START -> text.substring(text.length() - COHERE_MAX_CHARACTERS); // Keep - // last - // 2048 - // chars + // last + // 2048 + // chars default -> text.substring(0, COHERE_MAX_CHARACTERS); // Default to END - // behavior + // behavior }; }).collect(Collectors.toList()); diff --git a/spring-ai-core/src/main/java/org/springframework/ai/document/Document.java b/spring-ai-core/src/main/java/org/springframework/ai/document/Document.java index e666857dd..4d19c87ba 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/document/Document.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/document/Document.java @@ -149,6 +149,13 @@ public class Document implements MediaContent { return this.metadata; } + /** + * Return the embedding that were calculated. + * @deprecated We are considering getting rid of this, please comment on + * https://github.com/spring-projects/spring-ai/issues/1781 + * @return the embeddings + */ + @Deprecated(since = "1.0.0-M4") public float[] getEmbedding() { return this.embedding; } @@ -158,6 +165,13 @@ public class Document implements MediaContent { this.embedding = embedding; } + /** + * Returns the content formatter associated with this document. + * @deprecated We are considering getting rid of this, please comment on + * https://github.com/spring-projects/spring-ai/issues/1782 + * @return the current ContentFormatter instance used for formatting the document + * content. + */ public ContentFormatter getContentFormatter() { return this.contentFormatter; }