Conversation

erikeldridge

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

@erikeldridgeerikeldridge requested a review from a team as a code owner May 15, 2025 00:35
@changeset-botchangeset-bot

⚠️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

@github-actionsGitHub Actions

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

@erikeldridgeerikeldridge 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

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

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

@erikeldridgeerikeldridge merged commit 72cd626 into firebase-ai-hybridinference May 15, 2025
34 checks passed
@erikeldridgeerikeldridge deleted the erikeldridge-vertex-undefinedmode branch May 15, 2025 17:08
Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.