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

[Feature Request] Add Token Usage Logging #22

Open
choseh opened this issue Mar 29, 2023 · 2 comments
Open

[Feature Request] Add Token Usage Logging #22

choseh opened this issue Mar 29, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@choseh
Copy link

choseh commented Mar 29, 2023

Hey,

first of all, thank you for your work! By far the best solution out there right now :)

Would it be possible to add a few logging options, such as logging the token cost? Since openai itself does not allow accounting for individual api keys, it would be nice to have an overview of how much tokens the individual bot instance has used/requested. This might be a very niche request, but I'd appreciate it.

Thanks!

@seratch seratch added enhancement New feature or request good first issue Good for newcomers labels Mar 29, 2023
@seratch
Copy link
Owner

seratch commented Mar 29, 2023

Hi @choseh, I am glad to hear that! Just printing the "usage" part of OpenAI API responses would be relatively easy. Perhaps, we can add a new logger (say, "usage" logger) to write the logs.

@seratch
Copy link
Owner

seratch commented Apr 8, 2023

Before switching to the streaming mode, the "usage" property existed in the OpenAI response. However, it seems that OpenAI API does not return "usage" data for streaming chunks. So, we may not be able to implement this as of today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants