Repository navigation
Let LLMBatchOperator request_params be templated - #74751
Merged
henry3260 merged 1 commit intoOct 15, 2026
Merged
Conversation
``request_params`` carries the same kind of free-form provider body parameters as ``LLMOperator.agent_params``, which is templated, so a Dag author who writes a Jinja expression there reasonably expects it to be rendered. Because the field was missing from ``template_fields``, the expression reached the provider API verbatim and the request failed there, with nothing pointing back at the operator parameter as the cause.
henry3260
marked this pull request as ready for review
October 15, 2026 07:25
henry3260
requested review from
Lee-W,
ashb,
gopidesupavan and
kaxil
as code owners
October 15, 2026 07:25
Lee-W
approved these changes
Oct 15, 2026
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
LLMBatchOperator.request_paramscarries free-form provider body parameters(
temperature,top_k,seed,thinking, ...) merged into every request. It is the batchcounterpart of
LLMOperator.agent_params/AgentOperator.agent_params, both of which are intemplate_fields, so a Dag author who writesrequest_params={"temperature": "{{ params.temp }}"}reasonably expects it to be rendered.
It was not in
template_fields. The Jinja expression stayed a literal string and was sent to theprovider API as the parameter value, which fails at the provider with nothing pointing back at the
operator parameter as the cause.
max_tokensis deliberately left alone. Every scalar numeric parameter in this provider(
max_tokens,poll_interval,timeout,LLMFileAnalysisOperator.max_files) is untemplated;only free-form dicts (
agent_params,embedding_kwargs) and dicts with a known numeric schema(
usage_limits, which also coerces each rendered value) are templated. Templating a bareintwould hand the provider API the string Jinja produced.
What
providers/common/ai/src/airflow/providers/common/ai/operators/llm_batch.py— addrequest_paramstotemplate_fields, and document the templating in its:param:entry.No coercion is applied, matching
agent_params: the keys are provider body parameters whosetypes the operator does not know.
providers/common/ai/docs/operators/llm_batch.rst— document thatrequest_paramsistemplated, that Jinja hands back a string (so a numeric value written as a template needs
render_template_as_native_obj=Trueon the Dag), and that the rendered values feed there-attach fingerprint — the same stability rule that already applies to
result_path.providers/common/ai/tests/unit/common/ai/operators/test_llm_batch.py— addTestTemplateFields: one test pinning thetemplate_fieldsset, one rendering{"temperature": "{{ params.temp }}"}throughrender_template_fields. Both fail without theoperator change.
Was generative AI tooling used to co-author this PR?