Skip to content

DocumentIntelligenceClient has no begin_analyze_document_from_url #32

Open

Description

@p-sumann

Please provide us with the following information:
I am using Document AI for extract information from Invoices:

from azure.ai.formrecognizer import DocumentAnalysisClient

This one is working fine for both online and local file upload using

document_analysis_client = DocumentAnalysisClient(
        endpoint=endpoint, credential=AzureKeyCredential(key))
poller = document_analysis_client.begin_analyze_document_from_url(
                    "prebuilt-layout", document=file)
result = poller.result()

But this one for normal documents mine specific use case is for Invoices and upon using it, I am getting error saying 404 resource not found. I am using this:

document_intelligence_client  = DocumentIntelligenceClient(
                endpoint=DOCUMENTAI_ENDPOINT, credential=AzureKeyCredential(DOCUMENTAI_KEY))
        
        poller = document_intelligence_client.begin_analyze_document(
        "prebuilt-invoice", AnalyzeDocumentRequest(url_source=pdf_url)
    )

Error messages given by the failure

azure.core.exceptions.ResourceNotFoundError: (404) Resource not found
Code: 404
Message: Resource not found

Expected/desired behavior

It should work, I should get the normal output

OS and Version?

WSL Linux (Ubunutu 22.04)

Activity

  1. xuanhai266 commented on Jun 6, 2024

    @xuanhai266

    I have the same issue with Java SDK.
    If I use old library: azure-ai-formrecognizer:4.1.4, there is no problem.
    If I use new library: azure-ai-documentintelligence:1.0.0-beta.2, it returns 404 resource not found error.
    Here is my code for new library:

    AnalyzeDocumentRequest analyzeDocumentRequest = new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(file.toPath())); 
    SyncPoller<AnalyzeResultOperation, AnalyzeResultOperation> poller = documentIntelligenceClient.beginAnalyzeDocument("prebuilt-layout", null, null, null, null, null, null, analyzeDocumentRequest);
  2. luzhang06 commented on Jun 14, 2024

    @luzhang06
    Contributor

    Can you please check if your resource is in one of the 3 preview regions?

    • East US
    • West US2
    • West Europe
  3. xuanhai266 commented on Jun 14, 2024

    @xuanhai266

    Can you please check if your resource is in one of the 3 preview regions?

    • East US
    • West US2
    • West Europe

    Yes, the problem relates to region of document intelligence instance. It is OK now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions