Hi Sergiy Fomkin,
Welcome to Azure ML Q and A forum. Thank you for posting your query.
Azure Document Intelligence supports batch analysis for certain models, but not all custom models can process multiple documents at once.
Before using batch analysis, check if your custom model works on a single document:
const { DocumentIntelligenceClient } = require("@azure/ai-document-intelligence-rest");
// Replace with your Azure endpoint and API key
const endpoint = "https://<your-resource-name>.cognitiveservices.azure.com/";
const apiKey = "<your-api-key>";
const modelId = "<your-custom-model-id>";
const documentUrl = "<your-document-url>";
const client = new DocumentIntelligenceClient(endpoint, new AzureKeyCredential(apiKey));
async function analyzeSingleDocument() {
try {
const poller = await client.beginAnalyzeDocument(modelId, documentUrl);
const result = await poller.pollUntilDone();
console.log("Analysis Result:", result);
} catch (error) {
console.error("Error analyzing document:", error);
}
}
analyzeSingleDocument();
If this works, but batch analysis fails, your model may not support batch processing.
If this fails, check if your model is properly trained and deployed.
Also Check with model Capabilities:
To verify if your model supports batch analysis, run this command to list models and their capabilities:
const models = await client.listModels();
for await (const model of models) {
console.log(`Model ID: ${model.modelId}, Status: ${model.status}, Model Type: ${model.modelType}`);
}
Prebuilt models (e.g., "prebuilt-layout") support batch analysis.
Custom models (e.g., extraction models) may not support batch analysis.
Please refer to below document: Document Intelligence Model Support for further clarifications
And also, Batch document processing may require specific API versions.
Check the Azure API version in your request URL.
Use the latest SDK version:
npm install @azure/ai-document-intelligence-rest
You need to Ensure you are using a REST API version that supports batch processing.
Azure Document Intelligence only supports certain file formats and sizes. If your document doesn't meet these criteria, it can cause an InternalServerError.
Supported Formats Unsupported Formats
PDF (.pdf) Microsoft Word (.docx)
JPEG (.jpg) Excel (.xlsx)
PNG (.png) Text (.txt)
TIFF (.tiff) CSV (.csv)
If your document is in an unsupported format, convert it before sending it to Azure.
You need to validate your file size too before deploying your model
Maximum file size: 50MB
Maximum page limit: 500 pages per document
If your file is too large, try compressing it.
Please refer below document - File Size Limits
Hope this helps. Do let us know if you any further queries.
-------------
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful.
Thank you.