feature/Pipellm-returns-empty-text · L-260903-2b8290

Merged
LC
13d ago
+2463-92

Every LLM worker now reads its provider's stop signal through one classifier in `pipelex/cogt/llm/completion_stop.py`, so a completion cut at its token cap or context window, refused, filtered or blocked fails its pipe with `LLMCompletionTruncatedError` or `LLMCompletionRefusedError` instead of passing an empty or partial text as a success. Each error tells a person and an agent what happened and what to change, the billed usage of a refused answer is still reported once, and the Anthropic worker logs when it lowers a structured output's cap. A normal stop and every configured retry behave as before.

Closes L-260903-2b8290

🤖 Generated with Claude Code


Summary by cubic

LLM workers now classify provider stop signals and fail pipes with LLMCompletionTruncatedError or LLMCompletionRefusedError instead of returning incomplete, refused, or filtered text as a success.

  • Both errors are non-retryable input content errors with a change_input next step; messages identify the model, pipe, and stop value without exposing partial text.
  • Truncation guidance distinguishes max_tokens from the context window, and advises setting a limit when none was sent.
  • Billed usage is reported once for refused or truncated answers; Anthropic logs lowered structured-output limits only when relevant to an error or timeout.
  • Normal stops and configured retries remain unchanged.

Closes L-260903-2b8290