-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lots of cleanup and improvements to make the code more Swifty. A prim…
…ary example is changing all snake_case variables to camelCase.
- Loading branch information
1 parent
7396266
commit 4fd959b
Showing
2 changed files
with
29 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
// Created by B.T. Franklin on 4/15/23 | ||
|
||
struct ChatCompletionResponse: Codable { | ||
struct Choice: Codable { | ||
let message: ChatMessage | ||
} | ||
let choices: [Choice] | ||
} | ||
|
||
public struct ChatCompletionRequest: Codable { | ||
public let model: Model | ||
public let temperature: Percentage | ||
public let top_p: Percentage? | ||
public let topP: Percentage? | ||
public let stop: [String]? | ||
public let presence_penalty: Penalty? | ||
public let frequency_penalty: Penalty? | ||
public let presencePenalty: Penalty? | ||
public let frequencyPenalty: Penalty? | ||
public let user: String? | ||
public let messages: [ChatMessage] | ||
} | ||
|
||
public struct ChatMessage: Codable { | ||
public let role: ChatRole | ||
public enum Role: String, Codable { | ||
case system | ||
case user | ||
case assistant | ||
} | ||
public let role: Role | ||
public let content: String | ||
} | ||
|
||
public enum ChatRole: String, Codable { | ||
case system | ||
case user | ||
case assistant | ||
} |