You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description
When generating a json schema for a function callback input type in Kotlin, if a property is nullable in the Kotlin language like this field1 :
classMyFunction() : java.util.function.Function<MyFunction.Request, String?> {
@JvmRecord
data classRequest(
valfield1:Int?)
overridefunapply(r:Request): String {
return"OK"
}
}
@Bean
funmyFunctionBean(): FunctionCallback=FunctionCallback.builder()
.function("myFunctionBean", MyFunction())
.inputType(MyFunction.Request::class.java)
.description("description of my function")
.build()
But all Ollama calls will fail in a HTTP 400 error with this message : [400] Bad Request - {"error":"json: cannot unmarshal array into Go struct field .tools.function.parameters.properties.type of type string"}
I also tried to add @field:NotNull annotation, or set a default value val field1: Int? = null without success.
Environment
Spring AI version : 1.0.0-M5
Kotlin version : 1.9.25
Bug description
When generating a json schema for a function callback input type in Kotlin, if a property is nullable in the Kotlin language like this
field1
:the json schema generated will be like :
But all Ollama calls will fail in a HTTP 400 error with this message :
[400] Bad Request - {"error":"json: cannot unmarshal array into Go struct field .tools.function.parameters.properties.type of type string"}
I also tried to add
@field:NotNull
annotation, or set a default valueval field1: Int? = null
without success.Environment
Spring AI version : 1.0.0-M5
Kotlin version : 1.9.25
Steps to reproduce
see bug description
Expected behavior
The json schema should look like below.:
More generally, providing easy customization of json schema generation could be great... But there's quite lot of work.
The text was updated successfully, but these errors were encountered: