Skip to content

AI Hybrid Inference: guard against undefined mode #9045

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

Conversation

erikeldridge
Copy link

@erikeldridge erikeldridge commented May 15, 2025

Problem Statement

I was using the e2e test and noticed it was throwing an exception from countToken.

We intentionally throw from countToken in the hybrid case, but it was surprising to see that error in the non-hybrid case.

Turns out, mode is undefined in the non-hybrid case, but we weren't guarding for that.

Solution

Explicitly guard against an undefined mode

@erikeldridge erikeldridge requested a review from a team as a code owner May 15, 2025 00:35
Copy link

changeset-bot bot commented May 15, 2025

⚠️ No Changeset found

Latest commit: 205a25b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

Vertex AI Mock Responses Check ⚠️

A newer major version of the mock responses for Vertex AI unit tests is available. update_vertexai_responses.sh should be updated to clone the latest version of the responses: v13.0

@erikeldridge erikeldridge changed the title Guard against undefined mode, ie the non-hybrid common case AI Hybrid Inference: guard against undefined mode May 15, 2025
@google-oss-bot
Copy link
Contributor

google-oss-bot commented May 15, 2025

Size Report 1

Affected Products

  • @firebase/ai

    TypeBase (50f142a)Merge (00a5ee3)Diff
    browser47.9 kB48.0 kB+103 B (+0.2%)
    main49.1 kB49.2 kB+103 B (+0.2%)
    module47.9 kB48.0 kB+103 B (+0.2%)
  • firebase

    TypeBase (50f142a)Merge (00a5ee3)Diff
    firebase-ai.js37.8 kB37.9 kB+94 B (+0.2%)
    firebase-vertexai.js37.8 kB37.9 kB+94 B (+0.2%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/nwLnTwDGqH.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented May 15, 2025

Size Analysis Report 1

Affected Products

  • @firebase/ai

    • getGenerativeModel

      Size

      TypeBase (50f142a)Merge (00a5ee3)Diff
      size27.7 kB27.8 kB+98 B (+0.4%)
      size-with-ext-deps46.8 kB46.9 kB+99 B (+0.2%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/gmjfCx4i7J.html

@erikeldridge erikeldridge merged commit 72cd626 into firebase-ai-hybridinference May 15, 2025
34 checks passed
@erikeldridge erikeldridge deleted the erikeldridge-vertex-undefinedmode branch May 15, 2025 17:08
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.

3 participants