stop reason

The field in a model reply that says why generation ended, such as a natural end, the token cap, a stop sequence, a tool call or a refusal.

In more detail

Anthropic's values include end_turn, max_tokens, stop_sequence, tool_use, pause_turn and refusal; OpenAI uses finish_reason with values such as stop, length and tool_calls. Check it before trusting or parsing the text, because a truncated or refused reply can look like a normal one.

Example

"stop_reason": "max_tokens"

Related terms

Taught in

References

Certification courses