@@ -161,7 +161,7 @@ public struct ModelOutput: Sendable, Generable, CustomDebugStringConvertible {
161161 throw GenerativeModel . GenerationError. decodingFailure (
162162 GenerativeModel . GenerationError. Context ( debugDescription: """
163163 \( Self . self) does not contain an object.
164- Content: \( self . kind)
164+ Content: \( kind)
165165 """ )
166166 )
167167 }
@@ -182,7 +182,12 @@ public struct ModelOutput: Sendable, Generable, CustomDebugStringConvertible {
182182 forProperty property: String ) throws -> Value ?
183183 where Value: ConvertibleFromModelOutput {
184184 guard case let . structure( properties, _) = kind else {
185- throw DecodingError . notAStructure
185+ throw GenerativeModel . GenerationError. decodingFailure (
186+ GenerativeModel . GenerationError. Context ( debugDescription: """
187+ \( Self . self) does not contain an object.
188+ Content: \( kind)
189+ """ )
190+ )
186191 }
187192 guard let value = properties [ property] else {
188193 return nil
@@ -194,30 +199,6 @@ public struct ModelOutput: Sendable, Generable, CustomDebugStringConvertible {
194199
195200@available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
196201public extension ModelOutput {
197- /// An error that occurs when decoding a value from `ModelOutput`.
198- enum DecodingError : Error , CustomDebugStringConvertible {
199- /// A required property was not found in the `ModelOutput`.
200- case missingProperty( name: String )
201-
202- /// A property was accessed on a `ModelOutput` that is not a structure.
203- case notAStructure
204-
205- /// The context for a decoding error.
206- public struct Context : Sendable {
207- /// A description of the error.
208- public let debugDescription : String
209- }
210-
211- public var debugDescription : String {
212- switch self {
213- case let . missingProperty( name) :
214- return " Missing property: \( name) "
215- case . notAStructure:
216- return " Not a structure "
217- }
218- }
219- }
220-
221202 /// A representation of the different types of content that can be stored in `ModelOutput`.
222203 ///
223204 /// `Kind` represents the various types of JSON-compatible data that can be held within a
0 commit comments