Contents

maximumResponseTokens

The maximum number of tokens the model is allowed to produce in its response.

Declaration

var maximumResponseTokens: Int?

Mentioned in

Discussion

If the model produces maximumResponseTokens before it naturally completes its response, the framework terminates the response early, without throwing an error. Use this property to protect against unexpectedly verbose responses and runaway generations.

If no value is specified, then the model is allowed to produce the longest answer its context size supports. If the response exceeds that limit without terminating, the framework throws an error.

See Also

Configuring options