ColtenOuO opened a new pull request, #70441: URL: https://github.com/apache/airflow/pull/70441
## Summary `LangChainHook`'s docstring already flagged this gap: "Providers with bespoke auth (AWS Bedrock, Google Vertex AI / GenAI, Azure OpenAI, Cohere, HuggingFace) reject these kwargs; per-vendor subclasses can be added later mirroring the pydantic-ai pattern." `PydanticAIHook` already has that pattern (`PydanticAIAzureHook`/`PydanticAIBedrockHook`/`PydanticAIVertexHook`, each overriding `_get_provider_kwargs`) -- this PR adds the first LangChain equivalent. Without it, `LangChainHook` always calls `init_chat_model(model, api_key=..., base_url=...)`, but Azure OpenAI's LangChain classes (`AzureChatOpenAI`, `AzureOpenAIEmbeddings`) don't accept `base_url` -- they need `azure_endpoint` and `api_version`. Verified against the real `langchain-openai` package: those are the actual constructor fields/aliases. ## Changes - `LangChainHook._connection_kwargs`: `@staticmethod` -> instance method, so subclasses can override it (matches `PydanticAIHook`'s `_get_provider_kwargs`). No behavior change for the base class. - Add `LangChainAzureHook(LangChainHook)`, overriding `_connection_kwargs` to map `conn.host` -> `azure_endpoint` and read `api_version` from `conn.extra`. - Register the new `langchain-azure` connection type in `provider.yaml`; regenerated `get_provider_info.py` via `breeze release-management prepare-provider-documentation --reapply-templates-only --skip-changelog --skip-readme` (not hand-edited). ## Test plan - Added 7 tests: class attributes, UI field behaviour, `host -> azure_endpoint` mapping, `api_version` from extra, embedding model uses the same mapping, empty kwargs when no credentials set. - Full `test_langchain.py` passes (28 passed). - `ruff format`/`ruff check`, `breeze run mypy` clean (mypy caught the staticmethod/instance-method override incompatibility, since fixed). - `scripts/ci/prek/check_provider_yaml_files.py` passes: `LangChainAzureHook` registered correctly, 0 errors. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Sonnet 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]
