Hello Stas Khirman,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
Regarding your issues, instead of, no definitive check that your endpoint/resource kind was the cause and to avoid any speculative region/sku/feature names. The below is the way out orderly:
- Step A: Start by confirming the resource kind and endpoint via Azure Portal (Overview blade) or Azure CLI:
If your resource isn’t of kindaz cognitiveservices account show \ --name <your-resource-name> \ --resource-group <your-rg> \ --query "{kind: kind, endpoint: properties.endpoint, sku: sku.name}" \ -o jsonAIServicesor specifically an Azure AI Language resource, the API won’t match. - https://free.blessedness.top/en-us/cli/azure/cognitiveservices/account?view=azure-cli-latest - B: Ensure you're using the latest version of the SDK:
pip install --upgrade azure-ai-textanalyticsVersion 5.3.x+ defaults to the stable2023-04-01API, which avoids issues caused by older or preview versions. SDK Docs - C: Avoid specifying outdated preview versions like
2023-01-01-preview. Let the SDK auto-select or explicitly use2023-04-01:
This ensures compatibility with your resource and avoids version mismatch errors.from azure.ai.textanalytics import TextAnalyticsClient from azure.core.credentials import AzureKeyCredential client = TextAnalyticsClient(endpoint="<your-endpoint>", credential=AzureKeyCredential("<your-key>")) result = client.recognizepiientities(["שמי דוד ואני גר בתל אביב. הטלפון שלי הוא 055-1234567"], language="he") - D: Use
curlto check if the preview version is supported:
If you get a 400/404 error, the preview version isn’t supported in your region or by your resource. REST Docscurl -X POST "https://<your-resource>.cognitiveservices.azure.com/language/analyze-text/jobs?api-version=2023-01-01-preview" \ -H "Ocp-Apim-Subscription-Key: <your-key>" \ -H "Content-Type: application/json" \ -d '{"displayName":"PII Test","analysisInput":{"documents":[{"id":"1","language":"he","text":"שמי דוד… 055-1234567"}]},"tasks":[{"kind":"PiiEntityRecognition","taskName":"pii1"}]}' - E: If your current resource doesn’t support the needed API, create a new one with kind
AIServicesin a supported region:
This ensures full compatibility with the latest Azure Language APIs. Create Resource Guideaz cognitiveservices account create \ --name my-language-resource \ --resource-group my-rg \ --kind AIServices \ --sku S0 \ --location westus2 \ --yes - F: Only register subscription-level previews if explicitly mentioned in Azure docs. Use:
Avoid guessing feature names and check the official documentation first. - https://free.blessedness.top/en-us/azure/azure-resource-manager/management/preview-featuresaz feature register --namespace <namespace> --name <feature-name>
I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.