@@ -14,7 +14,7 @@ public extension Responses {
1414 /// Specify additional output data to include in the model response.
1515 public var include : [ AdditionalOutput ] ?
1616 /// Text, image, or file inputs to the model, used to generate a response.
17- public var input : [ Input ] ?
17+ public var input : Input ?
1818 /// A system (or developer) message inserted into the model's context.
1919 ///
2020 /// When using along with `previous_response_id`, the instructions from a previous response
@@ -123,7 +123,22 @@ public extension Responses {
123123 case reasoningEncryptedContent = " reasoning.encrypted_content "
124124 }
125125
126- public struct Input : Encodable , Sendable {
126+ public enum Input : Encodable , Sendable {
127+ case text( String )
128+ case input( [ InputObject ] )
129+
130+ public func encode( to encoder: any Encoder ) throws {
131+ var container = encoder. singleValueContainer ( )
132+ switch self {
133+ case . text( let text) :
134+ try container. encode ( text)
135+ case . input( let object) :
136+ try container. encode ( object)
137+ }
138+ }
139+ }
140+
141+ public struct InputObject : Encodable , Sendable {
127142 /// The role of the message input. One of `user`, `assistant`, `system`, or `developer`.
128143 public let role : Role
129144
0 commit comments