Assistance Needed: Azure Form Recognizer API Query Issue

Dhairya Maradiya 0 Reputation points
2024-05-17T05:37:54.6666667+00:00

I am having trouble querying additional fields using the prebuilt invoice model in the Azure Form Recognizer API. When I pass query fields to the endpoint https://{endpoint}/documentintelligence/documentModels/prebuilt-invoice:analyze?api-version=2024-02-29-preview&features=queryFields&queryFields=Terms,PaymentDate using the Python SDK, I receive a "No resource found" error.

I have checked that my Azure resource is located in one of the supported regions (East US, West US2, West Europe) for the public preview version 2024-02-29-preview. Although the prebuilt invoice model correctly extracts standard fields such as InvoiceId, InvoiceDate, and Total, I need to extract additional fields like VendorTRN and TelephoneNumber.

Can someone please provide guidance on how to resolve this issue and successfully query these additional fields using the Azure Form Recognizer API?

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,452 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,466 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Vlad Costa 90 Reputation points
    2024-05-17T08:23:28.1366667+00:00

    It seems like you’re trying to extend the schema of the prebuilt invoice model to extract specific fields you need, which is supported by Azure’s Document Intelligence. Here are a few things you might want to check:

    1. API Version: Make sure you’re using the correct API version. As per your query, you’re using 2024-02-29-preview, which should be fine.

    Query Fields: You’re passing Terms and PaymentDate as query fields. If you want to extract VendorTRN and TelephoneNumber, you should include these in your query fields.

    1. Endpoint URL: Ensure that the endpoint URL is correct. The URL you provided seems to be in the correct format.
    2. Authentication: Make sure your API key is correctly set. The API key should be wrapped in the AzureKeyCredential class.

    If you’ve checked all of these and the issue persists, it might be a service-related issue.

    0 comments No comments

  2. santoshkc 5,335 Reputation points Microsoft Vendor
    2024-05-17T08:35:18.46+00:00

    Hi @Dhairya Maradiya,

    Thank you for reaching out to Microsoft Q&A forum!

    Thank you for reaching out. I understand that you're having trouble querying additional fields using the prebuilt invoice model in the Azure Form Recognizer API. The 'No resource found' error you're receiving may be due to incorrect query parameters or missing permissions.

    I tried to repro your issue using REST API endpoint to extract additional fields as per our requirements.

    To query additional fields using the Azure Form Recognizer API, you can use the following endpoint:

    POST: {endpoint}/documentintelligence/documentModels/prebuilt-invoice:analyze?_overload=analyzeDocument&api-version=2024-02-29-preview&features=queryFields&queryFields=phone,Terms

    Please note that you'll need to replace {endpoint} with your actual endpoint and also you can give the "queryFields" as per your requirements. Also, make sure that you have the necessary permissions and access rights to query additional fields.

    The below screen shot shows the extracted additional fields:

    User's image

    User's image

    For more info, please look into the documentation.

    I hope this helps! Thank you.

    0 comments No comments

  3. Vlad Costa 90 Reputation points
    2024-05-30T04:57:07.8033333+00:00

    Hi @Dhairya Maradiya,

    If my response helped, please mark it as an accepted answer.

    Thanks in advance.

    0 comments No comments