public class OpenAiTokenizer extends Object implements dev.langchain4j.model.Tokenizer
Constructor and Description |
---|
OpenAiTokenizer(String modelName) |
Modifier and Type | Method and Description |
---|---|
String |
decode(List<Integer> tokens) |
List<Integer> |
encode(String text) |
List<Integer> |
encode(String text,
int maxTokensToEncode) |
int |
estimateTokenCountInForcefulToolExecutionRequest(dev.langchain4j.agent.tool.ToolExecutionRequest toolExecutionRequest) |
int |
estimateTokenCountInForcefulToolSpecification(dev.langchain4j.agent.tool.ToolSpecification toolSpecification) |
int |
estimateTokenCountInMessage(dev.langchain4j.data.message.ChatMessage message) |
int |
estimateTokenCountInMessages(Iterable<dev.langchain4j.data.message.ChatMessage> messages) |
int |
estimateTokenCountInText(String text) |
int |
estimateTokenCountInToolExecutionRequests(Iterable<dev.langchain4j.agent.tool.ToolExecutionRequest> toolExecutionRequests) |
int |
estimateTokenCountInToolSpecifications(Iterable<dev.langchain4j.agent.tool.ToolSpecification> toolSpecifications) |
public OpenAiTokenizer(String modelName)
public int estimateTokenCountInText(String text)
estimateTokenCountInText
in interface dev.langchain4j.model.Tokenizer
public int estimateTokenCountInMessage(dev.langchain4j.data.message.ChatMessage message)
estimateTokenCountInMessage
in interface dev.langchain4j.model.Tokenizer
public int estimateTokenCountInMessages(Iterable<dev.langchain4j.data.message.ChatMessage> messages)
estimateTokenCountInMessages
in interface dev.langchain4j.model.Tokenizer
public int estimateTokenCountInToolSpecifications(Iterable<dev.langchain4j.agent.tool.ToolSpecification> toolSpecifications)
estimateTokenCountInToolSpecifications
in interface dev.langchain4j.model.Tokenizer
public int estimateTokenCountInForcefulToolSpecification(dev.langchain4j.agent.tool.ToolSpecification toolSpecification)
estimateTokenCountInForcefulToolSpecification
in interface dev.langchain4j.model.Tokenizer
public int estimateTokenCountInToolExecutionRequests(Iterable<dev.langchain4j.agent.tool.ToolExecutionRequest> toolExecutionRequests)
estimateTokenCountInToolExecutionRequests
in interface dev.langchain4j.model.Tokenizer
public int estimateTokenCountInForcefulToolExecutionRequest(dev.langchain4j.agent.tool.ToolExecutionRequest toolExecutionRequest)
estimateTokenCountInForcefulToolExecutionRequest
in interface dev.langchain4j.model.Tokenizer
Copyright © 2024. All rights reserved.