Skip to content

Commit 2c6889e

Browse files
authored
1 parent 1880333 commit 2c6889e

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

completion.go

+17-16
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,26 @@ func checkPromptType(prompt any) bool {
138138

139139
// CompletionRequest represents a request structure for completion API.
140140
type CompletionRequest struct {
141-
Model string `json:"model"`
142-
Prompt any `json:"prompt,omitempty"`
143-
Suffix string `json:"suffix,omitempty"`
144-
MaxTokens int `json:"max_tokens,omitempty"`
145-
Temperature float32 `json:"temperature,omitempty"`
146-
TopP float32 `json:"top_p,omitempty"`
147-
N int `json:"n,omitempty"`
148-
Stream bool `json:"stream,omitempty"`
149-
LogProbs int `json:"logprobs,omitempty"`
150-
Echo bool `json:"echo,omitempty"`
151-
Stop []string `json:"stop,omitempty"`
152-
PresencePenalty float32 `json:"presence_penalty,omitempty"`
153-
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
154-
BestOf int `json:"best_of,omitempty"`
141+
Model string `json:"model"`
142+
Prompt any `json:"prompt,omitempty"`
143+
BestOf int `json:"best_of,omitempty"`
144+
Echo bool `json:"echo,omitempty"`
145+
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
155146
// LogitBias is must be a token id string (specified by their token ID in the tokenizer), not a word string.
156147
// incorrect: `"logit_bias":{"You": 6}`, correct: `"logit_bias":{"1639": 6}`
157148
// refs: https://platform.openai.com/docs/api-reference/completions/create#completions/create-logit_bias
158-
LogitBias map[string]int `json:"logit_bias,omitempty"`
159-
User string `json:"user,omitempty"`
149+
LogitBias map[string]int `json:"logit_bias,omitempty"`
150+
LogProbs int `json:"logprobs,omitempty"`
151+
MaxTokens int `json:"max_tokens,omitempty"`
152+
N int `json:"n,omitempty"`
153+
PresencePenalty float32 `json:"presence_penalty,omitempty"`
154+
Seed *int `json:"seed,omitempty"`
155+
Stop []string `json:"stop,omitempty"`
156+
Stream bool `json:"stream,omitempty"`
157+
Suffix string `json:"suffix,omitempty"`
158+
Temperature float32 `json:"temperature,omitempty"`
159+
TopP float32 `json:"top_p,omitempty"`
160+
User string `json:"user,omitempty"`
160161
}
161162

162163
// CompletionChoice represents one of possible completions.

0 commit comments

Comments
 (0)