Skip to content

Conversation

EugeneTheDev
Copy link
Contributor

@EugeneTheDev EugeneTheDev commented May 29, 2025

Based on #188 and fixes #178 by properly handling @LLMDescription during JSON schema generation. Also updated the tests to include the annotation too and simplified structured output example to use existing node

@EugeneTheDev EugeneTheDev added bug Something isn't working enhancement New feature or request labels May 29, 2025
Copy link
Collaborator

@Ololoshechkin Ololoshechkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EugeneTheDev please also add a test with a lot of different descriptors:

  • class descriptor via annotation
  • property descriptor via annotation
  • property of Serializable type, also with field, each of them annotated
  • one field is annotated and also overriden by the map
  • one field is NOT annotated but provided through the map
  • what else can be an edge case?

* @param schemaFormat Format of the generated schema, can be simple or detailed.
* @param maxDepth Maximum recursion depth when generating schema to prevent infinite recursion for circular references.
* @param descriptions Optional map of serial class names and property names to descriptions.
* If a property/type is already described with [LLMDescription] annotation, value from the map will override this description.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also please add good example in KDoc about how to form the descriptions map.
I mean, "className.propertyName" to "property description"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, maybe let's name it descriptionOverrides if it's an overriding map?

Copy link
Contributor Author

@EugeneTheDev EugeneTheDev May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding testing edge cases, that's what I already modified in tests, to cover these cases you described. I didn't mark each field with annotation though because it looks redundant, and it's also nice to test that description is added only for these fields where it is specified, and is skipped for other fields.

Regarding examples and parameter renaming: sounds good, will do it

@EugeneTheDev EugeneTheDev merged commit eb1fce6 into develop May 30, 2025
3 checks passed
@EugeneTheDev EugeneTheDev deleted the eugenethedev/fix-structured-output-descriptions branch May 30, 2025 11:42
Ololoshechkin pushed a commit that referenced this pull request Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LLMDescription not included in the generated schema
4 participants