Skip to content

🚀 [firebase_ai] Support JsonPart for Structured Prompt Input #17902

@lhengl

Description

@lhengl

What feature would you like to see?

It would be great if firebase_ai plugin supported a native JsonPart (or equivalent) when sending prompts to Gemini. The underlying Google AI SDK accepts multipart content, but currently it only allows JSON to be passed as encoded text as a workaround. This forces developers to manually serialize and escape JSON before sending it to the model, which is error-prone and adds a lot of unnecessary boilerplate.

Why would this be useful?

Many real apps using Gemini rely on structured state — user profiles, session context, configs, domain models, etc. Having to wrap JSON in a text part makes prompting fragile, especially with deeply nested objects. A native JSON part would:

  • allow us to send structured data directly,
  • avoid escaping/formatting issues,
  • simplify prompts,
  • and align well with Gemini’s structured output and function-calling capabilities.

Is there a missing a feature that is supported on an underlying SDK? Or is there a feature that you think would be useful to have in FlutterFire?

It’s a small feature, but it would greatly improve the developer experience for anyone using Gemini.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs AttentionThis issue needs maintainer attention.plugin: ailabel issues for firebase_ai plugintype: enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions