invakid404
01/26/2026, 12:56 PMinvakid404
01/26/2026, 12:56 PMgo
// Create Location class
locationBuilder, _ := tb.AddClass("Location")
locationBuilder.AddProperty("street", tb.String())
locationBuilder.AddProperty("city", tb.String())
// Add property to DynamicOutput that references Location
dynamicOutputBuilder, _ := tb.DynamicOutput() // existing @@dynamic class
locationType, _ := locationBuilder.Type()
dynamicOutputBuilder.AddProperty("location", locationType)
The schema sent to the LLM appears to be correct, and the LLM correctly returns a JSON object that matches the schema:
{
base_field: string,
location: {
city: string,
street: string,
},
}
But parsing fails with: DistributeTypeWithMetaFailure(Class Location not found)Vaibhav (BAML π)
01/26/2026, 3:59 PMinvakid404
01/27/2026, 2:38 PMinvakid404
01/27/2026, 2:38 PMVaibhav (BAML π)
01/27/2026, 3:10 PMLocation class looks like this:
class Location {
street string | null
city string | null
}
and then the value:
{}
can successfully be cast to:
{
street: null,
city: null,
}Vaibhav (BAML π)
01/27/2026, 3:10 PMstreet and city?Vaibhav (BAML π)
01/27/2026, 3:10 PMinvakid404
01/27/2026, 3:12 PM2026-01-27T17:11:42.669 [BAML INFO] Found valid cached BAML library path="/Users/inva/Library/Caches/baml/libs/0.218.0/libbaml_cffi-aarch64-apple-darwin.dylib"
2026-01-27T17:11:42.675 [BAML INFO] BAML (v0.218.0) loaded
=== Non-Streaming Example ===
2026-01-27T17:11:45.766 [BAML INFO] Function ExtractInfo:
Client: Claude (claude-haiku-4-5-20251001) - 3039ms. StopReason: end_turn. Tokens(in/out): 67/51
---PROMPT---
user: Extract structured information from the following text.
John lives at 123 Main Street in San Francisco
Answer in JSON using this schema:
{
base_field: string,
location: {
street: string,
city: string,
},
}
---LLM REPLY---
json
{
"base_field": "John lives",
"location": {
"street": "123 Main Street",
"city": "San Francisco"
}
}
---Parsed Response (class DynamicOutput)---
{
"base_field": "John lives",
"location": {
"street": "123 Main Street",
"city": "San Francisco"
}
}
Result: {Base_field:John lives DynamicProperties:map[location:{Name:Location Fields:map[city:San Francisco street:123 Main Street]}]}
Base Field: John lives
Dynamic Properties: map[location:{Name:Location Fields:map[city:San Francisco street:123 Main Street]}]
=== Streaming Example ===
Partial: &{Base_field:<nil> DynamicProperties:map[location:<nil>]}
2026/01/27 17:11:46 Stream error: Parsing error: Failed to parse LLM response: DistributeTypeWithMetaFailure(Class Location not found)
Prompt: user: Extract structured information from the following text.
Jane lives at 456 Oak Avenue in Los Angeles
Answer in JSON using this schema:
{
base_field: string,
location: {
street: string,
city: string,
},
}
Raw Response: json
{
"base_field": "Jane",
"location": {
"street": "456 Oak Avenue",
"city": "Los Angeles"
}
}
Detailed message: Parsing error: Failed to parse LLM response: DistributeTypeWithMetaFailure(Class Location not found)
Prompt: user: Extract structured information from the following text.
Jane lives at 456 Oak Avenue in Los Angeles
Answer in JSON using this schema:
{
base_field: string,
location: {
street: string,
city: string,
},
}
Raw Response: json
{
"base_field": "Jane",
"location": {
"street": "456 Oak Avenue",
"city": "Los Angeles"
}
}
exit status 1invakid404
01/27/2026, 3:12 PMinvakid404
01/27/2026, 3:13 PMVaibhav (BAML π)
01/27/2026, 3:13 PMgreg (BAML)
01/27/2026, 5:28 PMinvakid404
02/01/2026, 4:22 PMgreg (BAML)
02/01/2026, 4:42 PM