Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to provide a custom credential in AzureAISearchVectorStore #1782

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .semversioner/next-release/minor-20250303170016635238.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "minor",
"description": "Allow for directly providing a Credential to AzureAISearchVectorStore"
}
11 changes: 5 additions & 6 deletions graphrag/vector_stores/azure_ai_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,25 @@ def connect(self, **kwargs: Any) -> Any:
api_key = kwargs.get("api_key")
audience = kwargs.get("audience")
self.vector_size = kwargs.get("vector_size", DEFAULT_VECTOR_SIZE)
provided_credential = kwargs.get("credential")

self.vector_search_profile_name = kwargs.get(
"vector_search_profile_name", "vectorSearchProfile"
)

if url:
audience_arg = {"audience": audience} if audience and not api_key else {}
credential = AzureKeyCredential(api_key) if api_key else (provided_credential if provided_credential else DefaultAzureCredential())

self.db_connection = SearchClient(
endpoint=url,
index_name=self.collection_name,
credential=(
AzureKeyCredential(api_key) if api_key else DefaultAzureCredential()
),
credential=credential,
**audience_arg,
)
self.index_client = SearchIndexClient(
endpoint=url,
credential=(
AzureKeyCredential(api_key) if api_key else DefaultAzureCredential()
),
credential=credential,
**audience_arg,
)
else:
Expand Down