An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
How can I get the result of azure document intelligence get_analyze_batch_result
Krishan Patel
0
Reputation points
I am setting up a batch request to azure document intelligence using the async interface like the following and saving the continuation token. Then in a queue I poll the job using the previously saved continuation token and print out all the statuses. However even when the result is present, and therefore the analysis job is completed, the done() still returns False and status() still says InProgress. This means I can never tell when the batch job is complete without manually checking the storage account.
Is there another way around this? Or can this get fixed?
async def main() -> None:
continuation_token = "<CONTINUATION_TOKEN>"
_document_intelligence_client = DocumentIntelligenceClient(
endpoint="https://index-poc-prod-doc-intelligence.cognitiveservices.azure.com/",
credential=AzureKeyCredential("<PROD DOC INTELLIGENCE CRED>"),
)
poller = await _document_intelligence_client.get_analyze_batch_result(continuation_token)
print(f"Poller done: {poller.done()}")
print(f"Poller status: {poller.status()}")
result: AnalyzeBatchResult = await poller.result()
print(f"Poller succeeded count: {result.succeeded_count}")
print(f"Poller failed count: {result.failed_count}")
print(f"Poller skipped count: {result.skipped_count}")
if __name__ == "__main__":
import asyncio
asyncio.run(main())
"""
Poller done: False
Poller status: InProgress
Poller succeeded count: 5
Poller failed count: 0
Poller skipped count: 0
"""
Azure Document Intelligence in Foundry Tools
Azure Document Intelligence in Foundry Tools
Sign in to answer