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

   The `@task.llm`, `@task.agent`, `@task.llm_sql`, `@task.llm_branch`,
   `@task.llm_schema_compare` and `@task.llm_file_analysis` decorators called
   `render_template_fields()` after running the decorated function. Airflow 
already
   renders template fields before `execute()`, so this was a second pass over 
every
   template field. For `prompt` it was the only pass that saw the text the 
function
   returned, because `prompt` is still a placeholder during the first one.
   
   As a result, ordinary text containing braces was changed before it reached 
the
   model. `{{ 100 * 3 }}` arrived as `300`, `{{ var.value.x }}` was resolved, 
and an
   unbalanced `{% raw %}` failed the task with a `TemplateSyntaxError` on 
`prompt`.
   For example, a support-ticket triage task fed customer text that quoted a 
template
   snippet.
   
   The returned text is now sent as is, which is how `@task.llm_batch` already
   behaves. Other parameters such as `system_prompt` are still rendered once, 
before
   `execute()`, and are no longer rendered twice. Anyone who relied on 
returning Jinja
   from the function should put it in a templated parameter or format the string
   inside the function. The docs for each decorator now say so.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (Claude Code, model claude-sonnet-5-5)
   
   Generated-by: Claude Code (claude-sonnet-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]

Reply via email to