File tree 1 file changed +3
-9
lines changed
FirebaseVertexAI/Sources/Types/Public/Imagen 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,6 @@ extension ImagenGenerationResponse: Decodable where T: Decodable {
50
50
51
51
public init ( from decoder: any Decoder ) throws {
52
52
let container = try decoder. container ( keyedBy: CodingKeys . self)
53
- guard container. contains ( . predictions) else {
54
- images = [ ]
55
- filteredReason = nil
56
- // TODO(#14221): Log warning if no predictions.
57
- return
58
- }
59
53
var predictionsContainer = try container. nestedUnkeyedContainer ( forKey: . predictions)
60
54
61
55
var images = [ T] ( )
@@ -66,7 +60,7 @@ extension ImagenGenerationResponse: Decodable where T: Decodable {
66
60
} else if let filteredReason = try ? predictionsContainer. decode ( RAIFilteredReason . self) {
67
61
filteredReasons. append ( filteredReason. raiFilteredReason)
68
62
} else if let _ = try ? predictionsContainer. decode ( JSONObject . self) {
69
- // TODO(#14221): Log or throw unsupported prediction type
63
+ // TODO(#14221): Log unsupported prediction type message with the decoded `JSONObject`.
70
64
} else {
71
65
// This should never be thrown since JSONObject accepts any valid JSON.
72
66
throw DecodingError . dataCorruptedError (
@@ -77,7 +71,7 @@ extension ImagenGenerationResponse: Decodable where T: Decodable {
77
71
}
78
72
79
73
self . images = images
80
- filteredReason = filteredReasons. first
81
- // TODO(#14221): Log if more than one RAI Filtered Reason; unexpected behaviour .
74
+ filteredReason = filteredReasons. joined ( separator : " \n " )
75
+ // TODO(#14221): Throw `ImagenImagesBlockedError` with `filteredReason` if `images` is empty .
82
76
}
83
77
}
You can’t perform that action at this time.
0 commit comments