接口 Tokenizer
public interface Tokenizer
Represents an interface for estimating the count of tokens in various text types such as a text, prompt, text segment, etc.
This can be useful when it's necessary to know in advance the cost of processing a specified text by the LLM.
-
方法概要
修饰符和类型方法说明default intestimateTokenCountInForcefulToolExecutionRequest(ToolExecutionRequest toolExecutionRequest) Estimates the count of tokens in the given tool execution request.default intestimateTokenCountInForcefulToolSpecification(ToolSpecification toolSpecification) Estimates the count of tokens in the given tool specification.intestimateTokenCountInMessage(ChatMessage message) Estimates the count of tokens in the given message.intestimateTokenCountInMessages(Iterable<ChatMessage> messages) Estimates the count of tokens in the given messages.intEstimates the count of tokens in the given text.intestimateTokenCountInToolExecutionRequests(Iterable<ToolExecutionRequest> toolExecutionRequests) Estimates the count of tokens in the given tool execution requests.default intestimateTokenCountInTools(Iterable<Object> objectsWithTools) Estimates the count of tokens inToolannotations of the given objects.default intestimateTokenCountInTools(Object objectWithTools) Estimates the count of tokens inToolannotations of the given object.intestimateTokenCountInToolSpecifications(Iterable<ToolSpecification> toolSpecifications) Estimates the count of tokens in the given tool specifications.
-
方法详细资料
-
estimateTokenCountInText
Estimates the count of tokens in the given text.- 参数:
text- the text.- 返回:
- the estimated count of tokens.
-
estimateTokenCountInMessage
Estimates the count of tokens in the given message.- 参数:
message- the message.- 返回:
- the estimated count of tokens.
-
estimateTokenCountInMessages
Estimates the count of tokens in the given messages.- 参数:
messages- the messages.- 返回:
- the estimated count of tokens.
-
estimateTokenCountInTools
Estimates the count of tokens inToolannotations of the given object.- 参数:
objectWithTools- the object.- 返回:
- the estimated count of tokens.
-
estimateTokenCountInTools
Estimates the count of tokens inToolannotations of the given objects.- 参数:
objectsWithTools- the objects.- 返回:
- the estimated count of tokens.
-
estimateTokenCountInToolSpecifications
Estimates the count of tokens in the given tool specifications.- 参数:
toolSpecifications- the tool specifications.- 返回:
- the estimated count of tokens.
-
estimateTokenCountInForcefulToolSpecification
Estimates the count of tokens in the given tool specification.- 参数:
toolSpecification- the tool specification.- 返回:
- the estimated count of tokens.
-
estimateTokenCountInToolExecutionRequests
Estimates the count of tokens in the given tool execution requests.- 参数:
toolExecutionRequests- the tool execution request.- 返回:
- the estimated count of tokens.
-
estimateTokenCountInForcefulToolExecutionRequest
default int estimateTokenCountInForcefulToolExecutionRequest(ToolExecutionRequest toolExecutionRequest) Estimates the count of tokens in the given tool execution request.- 参数:
toolExecutionRequest- the tool execution request.- 返回:
- the estimated count of tokens.
-