Skip to content

Commit

Permalink
fix(messages): content as image file (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
aallam authored Apr 1, 2024
1 parent 6527123 commit 99337b1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- **Audio**: add `timestampGranularities` (thanks @mxwell)

### Fixed

- **Messages**: nullable field `MessageContent.Image#fileId` (#313)

## 3.7.0

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.aallam.openai.api.message

import com.aallam.openai.api.file.FileId
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* References an image File in the content of a message.
*/
@Serializable
public data class ImageFile(
/**
* The File ID of the image in the message content.
*/
@SerialName("file_id") val fileId: FileId
)
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public sealed interface MessageContent {
/**
* The File ID of the image in the message content.
*/
@SerialName("file_id") val fileId: FileId
@SerialName("image_file") val imageFile: ImageFile
) : MessageContent

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.aallam.openai.api.message

import com.aallam.openai.api.BetaOpenAI
import com.aallam.openai.api.file.FileId
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
Expand All @@ -13,13 +14,13 @@ public data class MessageFile(
/**
* The identifier, which can be referenced in API endpoints.
*/
val id: FileId,
@SerialName("id") val id: FileId,
/**
* The Unix timestamp (in seconds) for when the message file was created.
*/
val createdAt: Int? = null,
@SerialName("created_at") val createdAt: Int? = null,
/**
* The ID of the message that the File is attached to.
*/
val messageId: MessageId? = null,
@SerialName("message_id") val messageId: MessageId? = null,
)

0 comments on commit 99337b1

Please sign in to comment.