-
Notifications
You must be signed in to change notification settings - Fork 64
Having @Generable enum used as a stored property without @Guide struct causes a silent failure (all members are a "placeholder" ) #146
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hello,
Thank you for making AnyLanguageModel! I'm really excited to migrate my project to use it.
In my project, I have a Generable struct with a version member (enum) that is non-generable. When I tried migrating to use AnyLanguageModel, I hit a silent failure that caused all the members of my generable struct to get values such as "placeholder"
System Version: macOS 26.3.1
Xcode Version: Version 26.2 (17C52)
Here's a minimal reproduction case that demonstrates it
import AnyLanguageModel
@Generable // this is only generable just for `SimpleOutput` conformance sake
enum OutputVersion: String {
case v0
case v1
}
@Generable
struct SimpleOutput {
let version: OutputVersion
@Guide(description: "The title of the document")
let title: String
@Guide(description: "List of topics", .minimumCount(2))
let topics: [String]
}
@main
struct ALMRepo {
static func main() async throws {
let session = LanguageModelSession(model: SystemLanguageModel.default)
let response = try await session.respond(
to: "Classify this: Swift is a programming language by Apple.",
generating: SimpleOutput.self
)
print(response.content)
}
}Output
SimpleOutput(version: ALMRepo.OutputVersion.v0, title: "placeholder", topics: ["placeholder", "placeholder"], _rawGeneratedContent: GeneratedContent(structure(properties: ["version": GeneratedContent(string("v0")), "topics": GeneratedContent(array([GeneratedContent(string("placeholder")), GeneratedContent(string("placeholder"))])), "title": GeneratedContent(string("placeholder"))], orderedKeys: ["version", "topics", "title"])))
Program ended with exit code: 0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working