Open Zhennan-Xu opened 1 month ago
Our current work-around is to change the naming of the variables to use alphabetical order. Works, but inconsistent, ugly and one more argument in the team to use Python. Please fix so we can continue using Spring-AI.
Expected Behavior
Base on the OpenAI document, when using Structured Outputs, outputs will be produced in the same order as the ordering of keys in the json schema. Thus the BeanOutputConverter.getJsonSchema() should keep the key ordering of the Record class to enforce the key order, which would provide benefit of Chain of thought
Current Behavior
The order of key is not preserved, meaning that sometimes it will generate result first, then reasoning. For example:
might produce result
which is final_answer showing first.
Context
In order to have better inference performance, it should be steps show up first, then final_answer. Using string directly for jsonSchema doesn't have the issue, but BeanOutputConverter can't keep the original key order, making it only useful on cases where key order doesn't matter.