FinishReason

FinishReason wraps the possible reasons that a generation model may stop generating tokens. For most PROPER use cases (see best practices), the finish reason will be STOP. When working with streams, finish reason will be null since it has not completed the message yet.

Entries

Link copied to clipboard

STOP is the most common finish reason, and it occurs when the model completely generates its entire message, and has nothing else to add. Ideally, you always want your finish reason to be STOP.

Link copied to clipboard

Occurs when ChatGPT is not able to finish the response within the token limit. When the model reaches the token limit, it returns the incomplete message with finish reason LENGTH. Some models have a higher token limit than others.

Link copied to clipboard

Occurs due to a flag from OpenAI's content filters. This occurrence is rare, and tends to happen when you blatantly violate OpenAI's terms.

Link copied to clipboard

Occurs when the model uses one of the available tools.

Link copied to clipboard

Functions

Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.

Properties

Link copied to clipboard
Link copied to clipboard