KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using finish_reason for Debugging 4D AIKit Responses
PRODUCT: 4D | VERSION: 21 | PLATFORM: Mac & Win
Published On: February 10, 2026
4D AIKit responses include a finish_reason property that reveals why the AI stopped generating. This value can identify common issues like truncated responses, content filtering, etc.

Every response from chat.completions.create() includes a finish_reason property that indicates how the generation ended.

Common finish_reason Values
  • "stop" : Normal completion. The model finished its response naturally.
  • "length" : Response truncated because it hit the max_tokens limit.
  • "content_filter" :The response was omitted due to safety violations.

Check finish_reason first before investigating complex issues. This property provides valuable information about why a response ended.