Skip to content
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 the number of prompt and generated tokens for API providers #387

Closed
rlouf opened this issue Nov 22, 2023 · 2 comments · Fixed by #388
Closed

Return the number of prompt and generated tokens for API providers #387

rlouf opened this issue Nov 22, 2023 · 2 comments · Fixed by #388

Comments

@rlouf
Copy link
Member

rlouf commented Nov 22, 2023

The number of prompt and generated tokens is important to evaluate the cost of each query. I suggest to return a class that contains the generation as well as these numbers.

@HerrIvan
Copy link
Contributor

HerrIvan commented Nov 23, 2023

I suppose the goal is keeping the counts of the tokens consumed for each instance of the OpenAI class, right? Maybe keeping last and accumulated tokens, s.t. whoever is interested can inspect these values after each call.

@rlouf
Copy link
Member Author

rlouf commented Nov 24, 2023

I was thinking about returning it at every step, but keeping it as a class attribute is much better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants