[BUG] Model Id Type in the SDK does not match Studio
See original GitHub issueLibrary name and version
Azure.AI.FormRecognizer 3.1.1
Describe the bug
Hi,
In Form Recognizer .NET SDK the method StartRecognizeCustomFormsAsync expects a Guid as the model id for Custom Models. When creating custom models in the Form Recognizer Studio it there is no such restriction on the model id and these can be named as any string of text, for example “completed_model_2”.
When passing this to the SDK:
The following error is thrown
FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
It’s possible to use the REST API directly and pass in these model ids, however it would be preferable to consume the SDK rather than re-implementing the functionality built by Microsoft and this is a blocker for adoption for us also I’m sure will be a source of confusion for other customers.
I’m seeing the same behaviour in both the current stable 3.1.1 and the latest preview 4.0.0-beta.3 of the .NET SDK.
Expected behavior
A string modelid that is not restricted to a Guid is accepted
Actual behavior
An ArgumentException is thrown
Reproduction Steps
RecognizeCustomFormsOptions recognizeContentOptions = new RecognizeCustomFormsOptions { ContentType = FormContentType.Png};
AzureKeyCredential credential = new AzureKeyCredential("YOUR KEY");
FormRecognizerClient client = new FormRecognizerClient(new Uri("YOUR ENDPOINT"), credential);
Azure.Response<RecognizedFormCollection> formPages = await client
.StartRecognizeCustomFormsAsync("completed-model-2", document.Content, recognizeContentOptions).WaitForCompletionAsync().ConfigureAwait(false);
Environment
Windows 10 .NET 6
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Thanks @maririos that is indeed what I needed and the linked documentation is clear.
@pluservice The validation code you linked is only called if you’re using the old
FormRecognizerClient
, which targets old service versions that only support GUID model IDs. In order to use the newest service version, theDocumentAnalysisClient
must be used. Please check our documentation here for more information.If you still think there’s a bug in the SDK, please feel free to open a new issue.