API Reference
FinishReason
Defined in: types/finish-reason.ts:26
Why a model turn ended — the wire finish_reason from the provider.
Remarks
Part of the OpenAI chat-completions contract, surfaced here so the loop and callers can tell a clean finish apart from a degraded one rather than treating "no tool calls" as a blanket "done":
- stop — the model finished on its own; a final answer.
- tool_calls — the model wants tools run; the loop continues.
- length — output hit the token cap and was TRUNCATED; the turn is incomplete, not a real answer.
- content_filter — the provider withheld content.
The loop still drives continuation off the presence of tool calls (the two agree in practice); this value is recorded on the assistant turn so truncation and filtering are observable instead of silently passing as success.
Enumeration Members
| Enumeration Member | Value | Description | Defined in |
|---|---|---|---|
ContentFilter | "content_filter" | The provider's content filter withheld part or all of the output. | types/finish-reason.ts:34 |
Length | "length" | Output hit the max-tokens cap and was truncated mid-turn (incomplete). | types/finish-reason.ts:32 |
Stop | "stop" | The model stopped on its own — a complete final answer. | types/finish-reason.ts:28 |
ToolCalls | "tool_calls" | The model wants one or more tools run before it can continue. | types/finish-reason.ts:30 |