mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-30 07:06:38 +08:00
37 lines
1.4 KiB
Go
37 lines
1.4 KiB
Go
package types
|
|
|
|
type CompletionRequest struct {
|
|
Model string `json:"model" binding:"required"`
|
|
Prompt any `json:"prompt" binding:"required"`
|
|
Suffix string `json:"suffix,omitempty"`
|
|
MaxTokens int `json:"max_tokens,omitempty"`
|
|
Temperature float32 `json:"temperature,omitempty"`
|
|
TopP float32 `json:"top_p,omitempty"`
|
|
N int `json:"n,omitempty"`
|
|
Stream bool `json:"stream,omitempty"`
|
|
LogProbs int `json:"logprobs,omitempty"`
|
|
Echo bool `json:"echo,omitempty"`
|
|
Stop []string `json:"stop,omitempty"`
|
|
PresencePenalty float32 `json:"presence_penalty,omitempty"`
|
|
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
|
|
BestOf int `json:"best_of,omitempty"`
|
|
LogitBias any `json:"logit_bias,omitempty"`
|
|
User string `json:"user,omitempty"`
|
|
}
|
|
|
|
type CompletionChoice struct {
|
|
Text string `json:"text"`
|
|
Index int `json:"index"`
|
|
FinishReason string `json:"finish_reason"`
|
|
LogProbs any `json:"logprobs,omitempty"`
|
|
}
|
|
|
|
type CompletionResponse struct {
|
|
ID string `json:"id"`
|
|
Object string `json:"object"`
|
|
Created int64 `json:"created"`
|
|
Model string `json:"model"`
|
|
Choices []CompletionChoice `json:"choices"`
|
|
Usage *Usage `json:"usage,omitempty"`
|
|
}
|