Skip to content

BeanOutputConverter getFormat() and convert() format mismatch for List types #5707

@WBSYZYZ

Description

@WBSYZYZ

Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description

  • prompt
  • Your response should be in JSON format.
    Do not include any explanations, only provide a RFC8259 compliant JSON response following this format without deviation.
    Do not include markdown code blocks in your response.
    Remove the ```json markdown from the output.
    Here is the JSON Schema instance your output must adhere to:
  "$schema" : "https://json-schema.org/draft/2020-12/schema",
  "type" : "array",
  "items" : {
    "type" : "object",
    "properties" : {
      "sql" : {
        "type" : "string",
        "description" : "SQL语句"
      },
      "stepName" : {
        "type" : "string",
        "description" : "步骤名称"
      }
    },
    "required" : [ "sql", "stepName" ],
    "additionalProperties" : false
  }
}```
- getFormat() generates: {"type":"array","items":[...]}
- convert() expects: [{...},{...}]

**Environment**
spring ai 1.1.3

When LLM follows the format from getFormat(), convert() fails with:
MismatchedInputException: Cannot deserialize value of type ArrayList from Object value

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions