SEZ9 opened a new issue, #13413:
URL: https://github.com/apache/seatunnel/issues/13413

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Bug%22)
 and found no similar issues. No open PR changes `OpenAIProvider`'s 
finish-reason or reasoning handling.
   
   ### What happened
   
   `seatunnel-cli`'s OpenAI-compatible provider maps every `finish_reason` 
except `tool_calls` to `end_turn`, so a response truncated at the output token 
limit is indistinguishable from a completed one.
   
   `seatunnel_cli/llm_provider.py`, both the streaming and the non-streaming 
path:
   
   ```python
   # chat_stream()
   sr = "tool_use" if choice.finish_reason == "tool_calls" else "end_turn"
   
   # _from_openai_response()
   stop_reason = "end_turn"
   if choice.finish_reason == "tool_calls":
       stop_reason = "tool_use"
   ```
   
   `finish_reason=length` therefore reaches `Orchestrator` as a normal end of 
turn. The caller then parses whatever arrived — a config cut in half, or 
nothing at all — and reports a generic `Failed to generate config.`, with the 
real cause nowhere in the message. `content_filter` is flattened the same way.
   
   This is easiest to hit with a reasoning model: the reasoning consumes the 
whole `max_tokens` budget, `content` comes back empty, and the run fails with 
no indication that the output limit was the problem.
   
   A second, related gap in the same file: the reasoning block is only read 
under `reasoning_content`.
   
   ```python
   reasoning_content = self._get_openai_field(delta, "reasoning_content")
   ```
   
   vLLM's reasoning parser emits the field as `reasoning` from 0.34 on. Against 
such a server the block is silently dropped, and for a server that requires 
reasoning to be replayed after a tool call that becomes a 400 on the following 
request — the failure mode `format_llm_error()` already has a hint for.
   
   ### SeaTunnel Version
   
   dev (`a76348f1f9`)
   
   ### SeaTunnel Config
   
   ```conf
   Not a job config problem: this is in the CLI's LLM provider layer.
   ```
   
   ### Running Command
   
   ```shell
   # Any OpenAI-compatible endpoint whose model hits the output token limit,
   # e.g. a local vLLM reasoning model with a small max_tokens:
   export AI_PROVIDER=openai
   export OPENAI_BASE_URL=http://localhost:8000/v1
   sh bin/seatunnel-ai.sh "sync the users table from MySQL to Console"
   ```
   
   ### Error Exception
   
   ```log
   Failed to generate config.
   ```
   
   ### Zeta or Flink or Spark Version
   
   Not engine specific.
   
   ### Java or Scala Version
   
   Not applicable (Python CLI).
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to