You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version 3.4.0 breaks function calling with stream (chatCompletions)
Version 3.3.2 works fine
Steps to Reproduce
com.aallam.openai.api.exception.OpenAIHttpException: Field 'name' is required for type with serial name 'com.aallam.openai.api.chat.FunctionCall', but it was missing at path: $.choices[0].delta.function_call
at com.aallam.openai.client.internal.http.HttpTransport.handleException(HttpTransport.kt:52)
at com.aallam.openai.client.internal.http.HttpTransport.perform(HttpTransport.kt:34)
at com.aallam.openai.client.internal.http.HttpTransport$perform$2.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@3dc0a39, Dispatchers.IO]
Caused by: kotlinx.serialization.MissingFieldException: Field 'name' is required for type with serial name 'com.aallam.openai.api.chat.FunctionCall', but it was missing at path: $.choices[0].delta.function_call
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:93)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:79)
at com.aallam.openai.api.chat.ChatDelta$$serializer.deserialize(ChatDelta.kt:10)
at com.aallam.openai.api.chat.ChatDelta$$serializer.deserialize(ChatDelta.kt:10)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:165)
at com.aallam.openai.api.chat.ChatChunk$$serializer.deserialize(ChatChunk.kt:13)
at com.aallam.openai.api.chat.ChatChunk$$serializer.deserialize(ChatChunk.kt:13)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:165)
at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:533)
at kotlinx.serialization.internal.CollectionLikeSerializer.readElement(CollectionSerializers.kt:80)
at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
2023-08-29 00:32:10.979 31910-32341 AndroidRuntime
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:165)
at com.aallam.openai.api.chat.ChatCompletionChunk$$serializer.deserialize(ChatCompletionChunk.kt:14)
at com.aallam.openai.api.chat.ChatCompletionChunk$$serializer.deserialize(ChatCompletionChunk.kt:14)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
at kotlinx.serialization.json.Json.decodeFromString(Json.kt:107)
at com.aallam.openai.client.internal.api.ChatApi$chatCompletions$1$1.invokeSuspend(ChatApi.kt:56)
at com.aallam.openai.client.internal.api.ChatApi$chatCompletions$1$1.invoke(Unknown Source:8)
at com.aallam.openai.client.internal.api.ChatApi$chatCompletions$1$1.invoke(Unknown Source:4)
at io.ktor.client.statement.HttpStatement.execute(HttpStatement.kt:50)
at io.ktor.client.statement.HttpStatement$execute$1.invokeSuspend(Unknown Source:15)
... 8 more
Caused by: kotlinx.serialization.MissingFieldException: Field 'name' is required for type with serial name 'com.aallam.openai.api.chat.FunctionCall', but it was missing
at kotlinx.serialization.internal.PluginExceptionsKt.throwMissingFieldException(PluginExceptions.kt:20)
at com.aallam.openai.api.chat.FunctionCall.(FunctionCall.kt:11)
at com.aallam.openai.api.chat.FunctionCall$$serializer.deserialize(FunctionCall.kt:11)
at com.aallam.openai.api.chat.FunctionCall$$serializer.deserialize(FunctionCall.kt:11)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
... 40 more
Environment
openai-kotlin version: 3.4.0
Kotlin version: 1.9.10
OS: Android 13
The text was updated successfully, but these errors were encountered:
Description
Version 3.4.0 breaks function calling with stream (chatCompletions)
Version 3.3.2 works fine
Steps to Reproduce
com.aallam.openai.api.exception.OpenAIHttpException: Field 'name' is required for type with serial name 'com.aallam.openai.api.chat.FunctionCall', but it was missing at path: $.choices[0].delta.function_call
at com.aallam.openai.client.internal.http.HttpTransport.handleException(HttpTransport.kt:52)
at com.aallam.openai.client.internal.http.HttpTransport.perform(HttpTransport.kt:34)
at com.aallam.openai.client.internal.http.HttpTransport$perform$2.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@3dc0a39, Dispatchers.IO]
Caused by: kotlinx.serialization.MissingFieldException: Field 'name' is required for type with serial name 'com.aallam.openai.api.chat.FunctionCall', but it was missing at path: $.choices[0].delta.function_call
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:93)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:79)
at com.aallam.openai.api.chat.ChatDelta$$serializer.deserialize(ChatDelta.kt:10)
at com.aallam.openai.api.chat.ChatDelta$$serializer.deserialize(ChatDelta.kt:10)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:165)
at com.aallam.openai.api.chat.ChatChunk$$serializer.deserialize(ChatChunk.kt:13)
at com.aallam.openai.api.chat.ChatChunk$$serializer.deserialize(ChatChunk.kt:13)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:165)
at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:533)
at kotlinx.serialization.internal.CollectionLikeSerializer.readElement(CollectionSerializers.kt:80)
at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
2023-08-29 00:32:10.979 31910-32341 AndroidRuntime
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:165)
at com.aallam.openai.api.chat.ChatCompletionChunk$$serializer.deserialize(ChatCompletionChunk.kt:14)
at com.aallam.openai.api.chat.ChatCompletionChunk$$serializer.deserialize(ChatCompletionChunk.kt:14)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
at kotlinx.serialization.json.Json.decodeFromString(Json.kt:107)
at com.aallam.openai.client.internal.api.ChatApi$chatCompletions$1$1.invokeSuspend(ChatApi.kt:56)
at com.aallam.openai.client.internal.api.ChatApi$chatCompletions$1$1.invoke(Unknown Source:8)
at com.aallam.openai.client.internal.api.ChatApi$chatCompletions$1$1.invoke(Unknown Source:4)
at io.ktor.client.statement.HttpStatement.execute(HttpStatement.kt:50)
at io.ktor.client.statement.HttpStatement$execute$1.invokeSuspend(Unknown Source:15)
... 8 more
Caused by: kotlinx.serialization.MissingFieldException: Field 'name' is required for type with serial name 'com.aallam.openai.api.chat.FunctionCall', but it was missing
at kotlinx.serialization.internal.PluginExceptionsKt.throwMissingFieldException(PluginExceptions.kt:20)
at com.aallam.openai.api.chat.FunctionCall.(FunctionCall.kt:11)
at com.aallam.openai.api.chat.FunctionCall$$serializer.deserialize(FunctionCall.kt:11)
at com.aallam.openai.api.chat.FunctionCall$$serializer.deserialize(FunctionCall.kt:11)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
... 40 more
Environment
The text was updated successfully, but these errors were encountered: