Skip to content

Commit c4e7efb

Browse files
jitokimmarkpollack
authored andcommitted
Fix typos in classes under the embedding package
Signed-off-by: jitokim <[email protected]>
1 parent 0b55fa3 commit c4e7efb

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingModel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @author Christian Tzolov
3131
* @author Josh Long
3232
* @author Soby Chacko
33+
* @author Jihoon Kim
3334
* @since 1.0.0
3435
*
3536
*/
@@ -59,7 +60,7 @@ default float[] embed(String text) {
5960
/**
6061
* Embeds a batch of texts into vectors.
6162
* @param texts list of texts to embed.
62-
* @return list of list of embedded vectors.
63+
* @return list of embedded vectors.
6364
*/
6465
default List<float[]> embed(List<String> texts) {
6566
Assert.notNull(texts, "Texts must not be null");

spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingResultMetadata.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@
2323

2424
/**
2525
* @author Christian Tzolov
26+
* @author Jihoon Kim
2627
*/
2728
public class EmbeddingResultMetadata implements ResultMetadata {
2829

2930
public static EmbeddingResultMetadata EMPTY = new EmbeddingResultMetadata();
3031

3132
/**
32-
* The {@link MimeType} of the source data used to generate the embedding.
33+
* The {@link ModalityType} of the source data used to generate the embedding.
3334
*/
3435
private final ModalityType modalityType;
3536

@@ -80,7 +81,7 @@ public static class ModalityUtils {
8081

8182
private static MimeType TEXT_MIME_TYPE = MimeTypeUtils.parseMimeType("text/*");
8283

83-
private static MimeType IMAGE_MIME_TYPE = MimeTypeUtils.parseMimeType("text/*");
84+
private static MimeType IMAGE_MIME_TYPE = MimeTypeUtils.parseMimeType("image/*");
8485

8586
private static MimeType VIDEO_MIME_TYPE = MimeTypeUtils.parseMimeType("video/*");
8687

spring-ai-core/src/main/java/org/springframework/ai/embedding/TokenCountBatchingStrategy.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
* @author Soby Chacko
5050
* @author Mark Pollack
5151
* @author Laura Trotta
52+
* @author Jihoon Kim
5253
* @since 1.0.0
5354
*/
5455
public class TokenCountBatchingStrategy implements BatchingStrategy {
@@ -68,7 +69,7 @@ public class TokenCountBatchingStrategy implements BatchingStrategy {
6869

6970
private final int maxInputTokenCount;
7071

71-
private final ContentFormatter contentFormater;
72+
private final ContentFormatter contentFormatter;
7273

7374
private final MetadataMode metadataMode;
7475

@@ -78,9 +79,9 @@ public TokenCountBatchingStrategy() {
7879

7980
/**
8081
* @param encodingType {@link EncodingType}
82+
* @param maxInputTokenCount upper limit for input tokens
8183
* @param reservePercentage the percentage of tokens to reserve from the max input
8284
* token count to create a buffer.
83-
* @param maxInputTokenCount upper limit for input tokens
8485
*/
8586
public TokenCountBatchingStrategy(EncodingType encodingType, int maxInputTokenCount, double reservePercentage) {
8687
this(encodingType, maxInputTokenCount, reservePercentage, Document.DEFAULT_CONTENT_FORMATTER,
@@ -106,7 +107,7 @@ public TokenCountBatchingStrategy(EncodingType encodingType, int maxInputTokenCo
106107
Assert.notNull(metadataMode, "MetadataMode must not be null");
107108
this.tokenCountEstimator = new JTokkitTokenCountEstimator(encodingType);
108109
this.maxInputTokenCount = (int) Math.round(maxInputTokenCount * (1 - reservePercentage));
109-
this.contentFormater = contentFormatter;
110+
this.contentFormatter = contentFormatter;
110111
this.metadataMode = metadataMode;
111112
}
112113

@@ -129,7 +130,7 @@ public TokenCountBatchingStrategy(TokenCountEstimator tokenCountEstimator, int m
129130
Assert.notNull(metadataMode, "MetadataMode must not be null");
130131
this.tokenCountEstimator = tokenCountEstimator;
131132
this.maxInputTokenCount = (int) Math.round(maxInputTokenCount * (1 - reservePercentage));
132-
this.contentFormater = contentFormatter;
133+
this.contentFormatter = contentFormatter;
133134
this.metadataMode = metadataMode;
134135
}
135136

@@ -142,7 +143,7 @@ public List<List<Document>> batch(List<Document> documents) {
142143

143144
for (Document document : documents) {
144145
int tokenCount = this.tokenCountEstimator
145-
.estimate(document.getFormattedContent(this.contentFormater, this.metadataMode));
146+
.estimate(document.getFormattedContent(this.contentFormatter, this.metadataMode));
146147
if (tokenCount > this.maxInputTokenCount) {
147148
throw new IllegalArgumentException(
148149
"Tokens in a single document exceeds the maximum number of allowed input tokens");

0 commit comments

Comments
 (0)