azure-sdk-for-net
azure-sdk-for-net copied to clipboard
AnalyzeDocumentFromUriAsync Does not exist
Type of issue
Code doesn't work
Description
I'm very confused on which API I should be using using Azure.AI.DocumentIntelligence; using Azure.AI.FormRecognizer;
I tried the code sample provided, and it has no method called AnalyzeDocumentFromUriAsync
'DocumentIntelligenceClient' does not contain a definition for 'AnalyzeDocumentFromUriAsync' and no accessible extension method 'AnalyzeDocumentFromUriAsync' accepting a first argument of type 'DocumentIntelligenceClient' could be found (are you missing a using directive or an assembly reference?)CS1061
Sample code:
var client = new DocumentIntelligenceClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
Console.WriteLine("Analyzing document from URL...");
AnalyzeDocumentOperation operation = await client.AnalyzeDocumentFromUriAsync(WaitUntil.Completed, "prebuilt-layout", fileUri);
AnalyzeResult result = operation.Value;
foreach (DocumentPage page in result.Pages)
{
Console.WriteLine($"Document Page {page.PageNumber} has {page.Lines.Count} line(s), {page.Words.Count} word(s),");
Console.WriteLine($"and {page.SelectionMarks.Count} selection mark(s).");
for (int i = 0; i < page.Lines.Count; i++)
{
DocumentLine line = page.Lines[i];
Console.WriteLine($" Line {i} has content: '{line.Content}'.");
Console.WriteLine($" Its bounding polygon (points ordered clockwise):");
for (int j = 0; j < line.BoundingPolygon.Count; j++)
{
Console.WriteLine($" Point {j} => X: {line.BoundingPolygon[j].X}, Y: {line.BoundingPolygon[j].Y}");
}
}
Page URL
https://learn.microsoft.com/en-us/dotnet/api/overview/azure/ai.formrecognizer-readme?view=azure-dotnet
Content source URL
https://github.com/Azure/azure-docs-sdk-dotnet/blob/master/api/overview/azure/latest/ai.formrecognizer-readme.md
Document Version Independent Id
ed88679a-395f-a658-010c-4fdeea56eade
Article author
@azure-sdk
Metadata
- ID: 503d323c-17e3-43dc-2b67-2b8595e5ac84
- Service: formrecognizer
Thank you for your feedback. Tagging and routing to the team member best able to assist.
Hello @dwainbrowne,
The Document Intelligence service has gone through a lot of changes in the last couple of years, some of them causing major changes to the design of the SDK. Because of this, we currently have two libraries supporting this service: Azure.AI.DocumentIntelligence, and Azure.AI.FormRecognizer.
Azure.AI.DocumentIntelligence
- README: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/documentintelligence/Azure.AI.DocumentIntelligence/README.md
- Samples: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/documentintelligence/Azure.AI.DocumentIntelligence/samples/README.md
This is the newer library, and currently it only supports the latest version released by the Document Intelligence service (2024-02-29-preview). From now on, this is the only library we'll be updating with new service features. If you haven't worked with the SDK before, this is the library we recommend going forward.
When using this library, you'll be using the Azure.AI.DocumentIntelligence namespace, and both the DocumentIntelligenceClient and the DocumentIntelligenceAdministrationClient.
Please note that Azure.AI.DocumentIntelligence is still in beta, so breaking changes are expected until version 1.0.0 is released.
Azure.AI.FormRecognizer
- README: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md
- Samples: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/formrecognizer/Azure.AI.FormRecognizer/samples/README.md
This is the first library we released, when the Document Intelligence service was still named Form Recognizer. Going forward, we won't be supporting this library anymore. The latest service version it supports is 2023-07-31, and it won't be updated to include new versions in the future.
When using it, you'll be using the Azure.AI.FormRecognizer.DocumentAnalysis namespace, and both the DocumentAnalysisClient and the DocumentModelAdministrationClient.
It's worth mentioning that this library also contains an Azure.AI.FormRecognizer namespace that was used for still older service versions, but we don't recommend using them anymore.
I hope that helps. Feel free to let us know if you have more questions.
@dwainbrowne Just to clarify, the snippet code you shared uses the old Azure.AI.FormRecognizer library.
To do the same with the new Azure.AI.DocumentIntelligence library, please follow this sample: Analyze a document with a prebuilt model
Hi @dwainbrowne. 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 @dwainbrowne, 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.