Skip to content

Conversation

hsubox76
Copy link
Contributor

API proposal doc (internal): https://docs.google.com/document/d/1vfBbh5uKS_9k0l9CmzwUt1E-8OQgiYlN2uJAPHU2VI8/edit?resourcekey=0-JczpCefVsiSxNcYBZdZDTw&tab=t.0#heading=h.x94y9zzc13xn

This adds an inferenceSource property to EnhancedGenerateContentResponses returned by generateContent() and generateContentStream() that indicates whether on-device or in-cloud inference was used. This is only relevant if the developer is using the hybrid inference feature where some inference may be done on-device in the Chrome browser.

Copy link

changeset-bot bot commented Oct 10, 2025

🦋 Changeset detected

Latest commit: 661c733

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@firebase/ai Minor
firebase Minor

Not sure what this means? Click here to learn what changesets are.

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

@google-oss-bot
Copy link
Contributor

Size Report 1

Affected Products

  • @firebase/ai

    TypeBase (2615081)Merge (27e6c45)Diff
    browser63.3 kB64.1 kB+752 B (+1.2%)
    main67.1 kB67.9 kB+837 B (+1.2%)
    module63.3 kB64.1 kB+752 B (+1.2%)
  • firebase

    TypeBase (2615081)Merge (27e6c45)Diff
    firebase-ai.js49.9 kB50.4 kB+452 B (+0.9%)

Test Logs

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

@google-oss-bot
Copy link
Contributor

Size Analysis Report 1

Affected Products

  • @firebase/ai

    • ChatSession

      Size

      TypeBase (2615081)Merge (27e6c45)Diff
      size21.7 kB22.1 kB+437 B (+2.0%)
      size-with-ext-deps39.4 kB39.8 kB+444 B (+1.1%)

      Dependency

      TypeBase (2615081)Merge (27e6c45)Diff
      variables

      25 dependencies

      AIErrorCode
      AI_TYPE
      Availability
      BackendType
      DEFAULT_API_VERSION
      DEFAULT_DOMAIN
      DEFAULT_FETCH_TIMEOUT_MS
      DEFAULT_LOCATION
      FinishReason
      HarmSeverity
      InferenceMode
      LANGUAGE_TAG
      PACKAGE_VERSION
      POSSIBLE_ROLES
      SILENT_ERROR
      Task
      VALID_PARTS_PER_ROLE
      VALID_PART_FIELDS
      VALID_PREVIOUS_CONTENT_ROLES
      badFinishReasons
      errorsCausingFallback
      logger
      name
      responseLineRE
      version

      26 dependencies

      AIErrorCode
      AI_TYPE
      Availability
      BackendType
      DEFAULT_API_VERSION
      DEFAULT_DOMAIN
      DEFAULT_FETCH_TIMEOUT_MS
      DEFAULT_LOCATION
      FinishReason
      HarmSeverity
      InferenceMode
      InferenceSource
      LANGUAGE_TAG
      PACKAGE_VERSION
      POSSIBLE_ROLES
      SILENT_ERROR
      Task
      VALID_PARTS_PER_ROLE
      VALID_PART_FIELDS
      VALID_PREVIOUS_CONTENT_ROLES
      badFinishReasons
      errorsCausingFallback
      logger
      name
      responseLineRE
      version

      + InferenceSource

    • GenerativeModel

      Size

      TypeBase (2615081)Merge (27e6c45)Diff
      size25.4 kB25.8 kB+438 B (+1.7%)
      size-with-ext-deps43.2 kB43.6 kB+444 B (+1.0%)

      Dependency

      TypeBase (2615081)Merge (27e6c45)Diff
      variables

      25 dependencies

      AIErrorCode
      AI_TYPE
      Availability
      BackendType
      DEFAULT_API_VERSION
      DEFAULT_DOMAIN
      DEFAULT_FETCH_TIMEOUT_MS
      DEFAULT_LOCATION
      FinishReason
      HarmSeverity
      InferenceMode
      LANGUAGE_TAG
      PACKAGE_VERSION
      POSSIBLE_ROLES
      SILENT_ERROR
      Task
      VALID_PARTS_PER_ROLE
      VALID_PART_FIELDS
      VALID_PREVIOUS_CONTENT_ROLES
      badFinishReasons
      errorsCausingFallback
      logger
      name
      responseLineRE
      version

      26 dependencies

      AIErrorCode
      AI_TYPE
      Availability
      BackendType
      DEFAULT_API_VERSION
      DEFAULT_DOMAIN
      DEFAULT_FETCH_TIMEOUT_MS
      DEFAULT_LOCATION
      FinishReason
      HarmSeverity
      InferenceMode
      InferenceSource
      LANGUAGE_TAG
      PACKAGE_VERSION
      POSSIBLE_ROLES
      SILENT_ERROR
      Task
      VALID_PARTS_PER_ROLE
      VALID_PART_FIELDS
      VALID_PREVIOUS_CONTENT_ROLES
      badFinishReasons
      errorsCausingFallback
      logger
      name
      responseLineRE
      version

      + InferenceSource

    • InferenceSource

      Size

      TypeBase (2615081)Merge (27e6c45)Diff
      size?6.63 kB? (?)
      size-with-ext-deps?24.2 kB? (?)

      Dependency

      TypeBase (2615081)Merge (27e6c45)Diff
      functions?

      chromeAdapterFactory
      decodeInstanceIdentifier
      factory
      registerAI

      ?
      classes?

      AIError
      AIService
      Backend
      ChromeAdapterImpl
      GoogleAIBackend
      VertexAIBackend

      ?
      variables?

      11 dependencies

      AIErrorCode
      AI_TYPE
      Availability
      BackendType
      DEFAULT_LOCATION
      InferenceMode
      InferenceSource
      Task
      logger
      name
      version

      ?
      enums??

      External Dependency

      ModuleBase (2615081)Merge (27e6c45)Diff
      @firebase/app?

      _registerComponent
      registerVersion

      ?
      @firebase/component?

      Component

      ?
      @firebase/logger?

      Logger

      ?
      @firebase/util?

      FirebaseError

      ?
    • getGenerativeModel

      Size

      TypeBase (2615081)Merge (27e6c45)Diff
      size25.7 kB26.2 kB+437 B (+1.7%)
      size-with-ext-deps43.5 kB44.0 kB+444 B (+1.0%)

      Dependency

      TypeBase (2615081)Merge (27e6c45)Diff
      variables

      26 dependencies

      AIErrorCode
      AI_TYPE
      Availability
      BackendType
      DEFAULT_API_VERSION
      DEFAULT_DOMAIN
      DEFAULT_FETCH_TIMEOUT_MS
      DEFAULT_HYBRID_IN_CLOUD_MODEL
      DEFAULT_LOCATION
      FinishReason
      HarmSeverity
      InferenceMode
      LANGUAGE_TAG
      PACKAGE_VERSION
      POSSIBLE_ROLES
      SILENT_ERROR
      Task
      VALID_PARTS_PER_ROLE
      VALID_PART_FIELDS
      VALID_PREVIOUS_CONTENT_ROLES
      badFinishReasons
      errorsCausingFallback
      logger
      name
      responseLineRE
      version

      27 dependencies

      AIErrorCode
      AI_TYPE
      Availability
      BackendType
      DEFAULT_API_VERSION
      DEFAULT_DOMAIN
      DEFAULT_FETCH_TIMEOUT_MS
      DEFAULT_HYBRID_IN_CLOUD_MODEL
      DEFAULT_LOCATION
      FinishReason
      HarmSeverity
      InferenceMode
      InferenceSource
      LANGUAGE_TAG
      PACKAGE_VERSION
      POSSIBLE_ROLES
      SILENT_ERROR
      Task
      VALID_PARTS_PER_ROLE
      VALID_PART_FIELDS
      VALID_PREVIOUS_CONTENT_ROLES
      badFinishReasons
      errorsCausingFallback
      logger
      name
      responseLineRE
      version

      + InferenceSource

Test Logs

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

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