VictoolsSchemaGenerator does not honor nested Jackson annotations for parameter serialization
Problem
Given a tool like
@LlmTool(name = SEARCH, description = "...")
public PagedModel<Result> search(
@LlmTool.Param(description = "...") SearchFilter filter) {
the SearchFilter parameter
public class SearchFilter {
@JsonPropertyDescription("More details")
String searchTerm;
}
serialises to
{
"type" : "object",
"properties" : {
"filter" : {
"type" : "object",
"properties" : {
"searchTerm" : {
"type" : "string"
},
}
}
},
"required" : [ "filter" ]
}
JsonPropertyDescription is not honored
Solution
Register victools JacksonSchemaModule in VictoolsSchemaGenerator
@stefanks-px - thank you for reporting.
Are you using NATIVE SCHEMA SUPPORT in OpenAI?
Could you please elaborate on the practical need for incorporating
JsonPropertyDescription("More details")
inside schema.
Would like to see
"description": "More details"
Not sure it should be part of the schema, as it's just a standard key, same as additionalInfo.
Thanks
@alexheifetz @azanux - FYI
@igordayen We don't use OpenAI but yes, we want to use native schema support where possible.
Sometimes it helps the LLM to give more context. The @JsonPropertyDescription for the searchTerm could be "Can be an entity id or a country Iso3 String".
Specifically with countries, my observation is that it helps to describe what format you want. You could also provide this information on the object using @LlmTool.Param but it seems nice to supply this information on the specific attribute. Especially if many attributes are present in an object.
This is also supported by Spring AI @Tool annotation so a direct migration is not possible right now.