Skip to content

Commit

Permalink
fix add missing max_token in request query
Browse files Browse the repository at this point in the history
  • Loading branch information
nopeless committed Mar 19, 2024
1 parent 6326ff0 commit 5de0bcc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"encoding/json"
"errors"
"fmt"
"strings"
"unicode/utf8"

"github.com/kardolus/chatgpt-cli/config"
"github.com/kardolus/chatgpt-cli/configmanager"
"github.com/kardolus/chatgpt-cli/history"
"github.com/kardolus/chatgpt-cli/http"
"github.com/kardolus/chatgpt-cli/types"
"strings"
"unicode/utf8"
)

const (
Expand Down Expand Up @@ -163,6 +164,7 @@ func (c *Client) createBody(stream bool) ([]byte, error) {
body := types.CompletionsRequest{
Messages: c.History,
Model: c.Config.Model,
MaxTokens: c.Config.MaxTokens,
Temperature: c.Config.Temperature,
TopP: c.Config.TopP,
FrequencyPenalty: c.Config.FrequencyPenalty,
Expand Down
1 change: 1 addition & 0 deletions types/completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type CompletionsRequest struct {
Temperature float64 `json:"temperature"`
TopP float64 `json:"top_p"`
FrequencyPenalty float64 `json:"frequency_penalty"`
MaxTokens int `json:"max_tokens"`
PresencePenalty float64 `json:"presence_penalty"`
Messages []Message `json:"messages"`
Stream bool `json:"stream"`
Expand Down

0 comments on commit 5de0bcc

Please sign in to comment.