Skip to content

Commit d2e9e55

Browse files
authored
Fix TokenCountBatchingStrategy example. (#1702)
1 parent c529c83 commit d2e9e55

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public class EmbeddingConfig {
142142
return new TokenCountBatchingStrategy(
143143
EncodingType.CL100K_BASE, // Specify the encoding type
144144
8000, // Set the maximum input token count
145-
0.9 // Set the threshold factor
145+
0.1 // Set the reserve percentage
146146
);
147147
}
148148
}
@@ -152,7 +152,7 @@ In this configuration:
152152

153153
1. `EncodingType.CL100K_BASE`: Specifies the encoding type used for tokenization. This encoding type is used by the `JTokkitTokenCountEstimator` to accurately estimate token counts.
154154
2. `8000`: Sets the maximum input token count. This value should be less than or equal to the maximum context window size of your embedding model.
155-
3. `0.9`: Sets the threshold factor. This factor determines how full a batch can be before starting a new one. A value of 0.9 means each batch will be filled up to 90% of the maximum input token count.
155+
3. `0.1`: Sets the reserve percentage. The percentage of tokens to reserve from the max input token count. This creates a buffer for potential token count increases during processing.
156156

157157
By default, this constructor uses `Document.DEFAULT_CONTENT_FORMATTER` for content formatting and `MetadataMode.NONE` for metadata handling. If you need to customize these parameters, you can use the full constructor with additional parameters.
158158

0 commit comments

Comments
 (0)