FirebaseAILogic Framework Reference Stay organized with collections Save and categorize content based on your preferences.
ModelContent
@available(iOS15.0,macOS12.0,tvOS15.0,watchOS8.0,*)publicstructModelContent:Equatable,SendableextensionModelContent:CodableA type describing data in media formats interpretable by an AI model. Each generative AIrequest or response contains anArray ofModelContents, and eachModelContent valuemay comprise multiple heterogeneousParts.
The role of the entity creating the
ModelContent. For user-generated client requests,for example, the role isuser.Declaration
Swift
publicletrole:String?The data parts comprising this
ModelContentvalue.Declaration
Swift
publicvarparts:[anyPart]{get}Creates a new value from any data interpretable as a
Part.SeePartsRepresentablefor types that can be interpreted asParts.Declaration
Swift
publicinit(role:String?="user",parts:anyPartsRepresentable...)
Declaration
Swift
publicinit(fromdecoder:anyDecoder)throws
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-28 UTC.