-
Notifications
You must be signed in to change notification settings - Fork 65
Return Token Usage on CompletionResponse #14
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ This pull request was sent to the PullRequest network.
@letschers you can click here to see the review status or cancel the code review job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PullRequest Breakdown
Reviewable lines of change
+ 8
- 0
100% Go
Type of change
Minor Update - These changes appear to be a minor update to existing functionality and features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fairly straightforward, I didn't notice any major issues.
Unrelated / low-priority / out of scope point. I did read through other parts of this file and noticed some typos. The word "response"
is misspelled as "respnose"
on line 16 and as "reponse"
on line 21. Almost not worth calling out, but since I already noticed it, just wanted to briefly mention.
Reviewers will be notified any time you reply to their comments or commit new changes.
You can also request a full follow-up review from your PullRequest dashboard.
models.go
Outdated
Usage CompletionResponseUsage `json:"usage"` | ||
} | ||
|
||
//CompletionResponseUsage is the object that returns how many tokens the completion's request used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review! Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the addition here @letschers, this looks good to me.
I need to keep track of how much tokens every completion spended in my personal project. I noticed that the OpenAI API returns this information, so it was simple to add to the CompletionResponse
I noticed too that some responses of go-gpt3 already have this kind of data being returned, so I tried to follow the pattern of the
EditsResponseUsage
structThis data being available may be helpful for someone in the future =]