azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG] Resolutions property not populated

Open rattrick1 opened this issue 1 year ago • 3 comments

Library name and version

Azure.AI.TextAnalytics 5.3.0-beta.1

Describe the bug

Please close this if this is known or if creating bugs on beta packages isn't expected. While the latest API returns these values, they are not populated into the CategorizedEntity.Resolutions property

Expected behavior

CategorizedEntity.Resolutions contains the resolutions returned by the API

Actual behavior

CategorizedEntity.Resolutions is an empty collection

Reproduction Steps

var client = new TextAnalyticsClient(new Uri(""), new AzureKeyCredential(""));
var entities = await client.RecognizeEntitiesAsync($"Test Location Atlanta, GA and Time 5:00PM.");

Note that entities.Value[0] does not contain anything for the Resolutions property

Environment

No response

rattrick1 avatar Jan 04 '23 20:01 rattrick1

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar Jan 04 '23 21:01 jsquire

Hello, @rattrick1! NER resolutions is currently only supported in model version "2022-10-01-preview" (see: https://aka.ms/azsdk/language/ner-resolutions).

Could you please try the following and let me know if it works for you?

var client = new TextAnalyticsClient(new Uri(""), new AzureKeyCredential(""));
var options = new TextAnalyticsRequestOptions() { ModelVersion = "2022-10-01-preview" };
var documents = new List<string>() { $"Test Location Atlanta, GA and Time 5:00PM." };
RecognizeEntitiesResultCollection results = await client.RecognizeEntitiesBatchAsync(documents, options: options);

Then, the CategorizedEntity objects in results[0].Entities should include a non-empty Resolutions collection where applicable. In the example you provided above, I believe you should see one DateTimeResolution referring to "5:00PM".

joseharriaga avatar Jan 05 '23 00:01 joseharriaga

Hi Jose, thank you for the quick reply. That did work for me. I think my confusion comes from the following links:

https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.3.0-beta.1#readme-body-tab

Both of which say that for 5.3.0 2022-10-01-preview is the default.

rattrick1 avatar Jan 05 '23 00:01 rattrick1

Gotcha. The docs are referring to the API version (which does default to 2022-10-01-preview) but they fail to mention the model version (e.g., what it is, how it differs from API version, what it defaults to, etc.).

Briefly, the model version refers to the AI model that is used by the service to do the text analysis. This means that users can benefit from improved AI models by simply updating the model version without having to change any of their code or logic (i.e., they can keep using the same API version). The default model version of the library is latest, which is a way of saying "use whichever is the latest Generally Available (GA) model". In this case, to use NER resolutions, model version 2022-10-01-preview is needed, which is newer than the latest GA model, and therefore the model version must be set manually for now. Here's more information on model versions and lifecycle: https://learn.microsoft.com/en-us/azure/cognitive-services/language-service/concepts/model-lifecycle

I have created the following issue to make our docs clearer based on this conversation: https://github.com/Azure/azure-sdk-for-net/issues/33326.

Thank you for bringing this to our attention!

joseharriaga avatar Jan 06 '23 01:01 joseharriaga

Thanks Jose for the follow and clarification!

rattrick1 avatar Jan 06 '23 01:01 rattrick1