Skip to content
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/patch-20250306224613336336.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "add support for cosmosdb to use url+AccountKey based authentication"
}
12 changes: 9 additions & 3 deletions graphrag/vector_stores/cosmosdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ def connect(self, **kwargs: Any) -> Any:
if not url:
msg = "Either connection_string or url must be provided."
raise ValueError(msg)
self._cosmos_client = CosmosClient(
url=url, credential=DefaultAzureCredential()
)
access_key = kwargs.get("api_key")
if access_key:
self._cosmos_client = CosmosClient(
url=url, credential=access_key
)
else:
self._cosmos_client = CosmosClient(
url=url, credential=DefaultAzureCredential()
)

database_name = kwargs.get("database_name")
if database_name is None:
Expand Down