ravismash opened a new pull request, #77908:
URL: https://github.com/apache/airflow/pull/77908

   <!-- claude-projects-attribution: {"github_login":"ravismash"} -->
   _Requested by **Ravi** · [project 
thread](https://claude.ai/code/project/chan_01AnxMWGzhRWeKLVvuxdesQv?thread=cmsg_01AnxMWGzhRWeKLVvuxdesQvFe5AtVxpBk7aAGaZWWKFX1)_
   
   Adds two experimental helpers to `airflow.providers.common.ai.batch.repair` 
for re-asking the rows of a landed `LLMBatchOperator` batch that did not 
produce a valid result.
   
   A batch has no conversation to retry in, so `output_retries` does not apply, 
and a retry of the task re-lands the same results. Today the only way to fix 
`invalid_output` rows is a hand-written task.
   
   - `plan_repair(requests, rows)` picks every non-`success` row (or the 
statuses passed) and builds the second batch's requests. An `invalid_output` 
request gets the previous answer and the validation error added to its prompt, 
the same feedback `output_retries` gives `LLMOperator`. It returns 
`{"requests": [...], "indexes": [...]}`, which can go through XCom.
   - `merge_repair(rows, repaired_rows, indexes)` puts the second batch's 
`success` rows back at their original indexes and keeps the original 
`custom_id`. A repair that fails again leaves the original row in place.
   
   Both are pure functions on the JSONL rows, so nothing in the operator, the 
batch state file or the adapters changes. A new example Dag 
(`example_llm_batch_repair`) and a docs section show the chain: batch, plan, 
repair batch, merge.
   
   This is the smaller first step from #77907. Running repair rounds inside the 
operator can build on it if wanted.
   
   related: #77907
   
   Tests: 13 unit tests in `tests/unit/common/ai/batch/test_repair.py`.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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

  • [PR] Add helpers to re-ask fai... ravismash (via GitHub) via commits

Reply via email to