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

Refactor Usage handling #2108

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ilayaperumalg
Copy link
Member

  • Remove model specific Usage implementations
  • Add Object getNativeUsage() to Usage interface
    • This will allow the model specific Usage data to be returned
    • At the client side, client needs to cast the return type of getNativeUsage into the corresponding Usage returned by the model API
  • Rename generationTokens to completionTokens
    • Since completion token name is more common among the models, renaming generation tokens into completion tokens
  • Change the prompt, completion and total token return types to Integer
  • Use DefaultUsage for most of the model specific usage handling
    • When initializing set the native usage to the model specific usage type

 - Remove model specific Usage implementations
 - Add `Object getNativeUsage()` to Usage interface
   - This will allow the model specific Usage data to be returned
   - At the client side, client needs to cast the return type of `getNativeUsage` into the corresponding Usage returned by the model API
 - Rename `generationTokens` to `completionTokens`
   - Since `completion` token name is more common among the models, renaming generation tokens into completion tokens
 - Change the prompt, completion and total token return types to Integer
 - Use DefaultUsage for most of the model specific usage handling
    - When initializing set the native usage to the model specific usage type

Resolves spring-projects#1407
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 this pull request may close these issues.

2 participants