aallam / openai-kotlin

OpenAI API client for Kotlin with multiplatform and coroutines capabilities.
MIT License
1.5k stars 180 forks source link

Default `ChatChunk.finishReason` to null #358

Closed Him188 closed 5 months ago

Him188 commented 5 months ago
Q A
Bug fix? yes
New feature? no
BC breaks? no
Related Issue

Describe your change

Default ChatChunk.finishReason to null. This should allow us to support more service providers.

What problem is this fixing?

Currently, ChatChunk.finishReason is declared as nullable but does not have a default value. Serialization complains that the field is missing.

Caused by: [CIRCULAR REFERENCE: com.aallam.openai.api.exception.OpenAIHttpException: Field 'finish_reason' is required for type with serial name 'com.aallam.openai.api.chat.ChatChunk', but it was missing at path: $.choices[0]]