Skip to content

Fix CohereEmbeddingOperator input_text normalization before rendering - #70325

Merged
shahar1 merged 2 commits into
apache:mainfrom
MannXo:fix/cohere-embedding-template-field-init
Jul 24, 2026
Merged

Fix CohereEmbeddingOperator input_text normalization before rendering#70325
shahar1 merged 2 commits into
apache:mainfrom
MannXo:fix/cohere-embedding-template-field-init

Conversation

@MannXo

@MannXo MannXo commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Move the single-string normalization of input_text from __init__ into execute().

input_text is a template field, so it is rendered after the constructor runs. Wrapping a plain string into a list in __init__ acts on the un-rendered Jinja expression, so a templated input_text (for example one that resolves to a list under native rendering) is normalized before it is ever rendered. Doing it in execute() operates on the rendered value.

Part of the template-field constructor burn-down; removes the CohereEmbeddingOperator entry from scripts/ci/prek/validate_operators_init_exemptions.txt in the same PR, as the hook requires.

related: #70296


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

input_text is a template field, rendered after __init__ runs. Wrapping a
single string into a list in the constructor acts on the un-rendered Jinja
expression, so a templated input_text is mis-wrapped before it resolves.
Move the normalization into execute() so it runs on the rendered value.
@boring-cyborg

boring-cyborg Bot commented Jul 23, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@shahar1 shahar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!
For next times - please ask your LLM to reduce amount of comments (the top comment in execute isn't necessary).
I resolved a conflict with the text file.

@shahar1 shahar1 removed the backport-to-v3-3-test Backport to v3-3-test label Jul 24, 2026
@shahar1
shahar1 merged commit 378541b into apache:main Jul 24, 2026
1 check passed
@boring-cyborg

boring-cyborg Bot commented Jul 24, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants