azure.ai.documentintelligence.aio package

class azure.ai.documentintelligence.aio.AsyncAnalyzeDocumentLROPoller(client: Any, initial_response: Any, deserialization_callback: Callable[[Any], PollingReturnType_co], polling_method: AsyncPollingMethod[PollingReturnType_co])[source]
continuation_token() str

Return a continuation token that allows to restart the poller later.

Returns:

An opaque continuation token

Return type:

str

done() bool

Check status of the long running operation.

Returns:

‘True’ if the process has completed, else ‘False’.

Return type:

bool

classmethod from_continuation_token(polling_method: AsyncPollingMethod[PollingReturnType_co], continuation_token: str, **kwargs: Any) AsyncAnalyzeDocumentLROPoller[source]
polling_method() AsyncPollingMethod[PollingReturnType_co]

Return the polling method associated to this poller.

Returns:

The polling method associated to this poller.

Return type:

AsyncPollingMethod

async result() PollingReturnType_co

Return the result of the long running operation.

Returns:

The deserialized resource of the long running operation, if one is available.

Return type:

any or None

Raises:

HttpResponseError – Server problem with the query.

status() str

Returns the current status string.

Returns:

The current status string

Return type:

str

async wait() None

Wait on the long running operation.

Raises:

HttpResponseError – Server problem with the query.

property details: Mapping[str, Any]

Returns metadata associated with the long-running operation.

Returns:

Returns metadata associated with the long-running operation.

Return type:

Mapping[str, Any]

class azure.ai.documentintelligence.aio.DocumentIntelligenceAdministrationClient(endpoint: str, credential: AzureKeyCredential | AsyncTokenCredential, **kwargs: Any)[source]

DocumentIntelligenceAdministrationClient.

Parameters:
  • endpoint (str) – The Document Intelligence service endpoint. Required.

  • credential (AzureKeyCredential or AsyncTokenCredential) – Credential needed for the client to connect to Azure. Is either a AzureKeyCredential type or a TokenCredential type. Required.

Keyword Arguments:

api_version (str) – The API version to use for this operation. Default value is “2024-07-31-preview”. Note that overriding this default value may result in unsupported behavior.

async authorize_classifier_copy(authorize_copy_request: AuthorizeClassifierCopyRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) ClassifierCopyAuthorization

Generates authorization to copy a document classifier to this location with specified classifierId and optional description.

Parameters:

authorize_copy_request (AuthorizeClassifierCopyRequest or JSON or IO[bytes]) – Authorize copy request parameters. Is one of the following types: AuthorizeClassifierCopyRequest, JSON, IO[bytes] Required.

Returns:

ClassifierCopyAuthorization. The ClassifierCopyAuthorization is compatible with MutableMapping

Return type:

ClassifierCopyAuthorization

Raises:

HttpResponseError

async authorize_model_copy(authorize_copy_request: AuthorizeCopyRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) CopyAuthorization

Generates authorization to copy a document model to this location with specified modelId and optional description.

Parameters:

authorize_copy_request (AuthorizeCopyRequest or JSON or IO[bytes]) – Authorize copy request parameters. Is one of the following types: AuthorizeCopyRequest, JSON, IO[bytes] Required.

Returns:

CopyAuthorization. The CopyAuthorization is compatible with MutableMapping

Return type:

CopyAuthorization

Raises:

HttpResponseError

async begin_build_classifier(build_request: BuildDocumentClassifierRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) AsyncLROPoller[DocumentClassifierDetails]

Builds a custom document classifier.

Parameters:

build_request (BuildDocumentClassifierRequest or JSON or IO[bytes]) – Build request parameters. Is one of the following types: BuildDocumentClassifierRequest, JSON, IO[bytes] Required.

Returns:

An instance of AsyncLROPoller that returns DocumentClassifierDetails. The DocumentClassifierDetails is compatible with MutableMapping

Return type:

AsyncLROPoller[DocumentClassifierDetails]

Raises:

HttpResponseError

async begin_build_document_model(build_request: BuildDocumentModelRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) AsyncLROPoller[DocumentModelDetails]

Builds a custom document analysis model.

Parameters:

build_request (BuildDocumentModelRequest or JSON or IO[bytes]) – Build request parameters. Is one of the following types: BuildDocumentModelRequest, JSON, IO[bytes] Required.

Returns:

An instance of AsyncLROPoller that returns DocumentModelDetails. The DocumentModelDetails is compatible with MutableMapping

Return type:

AsyncLROPoller[DocumentModelDetails]

Raises:

HttpResponseError

async begin_compose_model(compose_request: ComposeDocumentModelRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) AsyncLROPoller[DocumentModelDetails]

Creates a new document model from document types of existing document models.

Parameters:

compose_request (ComposeDocumentModelRequest or JSON or IO[bytes]) – Compose request parameters. Is one of the following types: ComposeDocumentModelRequest, JSON, IO[bytes] Required.

Returns:

An instance of AsyncLROPoller that returns DocumentModelDetails. The DocumentModelDetails is compatible with MutableMapping

Return type:

AsyncLROPoller[DocumentModelDetails]

Raises:

HttpResponseError

async begin_copy_classifier_to(classifier_id: str, copy_to_request: ClassifierCopyAuthorization | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) AsyncLROPoller[DocumentClassifierDetails]

Copies document classifier to the target resource, region, and classifierId.

Parameters:
  • classifier_id (str) – Unique document classifier name. Required.

  • copy_to_request (ClassifierCopyAuthorization or JSON or IO[bytes]) – Copy to request parameters. Is one of the following types: ClassifierCopyAuthorization, JSON, IO[bytes] Required.

Returns:

An instance of AsyncLROPoller that returns DocumentClassifierDetails. The DocumentClassifierDetails is compatible with MutableMapping

Return type:

AsyncLROPoller[DocumentClassifierDetails]

Raises:

HttpResponseError

async begin_copy_model_to(model_id: str, copy_to_request: CopyAuthorization | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) AsyncLROPoller[DocumentModelDetails]

Copies document model to the target resource, region, and modelId.

Parameters:
  • model_id (str) – Unique document model name. Required.

  • copy_to_request (CopyAuthorization or JSON or IO[bytes]) – Copy to request parameters. Is one of the following types: CopyAuthorization, JSON, IO[bytes] Required.

Returns:

An instance of AsyncLROPoller that returns DocumentModelDetails. The DocumentModelDetails is compatible with MutableMapping

Return type:

AsyncLROPoller[DocumentModelDetails]

Raises:

HttpResponseError

async close() None[source]
async delete_classifier(classifier_id: str, **kwargs: Any) None

Deletes document classifier.

Parameters:

classifier_id (str) – Unique document classifier name. Required.

Returns:

None

Return type:

None

Raises:

HttpResponseError

async delete_model(model_id: str, **kwargs: Any) None

Deletes document model.

Parameters:

model_id (str) – Unique document model name. Required.

Returns:

None

Return type:

None

Raises:

HttpResponseError

async get_classifier(classifier_id: str, **kwargs: Any) DocumentClassifierDetails

Gets detailed document classifier information.

Parameters:

classifier_id (str) – Unique document classifier name. Required.

Returns:

DocumentClassifierDetails. The DocumentClassifierDetails is compatible with MutableMapping

Return type:

DocumentClassifierDetails

Raises:

HttpResponseError

async get_model(model_id: str, **kwargs: Any) DocumentModelDetails

Gets detailed document model information.

Parameters:

model_id (str) – Unique document model name. Required.

Returns:

DocumentModelDetails. The DocumentModelDetails is compatible with MutableMapping

Return type:

DocumentModelDetails

Raises:

HttpResponseError

async get_operation(operation_id: str, **kwargs: Any) OperationDetails

Gets operation info.

Parameters:

operation_id (str) – Operation ID. Required.

Returns:

OperationDetails. The OperationDetails is compatible with MutableMapping

Return type:

OperationDetails

Raises:

HttpResponseError

async get_resource_info(**kwargs: Any) ResourceDetails

Return information about the current resource.

Returns:

ResourceDetails. The ResourceDetails is compatible with MutableMapping

Return type:

ResourceDetails

Raises:

HttpResponseError

list_classifiers(**kwargs: Any) AsyncIterable[DocumentClassifierDetails]

List all document classifiers.

Returns:

An iterator like instance of DocumentClassifierDetails

Return type:

AsyncItemPaged[DocumentClassifierDetails]

Raises:

HttpResponseError

list_models(**kwargs: Any) AsyncIterable[DocumentModelDetails]

List all document models.

Returns:

An iterator like instance of DocumentModelDetails

Return type:

AsyncItemPaged[DocumentModelDetails]

Raises:

HttpResponseError

list_operations(**kwargs: Any) AsyncIterable[OperationDetails]

Lists all operations.

Returns:

An iterator like instance of OperationDetails

Return type:

AsyncItemPaged[OperationDetails]

Raises:

HttpResponseError

send_request(request: HttpRequest, *, stream: bool = False, **kwargs: Any) Awaitable[AsyncHttpResponse][source]

Runs the network request through the client’s chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

Parameters:

request (HttpRequest) – The network request you want to make. Required.

Keyword Arguments:

stream (bool) – Whether the response payload will be streamed. Defaults to False.

Returns:

The response of your network call. Does not do error handling on your response.

Return type:

AsyncHttpResponse

class azure.ai.documentintelligence.aio.DocumentIntelligenceClient(endpoint: str, credential: AzureKeyCredential | AsyncTokenCredential, **kwargs: Any)[source]

DocumentIntelligenceClient.

Parameters:
  • endpoint (str) – The Document Intelligence service endpoint. Required.

  • credential (AzureKeyCredential or AsyncTokenCredential) – Credential needed for the client to connect to Azure. Is either a AzureKeyCredential type or a TokenCredential type. Required.

Keyword Arguments:

api_version (str) – The API version to use for this operation. Default value is “2024-07-31-preview”. Note that overriding this default value may result in unsupported behavior.

async begin_analyze_batch_documents(model_id: str, analyze_batch_request: AnalyzeBatchDocumentsRequest | MutableMapping[str, Any] | IO[bytes] | None = None, *, pages: str | None = None, locale: str | None = None, string_index_type: str | StringIndexType | None = None, features: List[str | DocumentAnalysisFeature] | None = None, query_fields: List[str] | None = None, output_content_format: str | ContentFormat | None = None, output: List[str | AnalyzeOutputOption] | None = None, **kwargs: Any) AsyncLROPoller[AnalyzeBatchResult]

Analyzes batch documents with document model.

Parameters:
  • model_id (str) – Unique document model name. Required.

  • analyze_batch_request (AnalyzeBatchDocumentsRequest or JSON or IO[bytes]) – Analyze batch request parameters. Is one of the following types: AnalyzeBatchDocumentsRequest, JSON, IO[bytes] Default value is None.

Keyword Arguments:
  • pages (str) – Range of 1-based page numbers to analyze. Ex. “1-3,5,7-9”. Default value is None.

  • locale (str) – Locale hint for text recognition and document analysis. Value may contain only the language code (ex. “en”, “fr”) or BCP 47 language tag (ex. “en-US”). Default value is None.

  • string_index_type (str or StringIndexType) – Method used to compute string offset and length. Known values are: “textElements”, “unicodeCodePoint”, and “utf16CodeUnit”. Default value is None.

  • features (list[str or DocumentAnalysisFeature]) – List of optional analysis features. Default value is None.

  • query_fields (list[str]) – List of additional fields to extract. Ex. “NumberOfGuests,StoreNumber”. Default value is None.

  • output_content_format (str or ContentFormat) – Format of the analyze result top-level content. Known values are: “text” and “markdown”. Default value is None.

  • output (list[str or AnalyzeOutputOption]) – Additional outputs to generate during analysis. Default value is None.

Returns:

An instance of AsyncLROPoller that returns AnalyzeBatchResult. The AnalyzeBatchResult is compatible with MutableMapping

Return type:

AsyncLROPoller[AnalyzeBatchResult]

Raises:

HttpResponseError

async begin_analyze_document(model_id: str, analyze_request: AnalyzeDocumentRequest | MutableMapping[str, Any] | IO[bytes] | None = None, *, pages: str | None = None, locale: str | None = None, string_index_type: str | StringIndexType | None = None, features: List[str | DocumentAnalysisFeature] | None = None, query_fields: List[str] | None = None, output_content_format: str | ContentFormat | None = None, output: List[str | AnalyzeOutputOption] | None = None, **kwargs: Any) AsyncAnalyzeDocumentLROPoller[AnalyzeResult]

Analyzes document with document model.

Parameters:
  • model_id (str) – Unique document model name. Required.

  • analyze_request (AnalyzeDocumentRequest or JSON or IO[bytes]) – Analyze request parameters. Is one of the following types: AnalyzeDocumentRequest, JSON, IO[bytes] Default value is None.

Keyword Arguments:
  • pages (str) – Range of 1-based page numbers to analyze. Ex. “1-3,5,7-9”. Default value is None.

  • locale (str) – Locale hint for text recognition and document analysis. Value may contain only the language code (ex. “en”, “fr”) or BCP 47 language tag (ex. “en-US”). Default value is None.

  • string_index_type (str or StringIndexType) – Method used to compute string offset and length. Known values are: “textElements”, “unicodeCodePoint”, and “utf16CodeUnit”. Default value is None.

  • features (list[str or DocumentAnalysisFeature]) – List of optional analysis features. Default value is None.

  • query_fields (list[str]) – List of additional fields to extract. Ex. “NumberOfGuests,StoreNumber”. Default value is None.

  • output_content_format (str or ContentFormat) – Format of the analyze result top-level content. Known values are: “text” and “markdown”. Default value is None.

  • output (list[str or AnalyzeOutputOption]) – Additional outputs to generate during analysis. Default value is None.

Returns:

An instance of AsyncAnalyzeDocumentLROPoller that returns AnalyzeResult. The AnalyzeResult is compatible with MutableMapping

Return type:

AsyncAnalyzeDocumentLROPoller[AnalyzeResult]

Raises:

HttpResponseError

async begin_classify_document(classifier_id: str, classify_request: ClassifyDocumentRequest | MutableMapping[str, Any] | IO[bytes], *, string_index_type: str | StringIndexType | None = None, split: str | SplitMode | None = None, pages: str | None = None, **kwargs: Any) AsyncLROPoller[AnalyzeResult]

Classifies document with document classifier.

Parameters:
  • classifier_id (str) – Unique document classifier name. Required.

  • classify_request (ClassifyDocumentRequest or JSON or IO[bytes]) – Classify request parameters. Is one of the following types: ClassifyDocumentRequest, JSON, IO[bytes] Required.

Keyword Arguments:
  • string_index_type (str or StringIndexType) – Method used to compute string offset and length. Known values are: “textElements”, “unicodeCodePoint”, and “utf16CodeUnit”. Default value is None.

  • split (str or SplitMode) – Document splitting mode. Known values are: “auto”, “none”, and “perPage”. Default value is None.

  • pages (str) – Range of 1-based page numbers to analyze. Ex. “1-3,5,7-9”. Default value is None.

Returns:

An instance of AsyncLROPoller that returns AnalyzeResult. The AnalyzeResult is compatible with MutableMapping

Return type:

AsyncLROPoller[AnalyzeResult]

Raises:

HttpResponseError

async close() None[source]
async get_analyze_result_figure(model_id: str, result_id: str, figure_id: str, **kwargs: Any) AsyncIterator[bytes]

Gets the generated cropped image of specified figure from document analysis.

Parameters:
  • model_id (str) – Unique document model name. Required.

  • result_id (str) – Analyze operation result ID. Required.

  • figure_id (str) – Figure ID. Required.

Returns:

AsyncIterator[bytes]

Return type:

AsyncIterator[bytes]

Raises:

HttpResponseError

async get_analyze_result_pdf(model_id: str, result_id: str, **kwargs: Any) AsyncIterator[bytes]

Gets the generated searchable PDF output from document analysis.

Parameters:
  • model_id (str) – Unique document model name. Required.

  • result_id (str) – Analyze operation result ID. Required.

Returns:

AsyncIterator[bytes]

Return type:

AsyncIterator[bytes]

Raises:

HttpResponseError

send_request(request: HttpRequest, *, stream: bool = False, **kwargs: Any) Awaitable[AsyncHttpResponse][source]

Runs the network request through the client’s chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

Parameters:

request (HttpRequest) – The network request you want to make. Required.

Keyword Arguments:

stream (bool) – Whether the response payload will be streamed. Defaults to False.

Returns:

The response of your network call. Does not do error handling on your response.

Return type:

AsyncHttpResponse