hashbrown

FinishReason

Why the model stopped generating in a run, the same set for every provider.

  • stop: the model finished its answer (or hit a stop sequence).
  • length: the answer was cut off by an output token limit or the context window.
  • tool_calls: the model stopped to call tools.
  • content_filter: a provider safety filter or guardrail blocked or cut the answer, or blocked the prompt.
  • refusal: the model declined to answer.
  • other: any other reason; the provider's own reason is kept in the RUN_FINISHED metadata under the provider's key.

API

export type FinishReason =
  "stop" | "length" | "tool_calls" | "content_filter" | "refusal" | "other";