@@ -59,32 +59,37 @@ import MetaCodable
5959 /// - Parameter imageUrl: The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
6060 @CodedAs ( " input_image " ) case image(
6161 detail: ImageDetail = . auto,
62- fileId: String ? ,
63- imageUrl: String ?
62+ fileId: String ? = nil ,
63+ imageUrl: String ? = nil
6464 )
6565
6666 /// A file input to the model.
6767 /// - Parameter fileData: The content of the file to be sent to the model.
6868 /// - Parameter fileId: The ID of the file to be sent to the model.
6969 /// - Parameter filename: The name of the file to be sent to the model.
7070 @CodedAs ( " input_file " ) case file(
71- fileData: String ? ,
72- fileId: String ? ,
73- filename: String ?
71+ fileData: String ? = nil ,
72+ fileId: String ? = nil ,
73+ filename: String ? = nil
7474 )
7575 }
7676
7777 /// A text input to the model, equivalent to a text input.
7878 case text( String )
79+
7980 /// A list of one or many content items to the model, containing different content types.
8081 case list( [ ContentItem ] )
81- }
8282
83- /// A text input to the model, equivalent to a text input with the user role.
84- case text( String )
83+ /// Creates a new text input to the model.
84+ public init ( _ text: String ) {
85+ self = . text( text)
86+ }
8587
86- /// A list of one or many input items to the model, containing different content types.
87- case list( [ ListItem ] )
88+ /// Creates a new input to the model with a list of items.
89+ public init ( _ items: [ ContentItem ] ) {
90+ self = . list( items)
91+ }
92+ }
8893
8994 /// The messages contained in the input.
9095 public var messages : [ Message ] {
@@ -113,6 +118,22 @@ import MetaCodable
113118 } . joined ( separator: " " )
114119 }
115120 }
121+
122+ /// A text input to the model, equivalent to a text input with the user role.
123+ case text( String )
124+
125+ /// A list of one or many input items to the model, containing different content types.
126+ case list( [ ListItem ] )
127+
128+ /// Creates a new text input to the model.
129+ public init ( _ text: String ) {
130+ self = . text( text)
131+ }
132+
133+ /// Creates a new input to the model with a list of items.
134+ public init ( _ items: [ ListItem ] ) {
135+ self = . list( items)
136+ }
116137}
117138
118139// MARK: - Text helpers
0 commit comments