Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(response_format): Add response_format field and values #534

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ const (
CodexCodeDavinci001 = "code-davinci-001"
)

// Response formats for the completion API.
const (
// JSON format.
CompletionResponseFormatJSON = "json_object"
CompletionResponseFormatText = "text"
)

var disabledModelsForEndpoints = map[string]map[string]bool{
"/completions": {
GPT3Dot5Turbo: true,
Expand Down Expand Up @@ -129,6 +136,7 @@ type CompletionRequest struct {
PresencePenalty float32 `json:"presence_penalty,omitempty"`
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
BestOf int `json:"best_of,omitempty"`
ResponseFormat string `json:"response_format,omitempty"`
// LogitBias is must be a token id string (specified by their token ID in the tokenizer), not a word string.
// incorrect: `"logit_bias":{"You": 6}`, correct: `"logit_bias":{"1639": 6}`
// refs: https://platform.openai.com/docs/api-reference/completions/create#completions/create-logit_bias
Expand Down
Loading