embabel-agent icon indicating copy to clipboard operation
embabel-agent copied to clipboard

VictoolsSchemaGenerator does not honor nested Jackson annotations for parameter serialization

Open stefanks-px opened this issue 3 months ago • 2 comments

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 avatar Aug 07 '26 08:08 stefanks-px

@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 avatar Aug 07 '26 20:08 igordayen

@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.

stefanks-px avatar Aug 07 '26 21:08 stefanks-px