Skip to content

Fix JsonSchema strict to be encoded even if it's default value is true #430

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LittleTrickster
Copy link

Q A
Bug fix? yes
New feature? no
BC breaks? no

Describe your change

  1. Make strict to be encoded when it is set to true in JsonSchema
  2. Add additionalProperties to jsonSchema() test, as it is required when strict is true

What problem is this fixing?

strict true in JsonSchema was never encoded to json since kotlin Json does not encode default values so openai thinks its false by default
When strict is false and schema has nested classes or lists then ChatMessage content gets wrapped in extra object like content": "{\"type\":\"object\",\"properties\":{\"isValid\":true,...
instead of expected "content": "{\"isValid\":true,...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant