Kaynağa Gözat

Bumping go-openai to 1.27.0 and enabling gpt4omini

Karol Sokolowski 1 yıl önce
ebeveyn
işleme
4fe913efe9
3 değiştirilmiş dosya ile 6 ekleme ve 6 silme
  1. 3 3
      chatgpt.go
  2. 1 1
      go.mod
  3. 2 2
      go.sum

+ 3 - 3
chatgpt.go

@@ -38,8 +38,8 @@ func New(ApiKey, UserId string, timeOut time.Duration) *ChatGPT {
 		client:         gogpt.NewClient(ApiKey),
 		ctx:            ctx,
 		userId:         UserId,
-		maxQuestionLen: 2048,  // 最大问题长度
-		maxAnswerLen:   2048,  // 最大答案长度
+		maxQuestionLen: 2048, // 最大问题长度
+		maxAnswerLen:   2048, // 最大答案长度
 		maxText:        4096, // 最大文本 = 问题 + 回答, 接口限制
 		timeOut:        timeOut,
 		doneChan:       timeOutChan,
@@ -74,7 +74,7 @@ func (c *ChatGPT) Chat(question string) (answer string, err error) {
 		question = question[:c.maxText-c.maxAnswerLen]
 	}
 	req := gogpt.CompletionRequest{
-		Model:            gogpt.GPT3Dot5TurboInstruct,
+		Model:            gogpt.GPT4oMini,
 		MaxTokens:        c.maxAnswerLen,
 		Prompt:           question,
 		Temperature:      0.9,

+ 1 - 1
go.mod

@@ -2,4 +2,4 @@ module git.n2.puczat.pl/sokoow/chatgpt
 
 go 1.18
 
-require github.com/sashabaranov/go-openai v1.17.11
+require github.com/sashabaranov/go-openai v1.27.0

+ 2 - 2
go.sum

@@ -1,2 +1,2 @@
-github.com/sashabaranov/go-openai v1.17.11 h1:XVr00J8JymJVx8Hjbh/5mG0V4PQHRarBU3v7k2x6MR0=
-github.com/sashabaranov/go-openai v1.17.11/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
+github.com/sashabaranov/go-openai v1.27.0 h1:L3hO6650YUbKrbGUC6yCjsUluhKZ9h1/jcgbTItI8Mo=
+github.com/sashabaranov/go-openai v1.27.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=