Skip to content

feat(ai): expose recent firebase-js-sdk APIs in react-native-firebase#9028

Merged
mikehardy merged 15 commits into
mainfrom
@mikehardy/ai-package-gap-fill-1
Jun 4, 2026
Merged

feat(ai): expose recent firebase-js-sdk APIs in react-native-firebase#9028
mikehardy merged 15 commits into
mainfrom
@mikehardy/ai-package-gap-fill-1

Conversation

@mikehardy
Copy link
Copy Markdown
Collaborator

Description

This is a "converge towards API parity" PR for the AI package - there have been quite a few API elements added upstream in firebase-js-sdk and this PR should close the gap down a fair bit

Related issues

None logged

Release Summary

A series of feature conventional commits, a semver minor should issue

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

Mostly compare:types and tests:jest analysis, periodic local runs of tests:macos:test but CI will also confirm


Think react-native-firebase is great? Please consider supporting the project with any of the below:

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves API parity between react-native-firebase and the upstream firebase-js-sdk for the AI package. It introduces support for anyOf schema composition, exposes ThinkingLevel presets for model reasoning, and adds handling for server-side going away notices in live sessions. Additionally, it includes client-side validation for generation configurations to prevent common configuration errors.

Highlights

  • AnyOfSchema Support: Added support for anyOf schema composition, allowing for more flexible data structures in AI model requests.
  • ThinkingLevel Integration: Exposed ThinkingLevel constants and updated ThinkingConfig to allow developers to control model reasoning presets.
  • Live Session Updates: Implemented handling for LiveServerGoingAwayNotice messages, enabling the client to gracefully respond to server-side termination notices.
  • GenerationConfig Validation: Added client-side validation to prevent invalid configurations, specifically ensuring thinkingBudget and thinkingLevel are not set simultaneously.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Comment thread packages/ai/lib/types/schema.ts
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for anyOf schemas and thinkingLevel configurations within the AI package, aligning the React Native Firebase implementation more closely with the JS SDK. Key changes include the addition of the AnyOfSchema class, the ThinkingLevel enum, and the LiveServerGoingAwayNotice response type for live sessions. The feedback identifies a potential issue where malformed duration strings could result in NaN values and suggests a more robust null check for thinkingLevel during validation to ensure future-proof code.

Comment thread packages/ai/lib/methods/generate-content.ts Outdated
Comment thread packages/ai/lib/methods/live-session.ts Outdated
@mikehardy
Copy link
Copy Markdown
Collaborator Author

maintainer note: compare-types did not surface the entry points for automatic function calling in the multiple various entry points, though it was detected during agent review - possibly augment compare-types so it surfaces them, red/green test would be to check any change aimed at this at commit point prior to the function-calling PRs after the first one

@russellwheatley
Copy link
Copy Markdown
Member

@mikehardy - presuming one of the the automatic function calling methods is this: 22a741c (this PR)

This isn't surfaced to end consumer (i.e. it's for internal use) so I think this is why it didn't surface in compare scripts?

Copy link
Copy Markdown
Member

@russellwheatley russellwheatley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved - I'll leave it to your discretion if you want to address the gemini feedback 👍

@mikehardy mikehardy force-pushed the @mikehardy/ai-package-gap-fill-1 branch from 1cb7139 to 3a28cf1 Compare June 4, 2026 18:34
@mikehardy
Copy link
Copy Markdown
Collaborator Author

hard to argue against the defensive coding suggestions
rebased PR to current main
performed relevant edits to relevant commits and pushed
assuming CI goes green I'll merge this, otherwise will do the needful to shepherd it through (lint or whatever) then merge

@mikehardy mikehardy added Workflow: Pending Merge Waiting on CI or similar and removed Needs Attention labels Jun 4, 2026
@mikehardy mikehardy merged commit 7f31d9c into main Jun 4, 2026
21 checks passed
@mikehardy mikehardy deleted the @mikehardy/ai-package-gap-fill-1 branch June 4, 2026 23:01
@mikehardy mikehardy removed the Workflow: Pending Merge Waiting on CI or similar label Jun 4, 2026
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