-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
return number of tokens spent on a task #127
Comments
🤖 This is my suggestion: I am moderately confident in the solution provided. Here's a summary of the changes you need to make to implement the requested feature:
Here are the code snippets for each step: modules/gpt.js: module.exports.totalTokensUsed = totalTokensUsed;
function resetTotalTokensUsed() {
totalTokensUsed = 0;
}
module.exports.resetTotalTokensUsed = resetTotalTokensUsed; ui.js: let totalTokensSpent = 0;
const { result: relevantFilesChunk, tokensSpent } = await runAgent(getRelevantFiles, task, summaries, interactive);
totalTokensSpent += tokensSpent;
return { solutions, totalTokensSpent }; Please note that this solution assumes that the |
I need the main function on ui.js to also return the number of tokens that were spent on a task.
There are already modules in the project to calculate the number of tokens for all gpt calls, but those counts don't happen on the ui.js file. Use the ui.js on the root of the project.
There should be a variable that stores the total tokens, on the ui.js, and that gets incremented each time there's an API call to gpt, which happens on different modules. You also need to make sure that the app gets the value from the module that runs gpt calls and is able to provide that context to the ui.js file.
Present a solution to implement this on the current app.
The text was updated successfully, but these errors were encountered: