[ai-form-recognizer] modelName and FormTrainingClient testing refactor#12203
Conversation
| @@ -16,6 +16,7 @@ These sample programs show how to use the JavaScript client libraries for Azure | |||
| | [differentiateLabeledUnlabeled.js][differentiatelabeledunlabeled] | See the differences in output when using a custom model trained with labeled data and one trained with unlabeled data | | |||
| | [copyModel.js][copymodel] | Copy a custom model from one Form Recognizer resource to another | | |||
| | [authenticationMethods.js][authenticationmethods] | authenticates a service client using both Azure Active Directory and an API key | | |||
| | [deleteAllModels.js][deleteallmodels] | Delete all models in a Form Recognizer account | | |||
There was a problem hiding this comment.
curious about this sample since I don't think other languages have it. Is there a reason for adding?
There was a problem hiding this comment.
Keyvault has one here in JS, and I've found working with this service that I really needed this code on hand to clean up my own FR account. I figured if I needed it, someone else probably will as well.
| const dotenv = require("dotenv"); | ||
| dotenv.config(); | ||
|
|
||
| async function main() { |
There was a problem hiding this comment.
I love how easy and simple it looks for both JS and Python :)
| /** | ||
| * An optional name to associate with the model | ||
| */ | ||
| modelName?: string; |
There was a problem hiding this comment.
in .NET we are moving this out of the option bag and leaving it as a parameter of BeginTraining becuase we expect customer to use model name frequently.
Could this be the case for JS too?
|
/azp run js - formrecognizer - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| */ | ||
|
|
||
| export function makeCredential(useAad: boolean): TokenCredential | AzureKeyCredential { | ||
| // if (isPlaybackMode()) { |
There was a problem hiding this comment.
nit: remove instead of commenting out?
There was a problem hiding this comment.
Good catch thank you, I forgot to clean up some debugging changes to the utils.
| * For strong type-checking, it is important that the `matrix` have a strong | ||
| * type, such as a `const` literal. | ||
| * | ||
| * @param values jagged 2D array specifying the arguments and their possible |
There was a problem hiding this comment.
I am just curious what happens if higher dimensional arrays are passed to matrix()
There was a problem hiding this comment.
Anything that is nested deeper than 2 will become an argument itself.
matrix([
[["a", "b", "c"], ["x", "y", "z"]],
[1, 2, 3]
] as const, (arr: string[], n: number) => {
// ...
});
jeremymeng
left a comment
There was a problem hiding this comment.
Looks great! Love the test cleanup. I can see matrix being useful in other scenarios e.g., testing multi service version support.
|
@jeremymeng Thanks! I think if we were going to have a shared utility library for tests, |
This adds support for
modelNameto the convenience layer API. Reviewers who are interested in that should look at the api.md file,src, andsamples. Sorry for all the noise related to testing.In the process of adding tests for this feature, I also refactored the existing FormTrainingClient tests.
test/utils/matrix.ts).Closes #11233