MaxTokensError
Defined in: src/errors.ts:58
Error thrown when the model reaches its maximum token limit during generation.
This error indicates that the model stopped generating content because it reached the maximum number of tokens allowed for the response. This is an unrecoverable state that requires intervention, such as reducing the input size or adjusting the max tokens parameter.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MaxTokensError(message, partialMessage): MaxTokensError;Defined in: src/errors.ts:71
Creates a new MaxTokensError.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
message | string | Error message describing the max tokens condition |
partialMessage | Message | The partial assistant message generated before the limit |
Returns
Section titled “Returns”MaxTokensError
Overrides
Section titled “Overrides”Properties
Section titled “Properties”partialMessage
Section titled “partialMessage”readonly partialMessage: Message;Defined in: src/errors.ts:63
The partial assistant message that was generated before hitting the token limit. This can be useful for understanding what the model was trying to generate.