FirebaseVertexAI Framework Reference

Part

public enum Part : Equatable
extension ModelContent.Part: Codable
extension ModelContent.Part: ThrowingPartsRepresentable

A discrete piece of data in a media format interpretable by an AI model. Within a single value of Part, different data types may not mix.

  • Text value.

    Declaration

    Swift

    case text(String)
  • Data with a specified media type. Not all media types may be supported by the AI model.

    Declaration

    Swift

    case data(mimetype: String, Data)
  • File data stored in Cloud Storage for Firebase, referenced by URI.

    Note

    Supported media types depends on the model; see media requirements for details.

    Declaration

    Swift

    case fileData(mimetype: String, uri: String)

    Parameters

    mimetype

    The IANA standard MIME type of the uploaded file, for example, "image/jpeg" or "video/mp4"; see media requirements for supported values.

    uri

    The "gs://"-prefixed URI of the file in Cloud Storage for Firebase, for example, "gs://bucket-name/path/image.jpg".

  • A predicted function call returned from the model.

    Declaration

    Swift

    case functionCall(FunctionCall)
  • A response to a function call.

    Declaration

    Swift

    case functionResponse(FunctionResponse)
  • Convenience function for populating a Part with JPEG data.

    Declaration

    Swift

    public static func jpeg(_ data: Data) -> ModelContent.Part
  • Convenience function for populating a Part with PNG data.

    Declaration

    Swift

    public static func png(_ data: Data) -> ModelContent.Part
  • Returns the text contents of this Part, if it contains text.

    Declaration

    Swift

    public var text: String? { get }
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws
  • Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Undocumented

    Declaration

    Swift

    public typealias ErrorType = Never
  • Undocumented

    Declaration

    Swift

    public func tryPartsValue() throws -> [ModelContent.Part]