MCPcopy Create free account
hub / github.com/appleboy/CodeGPT / WithMaxTokens

Function WithMaxTokens

provider/openai/options.go:97–104  ·  view source on GitHub ↗

WithMaxTokens returns a new Option that sets the max tokens for the client configuration. The maximum number of tokens to generate in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length.

(val int)

Source from the content-addressed store, hash-verified

95// The maximum number of tokens to generate in the chat completion.
96// The total length of input tokens and generated tokens is limited by the model's context length.
97func WithMaxTokens(val int) Option {
98 if val <= 0 {
99 val = defaultMaxTokens
100 }
101 return optionFunc(func(c *config) {
102 c.maxTokens = val
103 })
104}
105
106// WithTemperature returns a new Option that sets the temperature for the client configuration.
107// What sampling temperature to use, between 0 and 2.

Callers 1

NewOpenAIFunction · 0.92

Calls 1

optionFuncFuncType · 0.70

Tested by

no test coverage detected