GeneratedContent
struct GeneratedContent : Sendableextension FirebaseAI.GeneratedContent: Equatableextension FirebaseAI.GeneratedContent: CustomDebugStringConvertibleStructured content generated by a model.
Public Preview: This API is a public preview and may be subject to change.
-
Undocumented
Declaration
Swift
public let kind: Kind -
The generation identifier associated with this content, if any.
Public Preview: This API is a public preview and may be subject to change.
Declaration
Swift
public let generationID: FirebaseAI.GenerationID? -
Creates a new
GeneratedContentfrom a JSON string.Public Preview: This API is a public preview and may be subject to change.
Throws
An error if the JSON is invalid.Declaration
Swift
public init(json: String) throwsParameters
jsonThe JSON string representation of the generated content.
-
The JSON string representation of the generated content.
Public Preview: This API is a public preview and may be subject to change.
Declaration
Swift
@available(iOS 26.0, macOS 26.0, *) @available(tvOS, unavailable) @available(watchOS, unavailable) public var jsonString: String { get } -
Decodes the generated content into the specified type.
Public Preview: This API is a public preview and may be subject to change.
Throws
An error if decoding fails.Declaration
Swift
@available(iOS 26.0, macOS 26.0, *) @available(tvOS, unavailable) @available(watchOS, unavailable) public func value<Value>(_ type: Value.Type = Value.self) throws -> Value where Value: FoundationModels.ConvertibleFromGeneratedContentParameters
typeThe type to decode the content into.
Return Value
The decoded value.
-
Decodes a specific property of the generated content into the specified type.
Public Preview: This API is a public preview and may be subject to change.
Throws
An error if decoding fails or the property does not exist.Declaration
Swift
@available(iOS 26.0, macOS 26.0, *) @available(tvOS, unavailable) @available(watchOS, unavailable) public func value<Value>(_ type: Value.Type = Value.self, forProperty property: String) throws -> Value where Value: FoundationModels.ConvertibleFromGeneratedContentParameters
typeThe type to decode the property into.
propertyThe name of the property to decode.
Return Value
The decoded value.
-
Decodes an optional specific property of the generated content into the specified type.
Public Preview: This API is a public preview and may be subject to change.
Throws
An error if decoding fails.Declaration
Swift
@available(iOS 26.0, macOS 26.0, *) @available(tvOS, unavailable) @available(watchOS, unavailable) public func value<Value>(_ type: Value?.Type = Value?.self, forProperty property: String) throws -> Value? where Value: FoundationModels.ConvertibleFromGeneratedContentParameters
typeThe optional type to decode the property into.
propertyThe name of the property to decode.
Return Value
The decoded value, or
nilif the property does not exist or is null. -
A boolean indicating whether the generated content is complete.
Public Preview: This API is a public preview and may be subject to change.
Declaration
Swift
public let isComplete: Bool -
The kinds of values that can be represented by generated content.
Public Preview: This API is a public preview and may be subject to change.
Declaration
-
Declaration
Swift
public static func == (lhs: FirebaseAI.GeneratedContent, rhs: FirebaseAI.GeneratedContent) -> Bool -
Declaration
Swift
public var debugDescription: String { get }