@@ -109,22 +109,25 @@ func checkPromptType(prompt any) bool {
109109
110110// CompletionRequest represents a request structure for completion API.
111111type CompletionRequest struct {
112- Model string `json:"model"`
113- Prompt any `json:"prompt,omitempty"`
114- Suffix string `json:"suffix,omitempty"`
115- MaxTokens int `json:"max_tokens,omitempty"`
116- Temperature float32 `json:"temperature,omitempty"`
117- TopP float32 `json:"top_p,omitempty"`
118- N int `json:"n,omitempty"`
119- Stream bool `json:"stream,omitempty"`
120- LogProbs int `json:"logprobs,omitempty"`
121- Echo bool `json:"echo,omitempty"`
122- Stop []string `json:"stop,omitempty"`
123- PresencePenalty float32 `json:"presence_penalty,omitempty"`
124- FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
125- BestOf int `json:"best_of,omitempty"`
126- LogitBias map [string ]int `json:"logit_bias,omitempty"`
127- User string `json:"user,omitempty"`
112+ Model string `json:"model"`
113+ Prompt any `json:"prompt,omitempty"`
114+ Suffix string `json:"suffix,omitempty"`
115+ MaxTokens int `json:"max_tokens,omitempty"`
116+ Temperature float32 `json:"temperature,omitempty"`
117+ TopP float32 `json:"top_p,omitempty"`
118+ N int `json:"n,omitempty"`
119+ Stream bool `json:"stream,omitempty"`
120+ LogProbs int `json:"logprobs,omitempty"`
121+ Echo bool `json:"echo,omitempty"`
122+ Stop []string `json:"stop,omitempty"`
123+ PresencePenalty float32 `json:"presence_penalty,omitempty"`
124+ FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
125+ BestOf int `json:"best_of,omitempty"`
126+ // LogitBias is must be a token id string (specified by their token ID in the tokenizer), not a word string.
127+ // incorrect: `"logit_bias":{"You": 6}`, correct: `"logit_bias":{"1639": 6}`
128+ // refs: https://platform.openai.com/docs/api-reference/completions/create#completions/create-logit_bias
129+ LogitBias map [string ]int `json:"logit_bias,omitempty"`
130+ User string `json:"user,omitempty"`
128131}
129132
130133// CompletionChoice represents one of possible completions.
0 commit comments