Skip to content

[Grounding with Google Search]: <The FirebaseAI SDK (groundingSupports) does not fully map the API response.> #17952

@CodeCloner-A

Description

@CodeCloner-A

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Other

Which platforms are affected?

Android

Description

  1. Missing Mapping of the groundingSupports Property

Status: Critical (Compliance Blocker) The GroundingMetadata class in the firebase_ai package exposes groundingChunks, but completely omits the groundingSupports property.

Observation: While the REST API provides the complete list of supports, the SDK throws a NoSuchMethodError when attempting to access it.

Impact: Developers cannot implement inline citations (superscripts). Since Google mandates these for Grounded Results, the current SDK implementation is effectively non-compliant.

  1. Inaccuracy of the Delivered Indexes (Word Slicing)

Status: Functional Deficiency. Even when the data is extracted manually (e.g., via a REST call), a structural problem arises in the accuracy of the startIndex and endIndex values.

Problem: The indexes for text segments delivered by the API often end mid-word.

Example: A quote should refer to the phrase "...the Federal Republic of Germany," but the endIndex points to the position before the "d" in "Germany."

Impact: This leads to faulty UI rendering, where words are "sliced" by superscripts. Developers currently have to implement time-consuming workarounds (searching for the nearest whitespace or adjusting regular expressions) to maintain the visual integrity of the text.

Reproducing the issue

?

Firebase Core version

firebase_core: ^4.0.0

Flutter Version

Flutter 3.32.3

Relevant Log Output

NoSuchMethodError: Class 'GroundingMetadata' has no instance getter 'groundingSupports'

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs AttentionThis issue needs maintainer attention.platform: androidIssues / PRs which are specifically for Android.plugin: vertexailabel issues for vertexai plugintype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions