Repository: langchain
Issue: AzureOpenAIWhisperParser fails with DefaultAzureCredential due to incorrect token parameter
Labels: 🤖:bug

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.
- [X] I am sure that this is a bug in LangChain rather than my code.
- [X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

### Example Code

```python
from langchain_community.document_loaders.parsers.audio import AzureOpenAIWhisperParser
from langchain_core.documents.base import Blob
from azure.identity import DefaultAzureCredential, get_bearer_token_provider

scope = "https://cognitiveservices.azure.com/.default"

token_provider = get_bearer_token_provider(DefaultAzureCredential(), scope)

parser = AzureOpenAIWhisperParser(
    azure_endpoint="https://example.openai.azure.com/",
    api_version="2024-06-01",
    deployment_name="whisper",
    azure_ad_token_provider=token_provider,
)

audio_path = "audios/sample.mp3"
audio_blob = Blob(path=audio_path)

documents = parser.lazy_parse(blob=audio_blob)

for doc in documents:
    print(doc.page_content)
```

### Error Message and Stack Trace (if applicable)

---------------------------------------------------------------------------
AuthenticationError                       Traceback (most recent call last)
Cell In[1], line 21
     17 audio_blob = Blob(path=audio_path)
     19 documents = parser.lazy_parse(blob=audio_blob)
---> 21 for doc in documents:
     22     print(doc.page_content)

File d:\Repos\Python\OpenAI\.venv\Lib\site-packages\langchain_community\document_loaders\parsers\audio.py:205, in AzureOpenAIWhisperParser.lazy_parse(self, blob)
    203 try:
    204     if is_openai_v1():
--> 205         transcript = self._client.audio.transcriptions.create(
    206             model=self.deployment_name,
    207             file=file_obj,
    208             **self._create_params,
    209         )
    210     else:
    211         transcript = self._client.Audio.transcribe(
    212             model=self.deployment_name,
    213             deployment_id=self.deployment_name,
    214             file=file_obj,
    215             **self._create_params,
    216         )

File d:\Repos\Python\OpenAI\.venv\Lib\site-packages\openai\resources\audio\transcriptions.py:188, in Transcriptions.create(self, file, model, language, prompt, response_format, temperature, timestamp_granularities, extra_headers, extra_query, extra_body, timeout)
    184 # It should be noted that the actual Content-Type header that will be
    185 # sent to the server will contain a `boundary` parameter, e.g.
    186 # multipart/form-data; boundary=---abc--
    187 extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
--> 188 return self._post(  # type: ignore[return-value]
    189     "/audio/transcriptions",
    190     body=maybe_transform(body, transcription_create_params.TranscriptionCreateParams),
    191     files=files,
    192     options=make_request_options(
    193         extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
    194     ),
    195     cast_to=_get_response_format_type(response_format),
    196 )

File d:\Repos\Python\OpenAI\.venv\Lib\site-packages\openai\_base_client.py:1280, in SyncAPIClient.post(self, path, cast_to, body, options, files, stream, stream_cls)
   1266 def post(
   1267     self,
   1268     path: str,
   (...)
   1275     stream_cls: type[_StreamT] | None = None,
   1276 ) -> ResponseT | _StreamT:
   1277     opts = FinalRequestOptions.construct(
   1278         method="post", url=path, json_data=body, files=to_httpx_files(files), **options
   1279     )
-> 1280     return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))

File d:\Repos\Python\OpenAI\.venv\Lib\site-packages\openai\_base_client.py:957, in SyncAPIClient.request(self, cast_to, options, remaining_retries, stream, stream_cls)
    954 else:
    955     retries_taken = 0
--> 957 return self._request(
    958     cast_to=cast_to,
    959     options=options,
    960     stream=stream,
    961     stream_cls=stream_cls,
    962     retries_taken=retries_taken,
    963 )

File d:\Repos\Python\OpenAI\.venv\Lib\site-packages\openai\_base_client.py:1017, in SyncAPIClient._request(self, cast_to, options, retries_taken, stream, stream_cls)
   1014 log.debug("Encountered Exception", exc_info=True)
   1016 if remaining_retries > 0:
-> 1017     return self._retry_request(
   1018         input_options,
   1019         cast_to,
   1020         retries_taken=retries_taken,
   1021         stream=stream,
   1022         stream_cls=stream_cls,
   1023         response_headers=None,
   1024     )
   1026 log.debug("Raising connection error")
   1027 raise APIConnectionError(request=request) from err

File d:\Repos\Python\OpenAI\.venv\Lib\site-packages\openai\_base_client.py:1095, in SyncAPIClient._retry_request(self, options, cast_to, retries_taken, response_headers, stream, stream_cls)
   1091 # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a
   1092 # different thread if necessary.
   1093 time.sleep(timeout)
-> 1095 return self._request(
   1096     options=options,
   1097     cast_to=cast_to,
   1098     retries_taken=retries_taken + 1,
   1099     stream=stream,
   1100     stream_cls=stream_cls,
   1101 )

File d:\Repos\Python\OpenAI\.venv\Lib\site-packages\openai\_base_client.py:1061, in SyncAPIClient._request(self, cast_to, options, retries_taken, stream, stream_cls)
   1058         err.response.read()
   1060     log.debug("Re-raising status error")
-> 1061     raise self._make_status_error_from_response(err.response) from None
   1063 return self._process_response(
   1064     cast_to=cast_to,
   1065     options=options,
   (...)
   1069     retries_taken=retries_taken,
   1070 )

AuthenticationError: Error code: 401 - {'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}

### Description

When using `AzureOpenAIWhisperParser` with Azure AD authentication through `DefaultAzureCredential`, the parser fails with a 401 unauthorized error. This occurs because the underlying OpenAI client initialization uses an incorrect parameter name for the Azure AD token.

**Current Behavior**
When instantiating `AzureOpenAIWhisperParser` with the `azure_ad_token_provider` parameter, the authentication fails with the following error:
```AuthenticationError: Error code: 401 - {'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}```

**Expected Behavior**
The authentication should succeed when providing a valid Azure AD token provider through the `azure_ad_token_provider` parameter.

**Root Cause**
In the source code of langchain-community, when initializing the OpenAI client, the `azure_ad_token_provider` is incorrectly passed as `azure_ad_token`:

```python
if is_openai_v1():
    self._client = openai.AzureOpenAI(
        api_key=self.api_key,
        azure_endpoint=self.azure_endpoint,
        api_version=self.api_version,
        max_retries=self.max_retries,
        azure_ad_token=self.azure_ad_token_provider,  # This is incorrect
    )
```

Proposed Solution
Update the client initialization to use the correct parameter name:

```python
if is_openai_v1():
    self._client = openai.AzureOpenAI(
        api_key=self.api_key,
        azure_endpoint=self.azure_endpoint,
        api_version=self.api_version,
        max_retries=self.max_retries,
        azure_ad_token_provider=self.azure_ad_token_provider,  # Corrected parameter name
    )
```

### System Info

❯ python -m langchain_core.sys_info

System Information
------------------
> OS:  Windows
> OS Version:  10.0.26100
> Python Version:  3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]

Package Information
-------------------
> langchain_core: 0.3.29
> langchain: 0.3.14
> langchain_community: 0.3.14
> langsmith: 0.2.10
> langchain_openai: 0.2.14
> langchain_text_splitters: 0.3.5

Optional packages not installed
-------------------------------
> langserve

Other Dependencies
------------------
> aiohttp: 3.11.11
> async-timeout: Installed. No version info available.
> dataclasses-json: 0.6.7
> httpx: 0.28.1
> httpx-sse: 0.4.0
> jsonpatch: 1.33
> langsmith-pyo3: Installed. No version info available.
> numpy: 1.26.4
> openai: 1.59.4
> orjson: 3.10.14
> packaging: 24.2
> pydantic: 2.10.4
> pydantic-settings: 2.7.1
> PyYAML: 6.0.2
> requests: 2.32.3
> requests-toolbelt: 1.0.0
> SQLAlchemy: 2.0.37
> tenacity: 9.0.0
> tiktoken: 0.8.0
> typing-extensions: 4.12.2
> zstandard: Installed. No version info available.