Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TA] Added MultiCategoryClassify Functionality #24237

Conversation

AhmedLeithy
Copy link
Member

@AhmedLeithy AhmedLeithy commented Sep 26, 2021

This PR contains the implementation of the Multi Category Classify API interface as explained in #24062. Renames post the meeting with the architecture board have been taken into consideration in this PR.

The CI pipeline currently fails because:

  • The PPE does not currently support old actions, and thus session records for them cannot yet be rerecorded.

The tests can be rerecorded in another PR at a later date.

@AhmedLeithy AhmedLeithy force-pushed the TA-MultiCategoryClassify branch from cb2ad35 to fc0f362 Compare September 30, 2021 12:34
Copy link
Member

@maririos maririos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.NET LGTM

};

// Set project and deployment names of the target model
#if SNIPPET
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like there is no snippet defined in this class, so this section of code is not necessary. you could just do

string projectName = TestEnvironment.MultiClassificationProjectName;
string deploymentName = TestEnvironment.MultiClassificationDeploymentName;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the other 3 sample classes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, removed them.

I had them there because I remember in DT there were some samples where we wanted to have the #if SNIPPET directives for clarity, even when the code was not actually used in a snippet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair. DT was more complex as it required function calls to get the storage setup. here it is just a string so user can follow easier

{
foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults)
{
if (documentResults.ClassificationCategories.Count > 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought arch board feedback was to rename this property to classifications? @mssfang

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out. I seem to have missed this rename in SingleCategoryClassifyResult as well.

SingleCategoryClassifyResult.ClassificationCategory -> SingleCategoryClassifyResult.Classification

MultiCategoryClassifyResult.ClassificationCategories -> MultiCategoryClassifyResult.Classifications

Comment on lines +832 to +841
new MultiCategoryClassifyAction(FakeProjectName, FakeDeploymentName),
new MultiCategoryClassifyAction(FakeProjectName, FakeDeploymentName)
{
DisableServiceLogs = true
}
},
};

ArgumentException ex = Assert.ThrowsAsync<ArgumentException>(async () => await client.StartAnalyzeActionsAsync(documents, batchActions));
Assert.AreEqual("Multiple of the same action is not currently supported.", ex.Message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this test should work if different values for project name / deployment name are passed for each action

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not following the logic we currently have in the .NET SDK.
I prefer to leave this as is so we can make progress in this PR, work on the custom entities PR, and once those 2 are merged, then focus on the work on #24430

@maririos maririos requested a review from kristapratico October 5, 2021 16:16
Copy link
Member

@kristapratico kristapratico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! :)

@maririos maririos merged commit e831044 into Azure:feature/textanalytics/custom Oct 5, 2021
maririos pushed a commit to maririos/azure-sdk-for-net that referenced this pull request Oct 26, 2021
maririos added a commit that referenced this pull request Oct 26, 2021
* [TextAnalytics] Generated client from 3.2-preview.2 swagger (#23536)

* [TA] Added SingleCategoryClassify functionality (#24235)

* [TA] Added MultiCategoryClassify Functionality (#24237)

* [TA] Added RecognizeCustomEntities Functionality (#24245)

* [TA] Expose ActionName and enable multiple actions from same type (#24619)

* Rerecorded all tests excluding AAD ones (#24913)

* re-record AAD tests (#24919)

* [TA] Enable CI for live tests for custom features (#24916)

* add comments

Co-authored-by: Caio Saldanha <camaiaor@microsoft.com>
Co-authored-by: Ahmed Leithy <v-aleithy@microsoft.com>
Co-authored-by: Salah Mostafa <zulamostafa@gmail.com>
Co-authored-by: Salah Mostafa <v-samostafa@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants