Interface Tokenizer
-
- All Implemented Interfaces:
public interface TokenizerRepresents 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.
-
-
Method Summary
Modifier and Type Method Description abstract intestimateTokenCountInText(String text)Estimates the count of tokens in the given text. abstract intestimateTokenCountInMessage(ChatMessage message)Estimates the count of tokens in the given message. abstract intestimateTokenCountInMessages(Iterable<ChatMessage> messages)Estimates the count of tokens in the given messages. intestimateTokenCountInTools(Object objectWithTools)Estimates the count of tokens in Toolannotations of the given object.intestimateTokenCountInTools(Iterable<Object> objectsWithTools)Estimates the count of tokens in Toolannotations of the given objects.abstract intestimateTokenCountInToolSpecifications(Iterable<ToolSpecification> toolSpecifications)Estimates the count of tokens in the given tool specifications. intestimateTokenCountInForcefulToolSpecification(ToolSpecification toolSpecification)Estimates the count of tokens in the given tool specification. abstract intestimateTokenCountInToolExecutionRequests(Iterable<ToolExecutionRequest> toolExecutionRequests)Estimates the count of tokens in the given tool execution requests. intestimateTokenCountInForcefulToolExecutionRequest(ToolExecutionRequest toolExecutionRequest)Estimates the count of tokens in the given tool execution request. -
-
Method Detail
-
estimateTokenCountInText
abstract int estimateTokenCountInText(String text)
Estimates the count of tokens in the given text.
- Parameters:
text- the text.- Returns:
the estimated count of tokens.
-
estimateTokenCountInMessage
abstract int estimateTokenCountInMessage(ChatMessage message)
Estimates the count of tokens in the given message.
- Parameters:
message- the message.- Returns:
the estimated count of tokens.
-
estimateTokenCountInMessages
abstract int estimateTokenCountInMessages(Iterable<ChatMessage> messages)
Estimates the count of tokens in the given messages.
- Parameters:
messages- the messages.- Returns:
the estimated count of tokens.
-
estimateTokenCountInTools
int estimateTokenCountInTools(Object objectWithTools)
Estimates the count of tokens in
Toolannotations of the given object.- Parameters:
objectWithTools- the object.- Returns:
the estimated count of tokens.
-
estimateTokenCountInTools
int estimateTokenCountInTools(Iterable<Object> objectsWithTools)
Estimates the count of tokens in
Toolannotations of the given objects.- Parameters:
objectsWithTools- the objects.- Returns:
the estimated count of tokens.
-
estimateTokenCountInToolSpecifications
abstract int estimateTokenCountInToolSpecifications(Iterable<ToolSpecification> toolSpecifications)
Estimates the count of tokens in the given tool specifications.
- Parameters:
toolSpecifications- the tool specifications.- Returns:
the estimated count of tokens.
-
estimateTokenCountInForcefulToolSpecification
int estimateTokenCountInForcefulToolSpecification(ToolSpecification toolSpecification)
Estimates the count of tokens in the given tool specification.
- Parameters:
toolSpecification- the tool specification.- Returns:
the estimated count of tokens.
-
estimateTokenCountInToolExecutionRequests
abstract int estimateTokenCountInToolExecutionRequests(Iterable<ToolExecutionRequest> toolExecutionRequests)
Estimates the count of tokens in the given tool execution requests.
- Parameters:
toolExecutionRequests- the tool execution request.- Returns:
the estimated count of tokens.
-
estimateTokenCountInForcefulToolExecutionRequest
int estimateTokenCountInForcefulToolExecutionRequest(ToolExecutionRequest toolExecutionRequest)
Estimates the count of tokens in the given tool execution request.
- Parameters:
toolExecutionRequest- the tool execution request.- Returns:
the estimated count of tokens.
-
-
-
-