graphrag
graphrag copied to clipboard
Cosmosdb auth patch
Description
Added support for cosmosdb to use AccountKey from the api_key parameter in vector store (as we currently do not have a connection_string parameter for the vector store in the GraphRAGConfig)
Related Issues
https://github.com/microsoft/graphrag/issues/1791
Proposed Changes
store the access_key in the api_key parameter, and then call cosmos_client in (vector_stores/cosmosdb.py) like this:
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()
)
Checklist
- [x] I have tested these changes locally.
- [x] I have reviewed the code changes.
- [ ] I have updated the documentation (if necessary).
- [ ] I have added appropriate unit tests (if applicable).
Additional Notes
In future, we can also consider adding the connection_string parameter to the VectorStoreConfig
@microsoft-github-policy-service agree