-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(firebase-ai): create ai
package, vertexai
wraps around it
#8555
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
* @param config - The optional config for your firebase app. | ||
* @returns Promise<FirebaseApp> - The initialized Firebase app. | ||
*/ | ||
export function initializeApp( |
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.
Would you be able to point to what causes this to become potentially async?
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.
It is async: https://github.com/invertase/react-native-firebase/blob/main/packages/app/lib/internal/registry/app.js#L118
which bears out in the docs: https://rnfirebase.io/app/usage
*/ | ||
export function getAI( | ||
app: ReactNativeFirebase.FirebaseApp = getApp(), | ||
options: AIOptions = { backend: new GoogleAIBackend() }, |
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.
I wonder if we should just remove the default and force the user to provide something? How is the API in the JS SDK?
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 how it is in firebase-js-sdk: https://github.com/firebase/firebase-js-sdk/blob/main/packages/ai/src/api.ts#L130
return { | ||
app, | ||
backend: options.backend, | ||
location: (options.backend as VertexAIBackend)?.location || '', |
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.
Can it fail if it's a GoogleAIBackend? Should it use a parent class?
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.
It'll just revert to an empty string when GoogleAIBackend. This is for backwards compatibility with VertexAI: https://github.com/invertase/react-native-firebase/blob/firebase-ai/packages/ai/lib/public-types.ts#L132-L136
firebase-js-sdk does the same thing.
Co-authored-by: Darren Ackers <[email protected]>
Description
ai
package. Kept relevant types invertexai
package and deprecated them.firebase-js-sdk
.vertexai
andgoogleai
.dist/
so opted to makeai
package a dependency which I think is a better way of doing it.ai
example app for illustration and tested latestvertexai
andai
implementations which surfaced a couple of subtle bugs that have been resolved.Important
vertexai
for this pull request.Related issues
Release Summary
Checklist
Android
iOS
Other
(macOS, web)e2e
tests added or updated inpackages/\*\*/e2e
jest
tests added or updated inpackages/\*\*/__tests__
Test Plan
Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter