接口 TokenCountEstimator
public interface TokenCountEstimator
Represents an interface for estimating the count of tokens in various texts, text segments, etc.
This can be useful when it's necessary to know in advance the cost of processing a specified text by the LLM.
-
方法概要
修饰符和类型方法说明default intestimateTokenCount(TextSegment textSegment) Estimates the count of tokens in the given text segment.intestimateTokenCount(String text) Estimates the count of tokens in the given text.default intestimateTokenCount(List<TextSegment> textSegments) Estimates the count of tokens in the given text segments.
-
方法详细资料
-
estimateTokenCount
Estimates the count of tokens in the given text.- 参数:
text- the text.- 返回:
- the estimated count of tokens.
-
estimateTokenCount
Estimates the count of tokens in the given text segment.The metadata will not be included in the estimate.
- 参数:
textSegment- the text segment.- 返回:
- the estimated count of tokens.
-
estimateTokenCount
Estimates the count of tokens in the given text segments.The metadata will not be included in the estimate.
- 参数:
textSegments- the text segments.- 返回:
- the estimated count of tokens.
-