-
Notifications
You must be signed in to change notification settings - Fork 980
feat(ai): Add prefer_in_cloud option for inference mode #9236
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8ebbae4
feat: Add prefer_in_cloud option for inference mode
hsubox76 4e39390
test: Add comprehensive dispatch logic tests for GenerativeModel
hsubox76 6619ed4
fix tests
hsubox76 cadfd09
stop publicly exposing mode
hsubox76 36deac4
fix ts errors
hsubox76 0aadd2e
format
hsubox76 f929d6c
undo grammar fix
hsubox76 8c9c1c2
fix prefer_on_cloud fallback criteria
hsubox76 34094c8
Apply suggestions from code review
hsubox76 7c4f837
Add doc comments on InferenceModes
hsubox76 274e5e8
Merge branch 'feat/prefer-in-cloud' of https://github.com/firebase/fi…
hsubox76 db53108
Update .changeset/feat-prefer-in-cloud.md
hsubox76 a1af166
fix ERROR casing and formatting
hsubox76 6f87cb4
Merge branch 'feat/prefer-in-cloud' of https://github.com/firebase/fi…
hsubox76 7fd62c4
fix expected error case in tests
hsubox76 d4e843e
Move InferenceMode doc comment to be on top of type
hsubox76 15908c7
move docs to where they will be seen
hsubox76 d165c42
Update .changeset/feat-prefer-in-cloud.md
hsubox76 4324ddd
Address comment
hsubox76 337d34c
Merge branch 'feat/prefer-in-cloud' of https://github.com/firebase/fi…
hsubox76 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
"@firebase/ai": minor | ||
"firebase": minor | ||
--- | ||
|
||
feat: Add `prefer_in_cloud` option for inference mode | ||
|
||
This change introduces a new `InferenceMode` option, `prefer_in_cloud`. When this mode is selected, the SDK will attempt to use the cloud backend first. If the cloud call fails with a network-related error, it will fall back to the on-device model if available. | ||
|
||
This also includes a refactoring of the logic for dispatching requests to either the on-device or cloud backends to improve clarity and remove duplication. | ||
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.