Closed jackUTS closed 1 year ago
Label prediction was below confidence level 0.6
for Model:ServiceLabels
: 'Storage:0.18694614,Azure.Identity:0.11207476,Cosmos:0.09292228'
This looks to me like you are using TS syntax inside a JS file?
Try removing the :AnalyzeBatchAction[]
part here:
const actions: AnalyzeBatchAction[] = [
{
kind: "CustomEntityRecognition",
deploymentName: "ner-deploy",
projectName = "product-ner",
},
];
to make it:
const actions = [
{
kind: "CustomEntityRecognition",
deploymentName: "ner-deploy",
projectName = "product-ner",
},
];
Hi @xirzec,
This seemed to fix the issue, thanks, not sure where I got the typescript from.
I'm now having issues with TextAnalysisClient, as below.
const client = new TextAnalysisClient("https://custom-ner.cognitiveservices.azure.com/", new AzureKeyCredential("<redacted>
"));
^
TypeError: TextAnalysisClient is not a constructor
Any chance you could assist?
@jackUTS Above it looked like you were using @azure/ai-text-analytics
which has a TextAnalyticsClient
: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/textanalytics/ai-text-analytics
But now it seems like you are trying to use the newer TextAnalysisClient
from @azure/ai-language-text
? https://github.com/Azure/azure-sdk-for-js/blob/b16bb8e2b97e4602257c6639bd8aad2d80cbb3f1/sdk/cognitivelanguage/ai-language-text/README.md
So maybe check you are importing from the correct package?
Also if that credential is real, you should rotate it immediately. :)
@jackUTS Could you please use @azure/ai-language-text@1.0.0? Here is a sample for custom entity recognition. Please note that @azure/ai-text-analytics@6.0.0-beta.1 is a beta library that we're planning to deprecate.
Hi @jackUTS. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve
” to remove the “issue-addressed” label and continue the conversation.
Hi @jackUTS, 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.
Describe the bug Following the guide for Custom Entity Recognition(https://github.com/Azure/azure-sdk-for-js/tree/@azure/ai-text-analytics_6.0.0-beta.1/sdk/textanalytics/ai-text-analytics/samples). const actions: AnalyzeBatchAction[] = [ { kind: "CustomEntityRecognition", deploymentName: "ner-deploy", projectName = "product-ner", }, ];
returns error "Syntax Error: Missing Initializer in const declaration"
To Reproduce Steps to reproduce the behavior:
Expected behavior program runs as expected from sample.
Screenshots![image](https://user-images.githubusercontent.com/53325480/198076018-ecb9ebaf-aa4c-4556-b02d-311ee28e4f22.png)
Code const { AnalyzeBatchAction, AzureKeyCredential, TextAnalysisClient, } = require("@azure/ai-text-analytics");
const client = new TextAnalysisClient("", new AzureKeyCredential(""));
const documents = [ "Apple iPhone 14 Pro Max 256GB - $1899", "NBA 2K23 - $109", ];
async function main() { const actions: AnalyzeBatchAction[] = [ { kind: "CustomEntityRecognition", deploymentName: "ner-deploy", projectName = "product-ner", }, ]; const poller = await client.beginAnalyzeBatch(actions, documents, "en"); for await (const actionResult of results) { if (actionResult.kind !== "CustomEntityRecognition") { throw new Error(
Expected a CustomEntityRecognition results but got: ${actionResult.kind}
); } if (actionResult.error) { const { code, message } = actionResult.error; throw new Error(Unexpected error (${code}): ${message}
); } for (const result of actionResult.results) { console.log(- Document ${result.id}
); if (result.error) { const { code, message } = result.error; throw new Error(Unexpected error (${code}): ${message}
); } console.log("\tRecognized Entities:"); for (const entity of result.entities) { console.log(\t- Entity "${entity.text}" of type ${entity.category}
); } } } }main();