[ 
https://issues.apache.org/jira/browse/FLINK-41657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155237#comment-18155237
 ] 

Ravi Prakash Meena commented on FLINK-41657:
--------------------------------------------

Hi, I have a fix with tests ready for this: a 'length' or 'content_filter' 
finish reason goes through the existing error-handling-strategy. Could a 
committer assign this to me so I can open the PR? Happy to put the new check 
behind an option if a default change is a concern.
Drafted with help from Claude Code.

> 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
>            Priority: Minor
>
> {{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