Skip to content

Commit 318c23c

Browse files
Merge pull request #127 from glyuck/fix_message_parameter
Fix MessageParameter for "Create message" request
2 parents 75b8f09 + 9630e13 commit 318c23c

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

Sources/OpenAI/Public/Parameters/Message/MessageParameter.swift

+1-21
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public struct MessageParameter: Encodable {
5050

5151
/// Enum to represent different content parts (text, image URL, image file).
5252
public enum ContentItem: Encodable {
53-
case text(Text)
53+
case text(String)
5454
case imageURL(ImageURL)
5555
case imageFile(ImageFile)
5656

@@ -77,26 +77,6 @@ public struct MessageParameter: Encodable {
7777
}
7878
}
7979

80-
/// Struct representing a text content part.
81-
public struct Text: Encodable {
82-
let text: String
83-
84-
public init(text: String) {
85-
self.text = text
86-
}
87-
88-
enum CodingKeys: String, CodingKey {
89-
case type
90-
case text
91-
}
92-
93-
public func encode(to encoder: Encoder) throws {
94-
var container = encoder.container(keyedBy: CodingKeys.self)
95-
try container.encode("text", forKey: .type)
96-
try container.encode(text, forKey: .text)
97-
}
98-
}
99-
10080
/// References an image URL in the content of a message.
10181
public struct ImageURL: Encodable {
10282

0 commit comments

Comments
 (0)