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

   ## @task.llm_branch / LLMBranchOperator
   
   LLM-powered branching — the LLM decides which downstream task(s) to execute 
based on data characteristics or analysis results.
   
   ### What
   
   Extends `BaseBranchOperator`. The LLM analyzes the prompt and returns one or 
more `task_id`s to execute. Enables intelligent routing in DAGs without 
hardcoded conditional logic.
   
   ### Design
   
   - Inherits from `BaseBranchOperator` for standard Airflow branch semantics
   - LLM output is parsed to extract valid `task_id`(s) from the downstream 
tasks
   - `allow_multiple_branches=True` for fan-out decisions
   - Same system prompt / safety patterns as LLMOperator
   - Validation: returned task_ids must exist in the DAG
   
   ### Use Cases
   
   - Route data processing based on content type (CSV → parser_a, JSON → 
parser_b)
   - Intelligent error handling (transient → retry, permanent → alert, unknown 
→ human review)
   - Dynamic workflow selection based on data quality assessment results
   - A/B testing different processing pipelines based on data characteristics
   
   ### Example
   
   ```python
   @task.llm_branch(llm_conn_id="openai_default")
   def route_by_data_quality(quality_report: dict):
       return f"""Based on this quality report: {quality_report}
       Choose: clean_path, needs_repair, or manual_review"""
   
   route_by_data_quality() >> [clean_path(), needs_repair(), manual_review()]
   ```
   
   ### Dependencies
   
   - LLMOperator (merged)
   
   ### Phase
   
   Phase 2.5


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