From de9a632138d57e5c507cf83fe3edc557b73a5950 Mon Sep 17 00:00:00 2001 From: Parham Negahdar Date: Thu, 2 Mar 2023 01:06:24 -0500 Subject: [PATCH] Add the rest of the Chat Completion fields (#92) Per https://platform.openai.com/docs/api-reference/chat/create --- chat.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/chat.go b/chat.go index a5ad321..c7d10b0 100644 --- a/chat.go +++ b/chat.go @@ -19,8 +19,18 @@ type ChatCompletionMessage struct { // ChatCompletionRequest represents a request structure for chat completion API. type ChatCompletionRequest struct { - Model string `json:"model"` - Messages []ChatCompletionMessage `json:"messages"` + Model string `json:"model"` + Messages []ChatCompletionMessage `json:"messages"` + 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"` + Stop []string `json:"stop,omitempty"` + PresencePenalty float32 `json:"presence_penalty,omitempty"` + FrequencyPenalty float32 `json:"frequency_penalty,omitempty"` + LogitBias map[string]int `json:"logit_bias,omitempty"` + User string `json:"user,omitempty"` } type ChatCompletionChoice struct {