Skip to content

Commit 9b15daf

Browse files
committed
1 parent 727944c commit 9b15daf

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
@@ -132,25 +132,26 @@ func checkPromptType(prompt any) bool {
132132

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

156157
// CompletionChoice represents one of possible completions.

0 commit comments

Comments
 (0)