diff --git a/spring-ai-core/src/main/java/org/springframework/ai/chat/model/Generation.java b/spring-ai-core/src/main/java/org/springframework/ai/chat/model/Generation.java index 210935eadf5..e351b0bdc18 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/chat/model/Generation.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/chat/model/Generation.java @@ -34,7 +34,7 @@ public class Generation implements ModelResult { private ChatGenerationMetadata chatGenerationMetadata; /** - * @deprecated Use {@link #Generation(AssitantMessage)} constructor instead. + * @deprecated Use {@link #Generation(AssistantMessage)} constructor instead. */ @Deprecated public Generation(String text) { @@ -42,7 +42,7 @@ public Generation(String text) { } /** - * @deprecated Use {@link #Generation(AssitantMessage)} constructor instead. + * @deprecated Use {@link #Generation(AssistantMessage)} constructor instead. */ @Deprecated public Generation(String text, Map properties) { @@ -70,7 +70,7 @@ public ChatGenerationMetadata getMetadata() { } /** - * @deprecated Use {@link #Generation(AssitantMessage, ChatGenerationMetadata)} + * @deprecated Use {@link #Generation(AssistantMessage, ChatGenerationMetadata)} * constructor instead. * @param chatGenerationMetadata * @return diff --git a/spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingModel.java b/spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingModel.java index e4785b867dc..9875ec2b019 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingModel.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingModel.java @@ -30,6 +30,7 @@ * @author Christian Tzolov * @author Josh Long * @author Soby Chacko + * @author Jihoon Kim * @since 1.0.0 * */ @@ -59,7 +60,7 @@ default float[] embed(String text) { /** * Embeds a batch of texts into vectors. * @param texts list of texts to embed. - * @return list of list of embedded vectors. + * @return list of embedded vectors. */ default List embed(List texts) { Assert.notNull(texts, "Texts must not be null"); diff --git a/spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingResultMetadata.java b/spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingResultMetadata.java index eb0dfead4d2..3b57f5cd75e 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingResultMetadata.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingResultMetadata.java @@ -23,13 +23,14 @@ /** * @author Christian Tzolov + * @author Jihoon Kim */ public class EmbeddingResultMetadata implements ResultMetadata { public static EmbeddingResultMetadata EMPTY = new EmbeddingResultMetadata(); /** - * The {@link MimeType} of the source data used to generate the embedding. + * The {@link ModalityType} of the source data used to generate the embedding. */ private final ModalityType modalityType; @@ -80,7 +81,7 @@ public static class ModalityUtils { private static MimeType TEXT_MIME_TYPE = MimeTypeUtils.parseMimeType("text/*"); - private static MimeType IMAGE_MIME_TYPE = MimeTypeUtils.parseMimeType("text/*"); + private static MimeType IMAGE_MIME_TYPE = MimeTypeUtils.parseMimeType("image/*"); private static MimeType VIDEO_MIME_TYPE = MimeTypeUtils.parseMimeType("video/*"); diff --git a/spring-ai-core/src/main/java/org/springframework/ai/embedding/TokenCountBatchingStrategy.java b/spring-ai-core/src/main/java/org/springframework/ai/embedding/TokenCountBatchingStrategy.java index 298278c3581..1b9029b37a0 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/embedding/TokenCountBatchingStrategy.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/embedding/TokenCountBatchingStrategy.java @@ -49,6 +49,7 @@ * @author Soby Chacko * @author Mark Pollack * @author Laura Trotta + * @author Jihoon Kim * @since 1.0.0 */ public class TokenCountBatchingStrategy implements BatchingStrategy { @@ -68,7 +69,7 @@ public class TokenCountBatchingStrategy implements BatchingStrategy { private final int maxInputTokenCount; - private final ContentFormatter contentFormater; + private final ContentFormatter contentFormatter; private final MetadataMode metadataMode; @@ -78,9 +79,9 @@ public TokenCountBatchingStrategy() { /** * @param encodingType {@link EncodingType} + * @param maxInputTokenCount upper limit for input tokens * @param thresholdFactor the threshold factor to use on top of the max input token * count - * @param maxInputTokenCount upper limit for input tokens */ public TokenCountBatchingStrategy(EncodingType encodingType, int maxInputTokenCount, double thresholdFactor) { this(encodingType, maxInputTokenCount, thresholdFactor, Document.DEFAULT_CONTENT_FORMATTER, MetadataMode.NONE); @@ -103,7 +104,7 @@ public TokenCountBatchingStrategy(EncodingType encodingType, int maxInputTokenCo Assert.notNull(metadataMode, "MetadataMode must not be null"); this.tokenCountEstimator = new JTokkitTokenCountEstimator(encodingType); this.maxInputTokenCount = (int) Math.round(maxInputTokenCount * (1 - reservePercentage)); - this.contentFormater = contentFormatter; + this.contentFormatter = contentFormatter; this.metadataMode = metadataMode; } @@ -122,7 +123,7 @@ public TokenCountBatchingStrategy(TokenCountEstimator tokenCountEstimator, int m Assert.notNull(tokenCountEstimator, "TokenCountEstimator must not be null"); this.tokenCountEstimator = tokenCountEstimator; this.maxInputTokenCount = (int) Math.round(maxInputTokenCount * (1 - reservePercentage)); - this.contentFormater = contentFormatter; + this.contentFormatter = contentFormatter; this.metadataMode = metadataMode; } @@ -135,7 +136,7 @@ public List> batch(List documents) { for (Document document : documents) { int tokenCount = this.tokenCountEstimator - .estimate(document.getFormattedContent(this.contentFormater, this.metadataMode)); + .estimate(document.getFormattedContent(this.contentFormatter, this.metadataMode)); if (tokenCount > this.maxInputTokenCount) { throw new IllegalArgumentException( "Tokens in a single document exceeds the maximum number of allowed input tokens");