Files
crewAI/lib
Greyson LaLonde ad6d7fa198 fix: re-read Azure env vars in lazy client build
Azure's `_normalize_azure_fields` captures env vars at construction
time. When `LLM(model="azure/...")` is instantiated before deployment
env vars are set, `self.api_key` / `self.endpoint` freeze as `None`
and the lazy client builder then always raises — defeating the point
of deferred init for Azure.

Re-read `AZURE_API_KEY` / `AZURE_ENDPOINT` (and friends) inside
`_make_client_kwargs` when the fields are still unset, matching
OpenAI's `_get_client_params` pattern. Runs the endpoint validator
on any env-provided value so the same normalization applies.

Add a regression test that constructs the LLM with no env vars set,
then patches them in afterwards and asserts `_get_sync_client()`
successfully builds a client and writes the resolved values back
onto the LLM instance.
2026-04-12 04:46:39 +08:00
..
2026-04-10 21:51:51 +08:00