Skip to content

feat(ai): generate BidiGenerateContent data models - #16997

Draft
andrewheard wants to merge 2 commits into
mainfrom
ah/ai-wire-1-data-models
Draft

andrewheard wants to merge 2 commits into
mainfrom
ah/ai-wire-1-data-models

Conversation

@andrewheard

@andrewheard andrewheard commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Generated BidiGenerateContent (Gemini Live API) data models and updated GenerateContent data models from Google Discovery Document revision 20261103. This is PR 2 of a 6-PR stack migrating FirebaseAILogic onto the generated wire types and is based on # (GenerateContent+ file renames).

Data models (GeminiAPIDataModels)

  • Generated BidiGenerateContentClientMessage and BidiGenerateContentServerMessage along with their transitive Live API types under GeminiLanguageModel/Sources/GeminiAPIDataModels/BidiGenerateContent, including a manual override for BidiGenerateContentSetup.toolConfig (which is accepted by the Live API despite being omitted from the Discovery Document) and VoiceActivity.ActivityType (avoiding collision with the Swift .Type metatype keyword).
  • Configured oneOf overrides for BidiGenerateContentClientMessage and BidiGenerateContentServerMessage to emit nested Data enums while preserving usageMetadata on the server message.
  • Updated GenerateContent models from Discovery Document revision 20261103 (AudioTranscriptionConfig.sourceText, FunctionResponsePart.mediaProcessing, ToolType.mediaProcessing, UsageMetadata.responseTokenCount and responseTokensDetails, and PaLM HarmCategory deprecations).
  • Added a shared TimeSpan type (google.protobuf.Duration) and mapped format: google-duration properties to TimeSpan.
  • Named new generated files with the GenerateContent+ prefix for consistency with #; the generator itself adopts the prefix in the follow-up namespacing PR.

Code generator (typegen)

  • Partitioned generated output into GenerateContent and BidiGenerateContent subdirectories via DEFAULT_ROOT_GROUPS while keeping shared schemas in GenerateContent.
  • Added cross-backend oneOf unioning, colliding renamed-schema merging (preserving backend provenance within the same backend), nested enum propertyTypeOverrides, and format: google-duration -> TimeSpan primitive mapping.
  • Required STRING when extracting the standalone DataType enum.
  • Guarded generated @available(*, deprecated) attributes with #if hasAttribute(diagnose) so older toolchains without @diagnose(DeprecatedDeclaration, as: ignored) (such as CocoaPods validation builds) compile deprecated enum cases without unsuppressible warnings.

Testing

  • Added TimeSpanTests and typegen unit tests covering deprecation guards, google-duration mapping, oneOf unioning, and BidiGenerateContent schema merging.

#no-changelog

@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

…ent+

Rename the generated GeminiAPIDataModels sources (and the shared
JSONValue.swift) to use a GenerateContent+ file name prefix without changing
their contents.

This is a pure file move split out from the upcoming change that nests the
generated types inside a GenerateContent namespace enum. Landing the renames
separately lets Git track the files as moves, so the follow-up shows the
namespace nesting as in-place modifications rather than as delete/add pairs.
Generate BidiGenerateContent (Gemini Live API) data models and update
GenerateContent models from Discovery Document revision 20261103.

Data model changes:
- Add BidiGenerateContentClientMessage and
  BidiGenerateContentServerMessage root types along with transitive
  Bidi-specific schemas under
  Sources/GeminiAPIDataModels/BidiGenerateContent, including toolConfig
  on BidiGenerateContentSetup.
- Configure oneOf overrides for BidiGenerateContentClientMessage and
  BidiGenerateContentServerMessage to emit nested Data enums while
  preserving usageMetadata on the server message.
- Map VoiceActivity.type to VoiceActivity.ActivityType to avoid
  colliding with the Swift .Type metatype keyword.
- Add shared TimeSpan (google.protobuf.Duration) and map
  format: google-duration properties to TimeSpan.
- Update GenerateContent models with
  AudioTranscriptionConfig.sourceText,
  FunctionResponsePart.mediaProcessing, ToolType.mediaProcessing,
  UsageMetadata.responseTokenCount/responseTokensDetails, and PaLM
  HarmCategory deprecations.

Typegen changes:
- Partition generated types into GenerateContent and BidiGenerateContent
  subdirectories via DEFAULT_ROOT_GROUPS while keeping shared schemas in
  GenerateContent.
- Union oneOf entries across backends, merge colliding renamed schemas,
  and preserve backend provenance when merging within the same backend.
- Support propertyTypeOverrides for nested enum names and require STRING
  when extracting the standalone DataType enum.
- Guard generated @available(*, deprecated) attributes with
  #if hasAttribute(diagnose) so toolchains without @diagnose compile
  without unsuppressible deprecation warnings.
@andrewheard
andrewheard force-pushed the ah/ai-wire-1-data-models branch from 551617d to 52086b8 Compare November 4, 2026 15:01

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant