Hi I tried calling my custom (NER) which I am trying to use my custom labeling for PII recognition, however when calling the prediction URL I would get a response of error 404: Resource not found"
URL: https://glen-apd-language-demo.cognitiveservices.azure.com/language/analyze-text/jobs?api-version=2022-10-01-preview
I'm calling the correct API Key from
just calling https://glen-apd-language-demo.cognitiveservices.azure.com/ with apikey uses the standard task PII recognition but not custom (NER)
// Import required modules
const { TextAnalyticsClient, AzureKeyCredential } = require("@azure/ai-text-analytics");
// Function to redact PII using Azure Text Analytics with custom entity recognition
async function redactPIIWithAzure(text) {
const textAnalyticsEndpoint = "https://glen-apd-language-demo.cognitiveservices.azure.com/language/analyze-text/jobs?api-version=2022-10-01-preview";
const textAnalyticsApiKey = "xxxxx";
const client = new TextAnalyticsClient(textAnalyticsEndpoint, new AzureKeyCredential(textAnalyticsApiKey));
// Add custom entity recognition task
const customEntityRecognitionTask = {
kind: 'CustomEntityRecognition',
parameters: {
projectName: 'APD_Model',
deploymentName: 'demoDeploy',
stringIndexType: 'TextElement_v8'
}
};
try {
const redactedText = await client.recognizePiiEntities([text], "en", {
tasks: [customEntityRecognitionTask],
redaction: true,
});
console.log("Redacted text:", redactedText[0].redactedText);
console.log("Response:", redactedText);
return redactedText[0].redactedText;
} catch (error) {
console.error("Error while redacting PII:", error);
throw error;
}
}
// Example usage
(async () => {
const text = "Your sensitive text containing PII.";
try {
const redactedText = await redactPIIWithAzure(text);
console.log(redactedText);
} catch (error) {
console.error("Failed to redact PII:", error);
}
})();
May you please help me investigate on why my custom (NER) doesn't get return