kernel-memory icon indicating copy to clipboard operation
kernel-memory copied to clipboard

[Feature Request] Increase the calculation of tokens

Open xuzeyu91 opened this issue 1 year ago • 2 comments

Context / Scenario

When using Kernel Memory, whether it is Import or Ask, I hope to increase the consumption of returning tokens, so that I can analyze the cost of question and answer scenarios

The problem

Increase the return value of token consumption

Proposed solution

Increase the return value of token consumption

Importance

would be great to have

xuzeyu91 avatar Jan 24 '24 08:01 xuzeyu91

https://github.com/microsoft/kernel-memory/issues/277#issuecomment-1912520930

I found this solution, try to set MaxTokenTotal

 }).WithAzureOpenAITextGeneration(new AzureOpenAIConfig()
            {
                Endpoint = azureOpenAi.SummarizationModel.Endpoint,
                APIKey = azureOpenAi.SummarizationModel.ApiKey,
                Deployment = azureOpenAi.SummarizationModel.DeploymentOrModelId,
                Auth = AzureOpenAIConfig.AuthTypes.APIKey,

// try this
                MaxTokenTotal = 25000,


                MaxRetries = 1230


            }, httpClient: httpClient)

KSemenenko avatar Jan 30 '24 22:01 KSemenenko

第277章(评论)

我找到了这个解决方案,尝试设置 MaxTokenTotal

 }).WithAzureOpenAITextGeneration(new AzureOpenAIConfig()
            {
                Endpoint = azureOpenAi.SummarizationModel.Endpoint,
                APIKey = azureOpenAi.SummarizationModel.ApiKey,
                Deployment = azureOpenAi.SummarizationModel.DeploymentOrModelId,
                Auth = AzureOpenAIConfig.AuthTypes.APIKey,

// try this
                MaxTokenTotal = 25000,


                MaxRetries = 1230


            }, httpClient: httpClient)

What I hope to know is how many tokens are consumed per request Example

"usage": {
		"completion_tokens": 207,
		"prompt_tokens": 15,
		"total_tokens": 222
	}

xuzeyu91 avatar Feb 18 '24 08:02 xuzeyu91

Please feel free to use the poll at https://github.com/microsoft/kernel-memory/discussions/532 to vote for this feature

dluc avatar Jun 04 '24 19:06 dluc