ravismash opened a new issue, #77907:
URL: https://github.com/apache/airflow/issues/77907

   ### Description
   
   `LLMBatchOperator` / `@task.llm_batch` (common.ai) mark a row 
`invalid_output` when the model's answer does not match `output_type`, and 
`error` when the provider rejected it. Nothing re-asks those rows. With 
`fail_on_partial_error=True`, a task retry re-lands the same results without 
resubmitting (llm_batch.py `_raise_if_partial`), so the bad rows can never be 
fixed by a retry. The only option today is a hand-written downstream task that 
rebuilds requests from the JSONL.
   
   The sync path already handles this: `LLMOperator` passes `output_retries` to 
the agent, which re-asks with the validation error. The batch path has no 
equivalent.
   
   **Proposal**
   
   Add an opt-in `repair_rounds: int = 0` (name open for discussion). After the 
batch lands, if any rows are `invalid_output` (and optionally `error`), submit 
a follow-up batch with only those rows. For an invalid row, the request 
includes the previous raw output and the validation error, like 
`output_retries` does. Merge the results back by index into the same 
`result_path`. Record each round in the existing batch state so a retry 
re-attaches to the round in progress instead of paying again. The manifest 
counts each round, and `fail_on_partial_error` applies after the last round.
   
   A smaller first step could be public helpers that rebuild the failed rows 
(with the validation error) and merge a second run back into the results. The 
in-operator rounds would come after that. Happy to go with whichever shape you 
prefer.
   
   ### Use case/motivation
   
   Large labeling and extraction runs. At a 1-3% schema failure rate, 50k rows 
leave 500-1500 rows that need manual handling today.
   
   ### Related issues
   
   #72938 (deferrable batch mode)
   
   ### Are you willing to submit a 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://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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]

  • [I] LLMBatchOperator: re-ask o... ravismash (via GitHub) via commits

Reply via email to