Skip to content

Commit

Permalink
Merge pull request #15 from tomdai/add-enum-chat-role
Browse files Browse the repository at this point in the history
Add enum `Chat.Role`…
  • Loading branch information
Krivoblotsky authored Mar 10, 2023
2 parents d0493cf + 35d97bf commit 6337cba
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/OpenAI/OpenAI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,20 @@ public extension OpenAI {
public let role: String
public let content: String

public enum Role: String {
case system
case assistant
case user
}

public init(role: String, content: String) {
self.role = role
self.content = content
}

public init(role: Role, content: String) {
self.init(role: role.rawValue, content: content)
}
}

struct ChatQuery: Codable {
Expand Down

0 comments on commit 6337cba

Please sign in to comment.