Skip to content

Conversation

av-runner
Copy link

Q A
Bug fix? yes
New feature? no
BC breaks? no
Related Issue Fix #421

Describe your change

Make the content in the Message Delta Data a list and add needed data models for the possible objects within the list.

What problem is this fixing?

The content in the MessageDeltaData data class, within the Assistant Stream Event was a MessageContent, however the response from OpenAI is a list that might contain 4 different types of objects. I have added the missing data models.

@osmanconger
Copy link

When can we expect this to be merged @aallam?

Copy link

@tashilapathum tashilapathum left a comment

Choose a reason for hiding this comment

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

Without this fix, deserialization would fail for this code:

AssistantStreamEventType.THREAD_MESSAGE_DELTA -> {
    val messageDelta = assistantStreamEvent.getData<MessageDelta>()
    val content = messageDelta.delta.content
}

with the error Expected JsonObject, but had JsonArray as the serialized body of com.aallam.openai.api.message.MessageContent at element: $.delta.content.

@av-runner
Copy link
Author

Hey @aallam, are there any problems you would like me to address or can we merge this?

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

Successfully merging this pull request may close these issues.

Deserialisation of AssistantStreamEventType.THREAD_MESSAGE_DELTA fails
3 participants