Skip to content

Commit de9a632

Browse files
authored
Add the rest of the Chat Completion fields (#92)
Per https://platform.openai.com/docs/api-reference/chat/create
1 parent b0b26af commit de9a632

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

chat.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,18 @@ type ChatCompletionMessage struct {
1919

2020
// ChatCompletionRequest represents a request structure for chat completion API.
2121
type ChatCompletionRequest struct {
22-
Model string `json:"model"`
23-
Messages []ChatCompletionMessage `json:"messages"`
22+
Model string `json:"model"`
23+
Messages []ChatCompletionMessage `json:"messages"`
24+
MaxTokens int `json:"max_tokens,omitempty"`
25+
Temperature float32 `json:"temperature,omitempty"`
26+
TopP float32 `json:"top_p,omitempty"`
27+
N int `json:"n,omitempty"`
28+
Stream bool `json:"stream,omitempty"`
29+
Stop []string `json:"stop,omitempty"`
30+
PresencePenalty float32 `json:"presence_penalty,omitempty"`
31+
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
32+
LogitBias map[string]int `json:"logit_bias,omitempty"`
33+
User string `json:"user,omitempty"`
2434
}
2535

2636
type ChatCompletionChoice struct {

0 commit comments

Comments
 (0)