koog icon indicating copy to clipboard operation
koog copied to clipboard

Make `objectType` nullable in `OpenAIChatCompletion`.

Open adamglin0 opened this issue 2 months ago • 1 comments

Add nullability to the object in OpenAIChatCompletion.

Because in the OpenAI compatibility interface of the BigModel platform/Z.ai platform, this is null.

Fix #749

Motivation and Context

Breaking Changes


Type of the changes

  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Documentation update
  • [ ] Tests improvement
  • [ ] Refactoring

Checklist

  • [x] The pull request has a description of the proposed change
  • [x] I read the Contributing Guidelines before opening the pull request
  • [x] The pull request uses develop as the base branch
  • [ ] Tests for the changes have been added
  • [ ] All new and existing tests passed
Additional steps for pull requests adding a new feature
  • [ ] An issue describing the proposed change exists
  • [x] The pull request includes a link to the issue
  • [ ] The change was discussed and approved in the issue
  • [ ] Docs have been added / updated

adamglin0 avatar Sep 06 '25 03:09 adamglin0

Hi, @adamglin0 , thank you very much for the fix. Would it be possible to add deserialization test to avoid regressions in the future. Is there any known json response that could be used for testing?

Also, would it be more correct to define a default value for the objectType instead of making it optional? It would keep compatibility with calling code.

There is a helper you might want to use for deserialization testing.

Thank you for your reply!

If I set a default value for objectType, it cannot meet the verifyDeserialization requirement when theobject is absent from the payload json . Do you have any good suggestions?

adamglin0 avatar Sep 06 '25 07:09 adamglin0