Repository navigation
feat(ai): generate BidiGenerateContent data models - #16997
andrewheard wants to merge 2 commits into
Conversation
Using Gemini Code AssistThe 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
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 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.
551617d to
52086b8
Compare
Generated
BidiGenerateContent(Gemini Live API) data models and updatedGenerateContentdata models from Google Discovery Document revision20261103. This is PR 2 of a 6-PR stack migratingFirebaseAILogiconto the generated wire types and is based on # (GenerateContent+file renames).Data models (
GeminiAPIDataModels)BidiGenerateContentClientMessageandBidiGenerateContentServerMessagealong with their transitive Live API types underGeminiLanguageModel/Sources/GeminiAPIDataModels/BidiGenerateContent, including a manual override forBidiGenerateContentSetup.toolConfig(which is accepted by the Live API despite being omitted from the Discovery Document) andVoiceActivity.ActivityType(avoiding collision with the Swift.Typemetatype keyword).oneOfoverrides forBidiGenerateContentClientMessageandBidiGenerateContentServerMessageto emit nestedDataenums while preservingusageMetadataon the server message.GenerateContentmodels from Discovery Document revision20261103(AudioTranscriptionConfig.sourceText,FunctionResponsePart.mediaProcessing,ToolType.mediaProcessing,UsageMetadata.responseTokenCountandresponseTokensDetails, and PaLMHarmCategorydeprecations).TimeSpantype (google.protobuf.Duration) and mappedformat: google-durationproperties toTimeSpan.GenerateContent+prefix for consistency with #; the generator itself adopts the prefix in the follow-up namespacing PR.Code generator (
typegen)GenerateContentandBidiGenerateContentsubdirectories viaDEFAULT_ROOT_GROUPSwhile keeping shared schemas inGenerateContent.oneOfunioning, colliding renamed-schema merging (preserving backend provenance within the same backend), nested enumpropertyTypeOverrides, andformat: google-duration->TimeSpanprimitive mapping.STRINGwhen extracting the standaloneDataTypeenum.@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
TimeSpanTestsandtypegenunit tests covering deprecation guards,google-durationmapping,oneOfunioning, andBidiGenerateContentschema merging.#no-changelog