Skip to content

Commit

Permalink
refactor(client.go): remove modelTokens map and its usage to simplify…
Browse files Browse the repository at this point in the history
… Client configuration logic
  • Loading branch information
bounoable committed Apr 26, 2024
1 parent d85cb3d commit 1ae0f21
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions openai/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ const (
DefaultChunkTimeout = 5 * time.Second
)

var modelTokens = map[string]int{
openai.GPT3Dot5Turbo: 4096,
openai.GPT3Dot5Turbo16K: 16384,
openai.GPT4: 8192,
openai.GPT432K: 32768,
"default": 4096,
}

// Client is a configurable interface to the OpenAI API. It allows for the
// generation of text completions using various models, with adjustable
// parameters for token count, temperature, and topP. A specified timeout can be
Expand Down Expand Up @@ -172,11 +164,6 @@ func New(apiToken string, opts ...Option) *Client {
c.model = DefaultModel
}

var ok bool
if c.maxTokens, ok = modelTokens[c.model]; !ok {
c.maxTokens = modelTokens["default"]
}

c.debug("Model: %s", c.model)
c.debug("Temperature: %f", c.temperature)
c.debug("TopP: %f", c.topP)
Expand Down

0 comments on commit 1ae0f21

Please sign in to comment.