`JsonStructuredData.createJsonStructure<List&lt...
# koog-agentic-framework
s
JsonStructuredData.createJsonStructure<List<NoteExercise>>()
this used to work with 0.3.0 but now crashes with
Only object-like and no polymorphic types are supported for Default generator, got LIST
. Do I now have to specify the
FULL
schema type for polymorphism, and if so, where do I do that?
k
Hey, @S. Yep, the Default one requires class, object or map. Try using StandardJsonSchemaGenerator, it should support Polymorphic types.
a
Yes, the default generator is
BasicJsonSchemaGenerator
which does not support polymorphism. You can use
StandardJsonSchemaGenerator
if you need more advanced schemas. And with new API, you might not even need to create schemas by hand, there's a higher level functions now, where you can just supply the class as a type parameter and it will choose the best structured output strategy (native/manual) and schema based on the model you are using. You can check these examples https://github.com/JetBrains/koog/tree/develop/examples%2Fsrc%2Fmain%2Fkotlin%2Fai%2Fkoog%2Fagents%2Fexample%2Fstructuredoutput
s
just passing in
StandardJsonSchemaGenerator
does not work either. I assume the new API you mean is
nodeLLMRequestStructured
? I'm just trying to use
simpleOpenAIExecutor().executeStructed()
and it's
StructuredOutputConfig
needs a schema
a
The new API is actually available on different levels, including
executor.executeStructured
, here’s related issue comment. But the main problem is that you are passing
List<NoteExercise>
. As the error message says, you can’t pass lists, you need to pass a class. E.g. wrapping your list in a class
s
I see. I thought it would work with the StandardGenerator
It does work after wrapping it in a class though, and just using type parameters is also nice, thanks
GPT5 takes minutes for what was 5 seconds for 4.1 despite minimal reasoning effort though 😵‍💫