ModelContent
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct ModelContent : Equatable, Sendableextension ModelContent: CodableA type describing data in media formats interpretable by an AI model. Each generative AI
request or response contains an Array of ModelContents, and each ModelContent value
may comprise multiple heterogeneous Parts.
-
The role of the entity creating the
ModelContent. For user-generated client requests, for example, the role isuser.Declaration
Swift
public let role: String? -
The data parts comprising this
ModelContentvalue.Declaration
Swift
public var parts: [any Part] { get } -
Creates a new value from any data interpretable as a
Part. SeePartsRepresentablefor types that can be interpreted asParts.Declaration
Swift
public init(role: String? = "user", parts: any PartsRepresentable...)
-
Declaration
Swift
public init(from decoder: any Decoder) throws