mirror of
https://github.com/hwchase17/langchain.git
synced 2026-07-15 15:40:34 +00:00
Fix Azure National Cloud authentication using token (RBAC) (Generated by Ana - AI SDE) (#25843)
This pull request addresses the issue with authenticating Azure National
Cloud using token (RBAC) in the AzureSearch vectorstore implementation.
## Changes
- Modified the `_get_search_client` method in `azuresearch.py` to pass
`additional_search_client_options` to the `SearchIndexClient` instance.
## Implementation Details
The patch updates the `SearchIndexClient` initialization to include the
`additional_search_client_options` parameter:
```python
index_client: SearchIndexClient = SearchIndexClient(
endpoint=endpoint,
credential=credential,
user_agent=user_agent,
**additional_search_client_options
)
```
This change allows the `audience` parameter to be correctly passed when
using Azure National Cloud, fixing the authentication issues with
GovCloud & RBAC.
This patch was generated by [Ana - AI SDE](https://openana.ai/), an
AI-powered software development assistant.
This is a fix for [Issue
25823](https://github.com/langchain-ai/langchain/issues/25823)
---------
Co-authored-by: ccurme <chester.curme@gmail.com>
This commit is contained in:
@@ -150,7 +150,10 @@ def _get_search_client(
|
||||
else:
|
||||
credential = DefaultAzureCredential()
|
||||
index_client: SearchIndexClient = SearchIndexClient(
|
||||
endpoint=endpoint, credential=credential, user_agent=user_agent
|
||||
endpoint=endpoint,
|
||||
credential=credential,
|
||||
user_agent=user_agent,
|
||||
**additional_search_client_options,
|
||||
)
|
||||
try:
|
||||
index_client.get_index(name=index_name)
|
||||
|
||||
Reference in New Issue
Block a user