Correct documentation of language detection in Azure AI

25 Views Asked by At

The following is the code in which a JSON string is sent to the Azure AI service. It is part of an exercise available at https://learn.microsoft.com/en-us/training/modules/create-manage-ai-services/5a-exercise-ai-services:

 jsonBody = 
{            
"documents":[                
{"id": 1,"text": text}
            ]        
}

...

headers = { 'Content-Type': 'application/json','Ocp-Apim-Subscription-Key': ai_key     }
...



conn.request("POST", "/text/analytics/v3.1/languages?", str(jsonBody).encode('utf-8'), headers)

I can't seem to find the documentation which explain how the body was created and what to mention in the url when sending the request. The closest I could find is https://learn.microsoft.com/en-us/azure/ai-services/language-service/language-detection/quickstart?pivots=rest-api, however, the url used there is different /language/:analyze-text?api-version=2023-11-15-preview and so is the body

{
    "kind": "LanguageDetection",
    "parameters": {
        "modelVersion": "latest"
    },
    "analysisInput":{
        "documents":[
            {
                "id":"1",
                "text": "This is a document written in English."
            }
        ]
    }
}

Where could I find the right documentation which matches the example in the exercise?

Update

I found the following documentation - https://westus2.dev.cognitive.microsoft.com/docs/services/textanalytics-v3-1/operations/Languages.

My confusion is how to decide if I should use text analytics or language detection? Why I can't find text analytics documentation in learn.microsoft.com.

0

There are 0 best solutions below