Skip to content

Commit

Permalink
Merge pull request #94 from ysak-y/add_uuid_to_chat_message
Browse files Browse the repository at this point in the history
Add id property to ChatMessage to conform to Identifiable protocol
  • Loading branch information
adamrushy committed Jul 11, 2023
2 parents dd98cdf + ef79b8c commit 8d1f308
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/OpenAISwift/Models/ChatMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public enum ChatRole: String, Codable {
}

/// A structure that represents a single message in a chat conversation.
public struct ChatMessage: Codable {
public struct ChatMessage: Codable, Identifiable {
// uuid to conform to Identifiable protocol
public var id = UUID()
/// The role of the sender of the message.
public let role: ChatRole?
/// The content of the message.
Expand Down

1 comment on commit 8d1f308

@rebelyx
Copy link

@rebelyx rebelyx commented on 8d1f308 Oct 5, 2023

Choose a reason for hiding this comment

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

Please rollback this change...

https://platform.openai.com/docs/api-reference/chat/create
The request body should not include this "id"!
Runtime Error: "Additional properties are not allowed ('id' was unexpected) - 'messages.0'"

Please sign in to comment.