Skip to content

The calculation method of token count needs to be abstracted. #164

Closed
@xbotter

Description

@xbotter

The calculation method of the number of tokens in LLM is always related to LLM, as well as the maximum number of tokens.
However, in SearchClient, it is specified as the applicable token calculation method for OpenAI.

var tokensAvailable = 8000
- GPT3Tokenizer.Encode(this._answerPrompt).Count
- GPT3Tokenizer.Encode(question).Count
- AnswerTokens;

My idea is to extract int MaxTokens {get;} and int TokenCount(string text) together into ITextGeneration, so that providers of LLM can implement this part on their own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions