FirebaseAILogic Framework Reference

ModelContent

@available(iOS15.0,macOS12.0,tvOS15.0,watchOS8.0,*)publicstructModelContent:Equatable,Sendable
extensionModelContent:Codable

A 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 theModelContent. For user-generated client requests,for example, the role isuser.

    Declaration

    Swift

    publicletrole:String?
  • The data parts comprising thisModelContent value.

    Declaration

    Swift

    publicvarparts:[anyPart]{get}
  • Creates a new value from a list ofParts.

    Declaration

    Swift

    publicinit(role:String?="user",parts:[anyPart])
  • Creates a new value from any data interpretable as aPart.SeePartsRepresentable for 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.