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-11-30”. Note that overriding this default value may result in unsupported behavior.

async authorize_classifier_copy(body: 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:

body (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(body: AuthorizeCopyRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) ModelCopyAuthorization

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

Parameters:

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

Returns:

ModelCopyAuthorization. The ModelCopyAuthorization is compatible with MutableMapping

Return type:

ModelCopyAuthorization

Raises:

HttpResponseError

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

Builds a custom document classifier.

Parameters:

body (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(body: BuildDocumentModelRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) AsyncLROPoller[DocumentModelDetails]

Builds a custom document analysis model.

Parameters:

body (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(body: ComposeDocumentModelRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) AsyncLROPoller[DocumentModelDetails]

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

Parameters:

body (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, body: 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.

  • body (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, body: ModelCopyAuthorization | 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.

  • body (ModelCopyAuthorization or JSON or IO[bytes]) – Copy to request parameters. Is one of the following types: ModelCopyAuthorization, 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) DocumentIntelligenceOperationDetails

Gets operation info.

Parameters:

operation_id (str) – Operation ID. Required.

Returns:

DocumentIntelligenceOperationDetails. The DocumentIntelligenceOperationDetails is compatible with MutableMapping

Return type:

DocumentIntelligenceOperationDetails

Raises:

HttpResponseError

async get_resource_details(**kwargs: Any) DocumentIntelligenceResourceDetails

Return information about the current resource.

Returns:

DocumentIntelligenceResourceDetails. The DocumentIntelligenceResourceDetails is compatible with MutableMapping

Return type:

DocumentIntelligenceResourceDetails

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[DocumentIntelligenceOperationDetails]

Lists all operations.

Returns:

An iterator like instance of DocumentIntelligenceOperationDetails

Return type:

AsyncItemPaged[DocumentIntelligenceOperationDetails]

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-11-30”. Note that overriding this default value may result in unsupported behavior.

async begin_analyze_batch_documents(model_id: str, body: AnalyzeBatchDocumentsRequest | MutableMapping[str, Any] | IO[bytes], *, 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 | DocumentContentFormat | 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.

  • body (AnalyzeBatchDocumentsRequest or JSON or IO[bytes]) – Analyze batch request parameters. Is one of the following types: AnalyzeBatchDocumentsRequest, JSON, IO[bytes] Required.

Keyword Arguments:
  • pages (str) – 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 DocumentContentFormat) – 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, body: AnalyzeDocumentRequest | MutableMapping[str, Any] | IO[bytes], *, 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 | DocumentContentFormat | 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.

  • body (AnalyzeDocumentRequest or JSON or IO[bytes]) – Analyze request parameters. Is one of the following types: AnalyzeDocumentRequest, JSON, IO[bytes]. Required.

Keyword Arguments:
  • pages (str) – 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 DocumentContentFormat) – 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, body: 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.

  • body (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) – 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 delete_analyze_batch_result(model_id: str, result_id: str, **kwargs: Any) None

Mark the batch document analysis result for deletion.

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

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

Returns:

None

Return type:

None

Raises:

HttpResponseError

async delete_analyze_result(model_id: str, result_id: str, **kwargs: Any) None

Mark the result of document analysis for deletion.

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

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

Returns:

None

Return type:

None

Raises:

HttpResponseError

async get_analyze_batch_result(continuation_token: str) AsyncLROPoller[AnalyzeBatchResult]

Gets the result of batch document analysis.

Parameters:

continuation_token (str) – An opaque continuation token. Required.

Returns:

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

Return type:

AsyncLROPoller[AnalyzeBatchResult]

Raises:

HttpResponseError

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

list_analyze_batch_results(model_id: str, **kwargs: Any) AsyncIterable[AnalyzeBatchOperation]

List batch document analysis results.

Parameters:

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

Returns:

An iterator like instance of AnalyzeBatchOperation

Return type:

AsyncItemPaged[AnalyzeBatchOperation]

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