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 thresholdFactor the threshold factor to use on top of the max input token
8284 * count
83- * @param maxInputTokenCount upper limit for input tokens
8485 */
8586 public TokenCountBatchingStrategy (EncodingType encodingType , int maxInputTokenCount , double thresholdFactor ) {
8687 this (encodingType , maxInputTokenCount , thresholdFactor , Document .DEFAULT_CONTENT_FORMATTER , MetadataMode .NONE );
@@ -103,7 +104,7 @@ public TokenCountBatchingStrategy(EncodingType encodingType, int maxInputTokenCo
103104 Assert .notNull (metadataMode , "MetadataMode must not be null" );
104105 this .tokenCountEstimator = new JTokkitTokenCountEstimator (encodingType );
105106 this .maxInputTokenCount = (int ) Math .round (maxInputTokenCount * (1 - reservePercentage ));
106- this .contentFormater = contentFormatter ;
107+ this .contentFormatter = contentFormatter ;
107108 this .metadataMode = metadataMode ;
108109 }
109110
@@ -122,7 +123,7 @@ public TokenCountBatchingStrategy(TokenCountEstimator tokenCountEstimator, int m
122123 Assert .notNull (tokenCountEstimator , "TokenCountEstimator must not be null" );
123124 this .tokenCountEstimator = tokenCountEstimator ;
124125 this .maxInputTokenCount = (int ) Math .round (maxInputTokenCount * (1 - reservePercentage ));
125- this .contentFormater = contentFormatter ;
126+ this .contentFormatter = contentFormatter ;
126127 this .metadataMode = metadataMode ;
127128 }
128129
@@ -135,7 +136,7 @@ public List<List<Document>> batch(List<Document> documents) {
135136
136137 for (Document document : documents ) {
137138 int tokenCount = this .tokenCountEstimator
138- .estimate (document .getFormattedContent (this .contentFormater , this .metadataMode ));
139+ .estimate (document .getFormattedContent (this .contentFormatter , this .metadataMode ));
139140 if (tokenCount > this .maxInputTokenCount ) {
140141 throw new IllegalArgumentException (
141142 "Tokens in a single document exceeds the maximum number of allowed input tokens" );
0 commit comments