Add deprecation in Document of embeddings and content formatter

This commit is contained in:
Mark Pollack
2024-11-20 10:21:46 -05:00
parent 52999b44b5
commit c783c6b2db
2 changed files with 20 additions and 5 deletions

View File

@@ -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());

View File

@@ -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;
}