Update token-counting and context overflow API surface#75
Merged
Conversation
This is mostly to align with webmachinelearning/writing-assistance-apis#31: * Use TooManyTokensError when appropriate, instead of a "QuotaExceededError" DOMException. * Rename tokensLeft/tokensSoFar to tokensAvailable/tokenCount. * Rename countPromptTokens() to countTokens(). * Remove maxTokens. * Rename "contextoverflow" to "overflow", since the vocabulary "context" is not used elsewhere in the API and there's only one relevant type of overflow for the session.
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
Mar 25, 2025
This CL follows webmachinelearning/prompt-api#75 and makes these renaming: - Rename maxTokens/tokensSoFar to inputQuota/inputUsage - Rename countPromptTokens() to measureInputUsage() - Remove tokensLeft Bug: 381975242 Change-Id: Ic6dc879120dc14e873d634478a36a8e1451f8894 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6382357 Reviewed-by: Daseul Lee <dslee@chromium.org> Commit-Queue: Mingyu Lei <leimy@chromium.org> Reviewed-by: Hidehiko Abe <hidehiko@chromium.org> Cr-Commit-Position: refs/heads/main@{#1437284}
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
Mar 25, 2025
This CL follows webmachinelearning/prompt-api#75 and makes the renaming of the contextoverflow event to quotaoverflow. Bug: 381975242 Change-Id: I08fffcc198c9254bd60f95f6f89abe246a4a4f68 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6381420 Reviewed-by: Dominic Farolino <dom@chromium.org> Commit-Queue: Mingyu Lei <leimy@chromium.org> Cr-Commit-Position: refs/heads/main@{#1437297}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is mostly to align with webmachinelearning/writing-assistance-apis#43: