Ravi Prakash Meena created FLINK-41657:
------------------------------------------

             Summary: OpenAI chat model function ignores finish_reason, so 
truncated answers are returned as complete rows
                 Key: FLINK-41657
                 URL: https://issues.apache.org/jira/browse/FLINK-41657
             Project: Flink
          Issue Type: Bug
          Components: Library / Machine Learning
            Reporter: Ravi Prakash Meena


{{OpenAIChatModelFunction#convertToRowData}} (flink-model-openai, 
OpenAIChatModelFunction.java:114-124) copies each choice's content into the 
output row and never reads {{finish_reason}}.

*Repro:* create an OpenAI chat model with {{'max-tokens' = '5'}} and run 
ML_PREDICT on a long question. The provider returns {{finish_reason = length}}, 
and the cut-off text comes back as a normal row.

*Expected:* a {{length}} or {{content_filter}} finish reason goes through the 
existing {{error-handling-strategy}} (FAILOVER fails the job, IGNORE drops the 
row and reports the reason in the {{error-string}} column).

I have a small fix with tests and would like to work on this if a committer can 
assign it to me.

_Drafted with help from Claude Code._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to