azureazure-form-recognizerapi-versioning

I'm not able to call the azue document intelligence api using the latest api version "2024-02-29-preview"


Using the code below I'm not able to call the latest api version "2024-02-29-preview" of the Azure AI Document Intelligence using prebuilt-layout. I'm in the correct region west europe where the version is available. The reason I want to use the newest version is as it supports figure extraction.

from azure.core.credentials import AzureKeyCredential
from azure.ai.formrecognizer import DocumentAnalysisClient

document_analysis_client = DocumentAnalysisClient(
    endpoint=endpoint, credential=AzureKeyCredential(key)
)


poller = document_analysis_client.begin_analyze_document_from_url('prebuilt-layout', formUrl, locale='de')
result = poller.result()
>>> print(result.api_version)
'2023-07-31'

I get the '2023-07-31' version and the method documentation doesn't indicate any keyword or parameter to be used to specifiy the version. Just trying calling the method begin_analyze_document_from_url like

poller = document_analysis_client.begin_analyze_document_from_url('prebuilt-layout', formUrl, locale='de', api_version="2024-02-29-preview")

results in the Error:

Traceback (most recent call last):
  File "/snap/pycharm-professional/387/plugins/python/helpers-pro/pydevd_asyncio/pydevd_asyncio_utils.py", line 117, in _exec_async_code
    result = func()
             ^^^^^^
  File "<input>", line 1, in <module>
...
azure.core.exceptions.ResourceNotFoundError: (404) Resource not found
Code: 404
Message: Resource not found

I know that the fact the parameter is not implemented is causing the error, but where is the package implementing the functionality to specifically call the right API version. Can anybody help with that?


Solution

  • So it seems the DocumentAnalysisClient currently doesn't support preview API versions which is fine. Using REST works, starting with the examples in the documentation