4949 * @author Soby Chacko
5050 * @author Mark Pollack
5151 * @author Laura Trotta
52+ * @author Jihoon Kim
5253 * @since 1.0.0
5354 */
5455public 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