As described by @belozierov in #98 (comment):
I receive the LLM response as JSON (decoded using Decodable), which contains the generated Content (decoded via AnyCodable) along with additional metadata. I then: 1. Re-encode the AnyCodable content back into Data 2. Convert that Data into a String 3. Pass it to GeneratedContent.init(json: String), where it is converted back into Data again
To reduce unnecessary transformations (allocations/copies), it would be useful to add GeneratedContent.init(json: Data). It would be even better if GeneratedContent supported Codable directly for JSON data (initially this was a bit confusing, because I assumed this was already how GeneratedContent: Codable worked).
As described by @belozierov in #98 (comment):