Skip to content

Commit c783c6b

Browse files
committed
Add deprecation in Document of embeddings and content formatter
1 parent 52999b4 commit c783c6b

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock/cohere/BedrockCohereEmbeddingModel.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,14 @@ public EmbeddingResponse call(EmbeddingRequest request) {
9595

9696
// Handle truncation based on option
9797
return switch (optionsToUse.getTruncate()) {
98-
case END -> text.substring(0, COHERE_MAX_CHARACTERS); // Keep first 2048 chars
98+
case END -> text.substring(0, COHERE_MAX_CHARACTERS); // Keep first 2048
99+
// chars
99100
case START -> text.substring(text.length() - COHERE_MAX_CHARACTERS); // Keep
100-
// last
101-
// 2048
102-
// chars
101+
// last
102+
// 2048
103+
// chars
103104
default -> text.substring(0, COHERE_MAX_CHARACTERS); // Default to END
104-
// behavior
105+
// behavior
105106
};
106107
}).collect(Collectors.toList());
107108

spring-ai-core/src/main/java/org/springframework/ai/document/Document.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ public Map<String, Object> getMetadata() {
149149
return this.metadata;
150150
}
151151

152+
/**
153+
* Return the embedding that were calculated.
154+
* @deprecated We are considering getting rid of this, please comment on
155+
* https://github.com/spring-projects/spring-ai/issues/1781
156+
* @return the embeddings
157+
*/
158+
@Deprecated(since = "1.0.0-M4")
152159
public float[] getEmbedding() {
153160
return this.embedding;
154161
}
@@ -158,6 +165,13 @@ public void setEmbedding(float[] embedding) {
158165
this.embedding = embedding;
159166
}
160167

168+
/**
169+
* Returns the content formatter associated with this document.
170+
* @deprecated We are considering getting rid of this, please comment on
171+
* https://github.com/spring-projects/spring-ai/issues/1782
172+
* @return the current ContentFormatter instance used for formatting the document
173+
* content.
174+
*/
161175
public ContentFormatter getContentFormatter() {
162176
return this.contentFormatter;
163177
}

0 commit comments

Comments
 (0)