How get azure 'layout' document intelligence api version "2024-02-29-preview" with python sdk

Roberto Araujo Filho 115 Reputation points
2024-06-25T20:10:04.6666667+00:00

Hello,

I'm using python SDK (azure-ai-documentintelligence==1.0.0b3) to extract layout from files. According to the documentation´s information, this SDK should use the API version '2024-02-29-preview', but the version actually used is '2023-10-31-preview'.

Does anyone have idea what I should do to use the '2024-02-29-preview' version? Here's my code:

!pip install azure-ai-documentintelligence==1.0.0b3
from azure.core.credentials import AzureKeyCredential
from azure.ai.documentintelligence import DocumentIntelligenceClient
from azure.ai.documentintelligence.models import AnalyzeResult, AnalyzeDocumentRequest


endpoint = endpoint
key = key

document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))

path_to_sample_document = <path-to-file>

with open(path_to_sample_document, "rb") as f:
    poller = document_intelligence_client.begin_analyze_document(
        "prebuilt-layout", 
        analyze_request=f, 
        content_type="application/octet-stream"
    )
result: AnalyzeResult = poller.result()

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,706 questions
{count} votes

Accepted answer
  1. VasaviLankipalle-MSFT 17,471 Reputation points
    2024-06-25T20:44:44.6133333+00:00

    Hello @Roberto Araujo Filho , Thanks for using Microsoft Q&A Platform.

    The API version 2024-02-29-preview is currently only available in some Azure regions, the available regions can be found from here *East US, West US2 and West EuropeUser's image

    Try to create Document intelligence resource in the above supported regions and install the SDK version 1.0.0b2

    python -m pip install azure-ai-documentintelligence
    

    Also, Python 3.8 or later is required to use this package.

    Then retry the sample code as given here it should work: https://learn.microsoft.com/en-us/python/api/overview/azure/ai-documentintelligence-readme?view=azure-python-preview&preserve-view=true#extract-layout

    I hope this helps.

    Regards,

    Vasavi

    -Please kindly accept the answer and vote 'yes' if you feel helpful to support the community, thanks.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.