ContentUnderstandingClient Class
Custom ContentUnderstandingClient with static patches for analyze operations.
This wrapper:
- Hides the string_encoding parameter (always uses "codePoint" for Python)
- Returns AnalyzeLROPoller with .operation_id property
- Fixes content_type default for begin_analyze_binary
- Defaults polling_interval to 3 seconds
Constructor
ContentUnderstandingClient(endpoint: str, credential: AzureKeyCredential | TokenCredential, **kwargs: Any)
Parameters
| Name | Description |
|---|---|
|
endpoint
Required
|
Content Understanding service endpoint. Required. |
|
credential
Required
|
Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
api_version
|
The API version to use for this operation. Default value is "2025-11-01". Note that overriding this default value may result in unsupported behavior. |
|
polling_interval
|
Default waiting time between two polls for LRO operations if no Retry-After header is present. Default value is 3 seconds. |
Methods
| begin_analyze |
Extract content and fields from input. Note The string_encoding parameter is automatically set to "codePoint" for Python as it matches Python's native string indexing behavior (len() and str[i] use code points). This ensures ContentSpan offsets work correctly with Python string slicing. |
| begin_analyze_binary |
Extract content and fields from input. Note The string_encoding parameter is automatically set to "codePoint" for Python as it matches Python's native string indexing behavior (len() and str[i] use code points). This ensures ContentSpan offsets work correctly with Python string slicing. |
| begin_copy_analyzer |
Create a copy of the source analyzer to the current location. |
| begin_create_analyzer |
Create a new analyzer asynchronously. |
| close | |
| delete_analyzer |
Delete analyzer. |
| delete_result |
Mark the result of an analysis operation for deletion. |
| get_analyzer |
Get analyzer properties. |
| get_defaults |
Return default settings for this Content Understanding resource. |
| get_result_file |
Get a file associated with the result of an analysis operation. |
| grant_copy_authorization |
Get authorization for copying this analyzer to another location. |
| list_analyzers |
List analyzers. |
| send_request |
Runs the network request through the client's chained policies.
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request |
| update_analyzer |
Update analyzer properties. |
| update_defaults |
Update default settings for this Content Understanding resource. |
begin_analyze
Extract content and fields from input.
Note
The string_encoding parameter is automatically set to "codePoint" for Python as it
matches Python's native string indexing behavior (len() and str[i] use code points).
This ensures ContentSpan offsets work correctly with Python string slicing.
begin_analyze(analyzer_id: str, *, inputs: list[_models.AnalysisInput], model_deployments: dict[str, str] | None = None, processing_location: str | _models.ProcessingLocation | None = None, **kwargs: Any) -> AnalyzeLROPoller[_models.AnalysisResult]
Parameters
| Name | Description |
|---|---|
|
analyzer_id
Required
|
The unique identifier of the analyzer. Required. |
|
body
|
Is either a JSON type or a IO[bytes] type. Default value is None. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
inputs
|
Inputs to analyze. Currently, only pro mode supports multiple inputs. Required. Default value: <object object at 0x000002B0C24FE830>
|
|
model_deployments
|
Override default mapping of model names to deployments. Ex. { "gpt-4.1": "myGpt41Deployment", "text-embedding-3-large": "myTextEmbedding3LargeDeployment" }. Default value is None. Default value: None
|
|
processing_location
|
The location where the data may be processed. Defaults to global. Known values are: "geography", "dataZone", and "global". Default value is None. Default value: None
|
|
content_type
|
Body Parameter content-type. Default value is "application/json". Default value: None
|
Returns
| Type | Description |
|---|---|
|
An instance of AnalyzeLROPoller that returns AnalysisResult. The AnalysisResult is compatible with MutableMapping. The poller includes an .operation_id property. |
Exceptions
| Type | Description |
|---|---|
begin_analyze_binary
Extract content and fields from input.
Note
The string_encoding parameter is automatically set to "codePoint" for Python as it
matches Python's native string indexing behavior (len() and str[i] use code points).
This ensures ContentSpan offsets work correctly with Python string slicing.
begin_analyze_binary(analyzer_id: str, binary_input: bytes, *, content_range: str | None = None, content_type: str = 'application/octet-stream', processing_location: str | ProcessingLocation | None = None, **kwargs: Any) -> AnalyzeLROPoller[AnalysisResult]
Parameters
| Name | Description |
|---|---|
|
analyzer_id
Required
|
The unique identifier of the analyzer. Required. |
|
binary_input
Required
|
The binary content of the document to analyze. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
content_range
|
Range of the input to analyze (ex. Default value: None
|
|
content_type
|
Body Parameter content-type. Content type parameter for binary body. Default value is "application/octet-stream". Default value: application/octet-stream
|
|
processing_location
|
The location where the data may be processed. Defaults to global. Known values are: "geography", "dataZone", and "global". Default value is None. Default value: None
|
Returns
| Type | Description |
|---|---|
|
An instance of AnalyzeLROPoller that returns AnalysisResult. The AnalysisResult is compatible with MutableMapping. The poller includes an .operation_id property. |
Exceptions
| Type | Description |
|---|---|
begin_copy_analyzer
Create a copy of the source analyzer to the current location.
begin_copy_analyzer(analyzer_id: str, body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, source_analyzer_id: str = <object object>, allow_replace: bool | None = None, source_azure_resource_id: str | None = None, source_region: str | None = None, **kwargs: ~typing.Any) -> LROPoller[ContentAnalyzer]
Parameters
| Name | Description |
|---|---|
|
analyzer_id
Required
|
The unique identifier of the analyzer. Required. |
|
body
|
Is either a JSON type or a IO[bytes] type. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
source_analyzer_id
|
Source analyzer ID. Required. Default value: <object object at 0x000002B0C24FE840>
|
|
allow_replace
|
Allow the operation to replace an existing resource. Default value is None. Default value: None
|
|
source_azure_resource_id
|
Azure resource ID of the source analyzer location. Defaults to the current resource. Default value is None. Default value: None
|
|
source_region
|
Azure region of the source analyzer location. Defaults to current region. Default value is None. Default value: None
|
Returns
| Type | Description |
|---|---|
|
An instance of LROPoller that returns ContentAnalyzer. The ContentAnalyzer is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
begin_create_analyzer
Create a new analyzer asynchronously.
begin_create_analyzer(analyzer_id: str, resource: ContentAnalyzer | MutableMapping[str, Any] | IO[bytes], *, allow_replace: bool | None = None, **kwargs: Any) -> LROPoller[ContentAnalyzer]
Parameters
| Name | Description |
|---|---|
|
analyzer_id
Required
|
The unique identifier of the analyzer. Required. |
|
resource
Required
|
The resource instance. Is one of the following types: ContentAnalyzer, JSON, IO[bytes] Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
allow_replace
|
Allow the operation to replace an existing resource. Default value is None. Default value: None
|
Returns
| Type | Description |
|---|---|
|
An instance of LROPoller that returns ContentAnalyzer. The ContentAnalyzer is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
close
close() -> None
delete_analyzer
Delete analyzer.
delete_analyzer(analyzer_id: str, **kwargs: Any) -> None
Parameters
| Name | Description |
|---|---|
|
analyzer_id
Required
|
The unique identifier of the analyzer. Required. |
Returns
| Type | Description |
|---|---|
|
None |
Exceptions
| Type | Description |
|---|---|
delete_result
Mark the result of an analysis operation for deletion.
delete_result(operation_id: str, **kwargs: Any) -> None
Parameters
| Name | Description |
|---|---|
|
operation_id
Required
|
Operation identifier. Required. |
Returns
| Type | Description |
|---|---|
|
None |
Exceptions
| Type | Description |
|---|---|
get_analyzer
Get analyzer properties.
get_analyzer(analyzer_id: str, **kwargs: Any) -> ContentAnalyzer
Parameters
| Name | Description |
|---|---|
|
analyzer_id
Required
|
The unique identifier of the analyzer. Required. |
Returns
| Type | Description |
|---|---|
|
ContentAnalyzer. The ContentAnalyzer is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
get_defaults
Return default settings for this Content Understanding resource.
get_defaults(**kwargs: Any) -> ContentUnderstandingDefaults
Returns
| Type | Description |
|---|---|
|
ContentUnderstandingDefaults. The ContentUnderstandingDefaults is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
get_result_file
Get a file associated with the result of an analysis operation.
get_result_file(operation_id: str, path: str, **kwargs: Any) -> Iterator[bytes]
Parameters
| Name | Description |
|---|---|
|
operation_id
Required
|
Operation identifier. Required. |
|
path
Required
|
File path. Required. |
Returns
| Type | Description |
|---|---|
|
Iterator[bytes] |
Exceptions
| Type | Description |
|---|---|
grant_copy_authorization
Get authorization for copying this analyzer to another location.
grant_copy_authorization(analyzer_id: str, body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, target_azure_resource_id: str = <object object>, target_region: str | None = None, **kwargs: ~typing.Any) -> CopyAuthorization
Parameters
| Name | Description |
|---|---|
|
analyzer_id
Required
|
The unique identifier of the analyzer. Required. |
|
body
|
Is either a JSON type or a IO[bytes] type. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
target_azure_resource_id
|
Azure resource ID of the target analyzer location. Required. Default value: <object object at 0x000002B0C24FE840>
|
|
target_region
|
Azure region of the target analyzer location. Defaults to current region. Default value is None. Default value: None
|
Returns
| Type | Description |
|---|---|
|
CopyAuthorization. The CopyAuthorization is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
list_analyzers
List analyzers.
list_analyzers(**kwargs: Any) -> ItemPaged[ContentAnalyzer]
Returns
| Type | Description |
|---|---|
|
An iterator like instance of ContentAnalyzer |
Exceptions
| Type | Description |
|---|---|
send_request
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 = client.send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
send_request(request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse
Parameters
| Name | Description |
|---|---|
|
request
Required
|
The network request you want to make. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
stream
|
Whether the response payload will be streamed. Defaults to False. Default value: False
|
Returns
| Type | Description |
|---|---|
|
The response of your network call. Does not do error handling on your response. |
update_analyzer
Update analyzer properties.
update_analyzer(analyzer_id: str, resource: ContentAnalyzer | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> ContentAnalyzer
Parameters
| Name | Description |
|---|---|
|
analyzer_id
Required
|
The unique identifier of the analyzer. Required. |
|
resource
Required
|
The resource instance. Is one of the following types: ContentAnalyzer, JSON, IO[bytes] Required. |
Returns
| Type | Description |
|---|---|
|
ContentAnalyzer. The ContentAnalyzer is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
update_defaults
Update default settings for this Content Understanding resource.
update_defaults(body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, model_deployments: ~typing.Dict[str, str] | None = None, **kwargs: ~typing.Any) -> ContentUnderstandingDefaults
Parameters
| Name | Description |
|---|---|
|
body
|
Is either a JSON type or a IO[bytes] type. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
model_deployments
|
<xref:azure.ai.contentunderstanding.models.RecordMergePatchUpdate>
Specify the default mapping of model names to LLM/embedding deployments in Microsoft Foundry. For details and current semantics, see https://aka.ms/cudoc-quickstart-rest. Default value is None. Default value: None
|
Returns
| Type | Description |
|---|---|
|
ContentUnderstandingDefaults. The ContentUnderstandingDefaults is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|