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

    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   <!--
   Thank you for contributing!
   
   Please provide above a brief description of the changes made in this pull 
request.
   Write a good git commit message following this guide: 
https://chris.beams.io/posts/git-commit/
   
   Please make sure that your code changes are covered with tests.
   And in case of new features or big changes remember to adjust the 
documentation.
   
   For user-facing UI changes, please attach before/after screenshots (or a 
short
   screen recording) so reviewers can assess the visual impact.
   
   Feel free to ping (in general) for the review if you do not see reaction for 
a few days
   (72 Hours is the minimum reaction time you can expect from volunteers) - we 
sometimes miss notifications.
   
   In case of an existing issue, reference it using one of the following:
   
   * closes: #ISSUE
   * related: #ISSUE
   -->
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, 
please
   change below checkbox to `[X]` followed by the name of the tool, uncomment 
the "Generated-by".
   -->
   
   - [x] Yes claude sonnet
   <!--
   Generated-by: [Tool Name] following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   Raises the anthropic provider's SDK floor to `1.0.0` and removes the 
temporary `<1.0.0` cap added in #72072.
   
   `anthropic 1.0.0` moved the SDK from `httpx` to `httpx2` (Pydantic's fork). 
The cap went in because CI's "MyPy providers checks" started failing on 
unrelated PRs once the environment upgrade pulled 1.0.0 into `uv.lock`, and 
nobody had validated the provider against the new major.
   
   I validated it. Every symbol the provider imports still exists in `1.0.0`, 
including the beta managed-agents types, and all 16 client call paths resolve. 
The existing 204 tests pass against 1.0.0 untouched. Two behaviour changes 
needed code, and
   neither was visible to the test suite.
   
   Changes of note:
   
   1. **Bedrock and AWS region resolution.** `get_conn` passed 
`aws_region=extras.get("aws_region")`, which is `None` when the connection 
extra is unset. On 0.x the SDK warned and defaulted to `us-east-1`. On 1.0 it 
raises `ValueError`, and omitting the argument entirely behaves the same way, 
so the call site could not sidestep it. `_build_aws_client` now translates that 
failure into an `AnthropicError` naming the `aws_region` extra and the 
connection id, so a deployment relying on the old default gets told where to 
fix it. It still passes `None` through when no extra is set, letting the SDK 
resolve from `AWS_REGION` / `AWS_DEFAULT_REGION` or the AWS profile, and it 
re-raises the original `ValueError`
   untouched when a region *was* configured, so an unrelated constructor 
failure is
   not mislabelled.
   
   2. **`temperature`, `top_p` and `top_k` removed from `messages.create`.** 
`create_message` forwards `**kwargs` straight to the SDK, so Dags passing these 
now hit a `TypeError`. I left that deliberately unhandled. The SDK removed them 
because newer models reject them, and `extra_body` is documented as an escape 
hatch for older models only. Rerouting them silently would turn a clear 
`TypeError` into a confusing server-side API error.
   
   3. **Test helper no longer depends on an HTTP library.** `_make_bad_request` 
built an `httpx.Response` to construct a real `BadRequestError`, which is what 
mypy flagged. `APIStatusError` only reads `status_code`, `headers` and 
`request` off the response, so a small stub builds a genuine `BadRequestError` 
on any SDK version. Swapping the
   import to `httpx2` would have moved the version coupling rather than removed 
it. 
   
   
   ### Breaking change
   
   Users on the 0.x SDK must upgrade to `anthropic>=1.0.0`. Bedrock and AWS 
deployments that relied on the implicit `us-east-1` default must now set 
`aws_region` in the connection extra or supply a region through the environment.
   
   ### Testing
   
   207 unit tests pass against the locked `anthropic==1.0.0`. Both new region 
tests fail without the hook change. mypy is clean on the changed files. 
   
   
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


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