@@ -22,6 +22,42 @@ extension Completions {
2222 public let bestOf : Percentage ?
2323 public let logitBias : [ Token : Double ] ?
2424 public let user : String ?
25+
26+ public init (
27+ model: Model . ID ,
28+ prompt: Prompt ? = nil ,
29+ suffix: String ? = nil ,
30+ maxTokens: Int ? = nil ,
31+ temperature: Percentage ? = nil ,
32+ topP: Percentage ? = nil ,
33+ n: Percentage ? = nil ,
34+ stream: Bool ? = nil ,
35+ logprobs: Int ? = nil ,
36+ echo: Bool ? = nil ,
37+ stop: [ String ] ? = nil ,
38+ presencePenalty: Penalty ? = nil ,
39+ frequencyPenalty: Penalty ? = nil ,
40+ bestOf: Percentage ? = nil ,
41+ logitBias: [ Token : Double ] ? = nil ,
42+ user: String ? = nil
43+ ) {
44+ self . model = model
45+ self . prompt = prompt
46+ self . suffix = suffix
47+ self . maxTokens = maxTokens
48+ self . temperature = temperature
49+ self . topP = topP
50+ self . n = n
51+ self . stream = stream
52+ self . logprobs = logprobs
53+ self . echo = echo
54+ self . stop = stop
55+ self . presencePenalty = presencePenalty
56+ self . frequencyPenalty = frequencyPenalty
57+ self . bestOf = bestOf
58+ self . logitBias = logitBias
59+ self . user = user
60+ }
2561 }
2662}
2763
@@ -65,6 +101,20 @@ extension Completions {
65101 public let model : Model . ID
66102 public let choices : [ Choice ]
67103 public let usage : Usage
104+
105+ public init (
106+ id: ID ,
107+ created: Date ,
108+ model: Model . ID ,
109+ choices: [ Choice ] ,
110+ usage: Usage
111+ ) {
112+ self . id = id
113+ self . created = created
114+ self . model = model
115+ self . choices = choices
116+ self . usage = usage
117+ }
68118 }
69119
70120 /// One of the completion choices.
@@ -80,5 +130,17 @@ extension Completions {
80130
81131 /// The reason for finishing.
82132 public let finishReason : String
133+
134+ public init (
135+ text: String ,
136+ index: Int ,
137+ logprobs: [ String ] ,
138+ finishReason: String
139+ ) {
140+ self . text = text
141+ self . index = index
142+ self . logprobs = logprobs
143+ self . finishReason = finishReason
144+ }
83145 }
84146}
0 commit comments