File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import Foundation
22
33public enum ChatGPTModel : String {
4+ case gpt35Turbo = " gpt-3.5-turbo "
5+
6+ case gpt35Turbo0301 = " gpt-3.5-turbo-0301 "
7+
48 case textDavinci003 = " text-davinci-003 "
59
610 case textCurie001 = " text-curie-001 "
711
812 case textBabbage001 = " text-babbage-001 "
913
1014 case textAda001 = " text-ada-001 "
15+ }
1116
12- case codeDavinci002 = " code-davinci-002 "
13-
14- case codeCushman001 = " code-cushman-001 "
15-
16- case textDavinciEdit001 = " text-davinci-edit-001 "
17-
18- case gpt35Turbo = " gpt-3.5-turbo "
19-
20- case gpt35Turbo0301 = " gpt-3.5-turbo-0301 "
17+ extension ChatGPTModel {
18+ var endpoint : String {
19+ switch self {
20+ case . gpt35Turbo:
21+ return " https://api.openai.com/v1/chat/completions "
22+ case . gpt35Turbo0301:
23+ return " https://api.openai.com/v1/chat/completions "
24+ case . textDavinci003:
25+ return " https://api.openai.com/v1/completions "
26+ case . textCurie001:
27+ return " https://api.openai.com/v1/completions "
28+ case . textBabbage001:
29+ return " https://api.openai.com/v1/completions "
30+ case . textAda001:
31+ return " https://api.openai.com/v1/completions "
32+ }
33+ }
34+
35+ var maxToken : Int {
36+ switch self {
37+ case . gpt35Turbo:
38+ return 4096
39+ case . gpt35Turbo0301:
40+ return 4096
41+ case . textDavinci003:
42+ return 4097
43+ case . textCurie001:
44+ return 2049
45+ case . textBabbage001:
46+ return 2049
47+ case . textAda001:
48+ return 2049
49+ }
50+ }
2151}
2252
2353extension ChatGPTModel : CaseIterable { }
You can’t perform that action at this time.
0 commit comments