While reviewing the AzureOpenAIEndpoint class, I noticed that header generation proceeds without validating whether the API key or Entra ID token (this._apiKey) is actually present.
To improve defensive programming and fail early with a clear error when credentials are missing, I'd like to introduce a guard clause at the beginning of the getExtraHeaders() method.
Proposed Changes:
- Add a check for
this._apiKey in getExtraHeaders() to throw an explicit error if missing.
While reviewing the
AzureOpenAIEndpointclass, I noticed that header generation proceeds without validating whether the API key or Entra ID token (this._apiKey) is actually present.To improve defensive programming and fail early with a clear error when credentials are missing, I'd like to introduce a guard clause at the beginning of the
getExtraHeaders()method.Proposed Changes:
this._apiKeyingetExtraHeaders()to throw an explicit error if missing.