azure-sdk-for-python
azure-sdk-for-python copied to clipboard
Unable to attach cognitive service using python SDK
- Package Name: Azure Cognitive Search
- Package Version: 11.2.1
- Operating System: Windows
- Python Version: 3.7
Describe the bug
When creating an azure search skill set through the Python SDK, I am unable to attach an azure cognitive service. This causes entities populated by the skill set to not be populated. The CognitiveServiesAccount
model that is to be used by the searchIndexerSkillset
constructor does not seem to exist when I try to import it.
The documentation here says the cognitive services account object is a required parameter, but I am unable to add it and no errors are thrown when I create the skillset without it.
To Reproduce When creating a skillset, the CognitiveServicesAccount parameter is not required and a skillset is successfully created without it. This directly contradicts the online documentation for the searchIndexerSkillset constructor which states the CognitiveServicesAccount parameter is required.
I am also unable to import the CognitiveServicesAccount object from the Python SDK, so it seems it is not possible to pass it in and specify what account I would like to attach to.
When I create the skillset without it, there are no errors and it appears as if the skillset is successfully created.
However, when I inspect the skillset in the portal, the cognitive services account is null so the skillset will not work. This is causing issues with programmatically deploying a working solution using Python.
Expected behavior When creating a skillset, I expect to be able to create a CognitiveServicesAccount object and pass it into the searchIndexerSkillset constructor. I also expect this parameter to be required and an error will be thrown if I do not pass in the CognitiveServicesAccount object. When I inspect the skillset in the portal I expect the correct cognitive service to be attached to the skillset.
Screenshots
Additional context To work around the issue stated above, the REST API can be used to update the skillset created through the Python SDK and attach a cognitive service account to it. The developer can also attach one through the portal.
The Python SDK documentation should be updated to state this issue and any workarounds. The issue should also be logged and eventually fixed so users can deploy a working solution using Python.
Label prediction was below confidence level 0.6
for Model:ServiceLabels
: 'Cognitive Services:0.49177337,Search:0.13391021,Docs:0.08864225'
Hi @akazlow , thanks for the feedback. We'll take a look at this and get back to you asap.
@akazlow You can use azure.search.documents.indexes.models.CognitiveServicesAccountKey
to set the argument cognitive_services_account
of SearchIndexerSkillset
to attach the cognitive search.
Hi @akazlow, since you haven’t asked that we “/unresolve
” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve
” to reopen the issue.