Closed jacopo-m closed 3 months ago
Thank you for your feedback. Tagging and routing to the team member best able to assist.
Hi @jacopo-m , changing this line
ct = poller.continuation_token
to
ct = poller.continuation_token()
will do the trick :)
Hi @jacopo-m. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.
/unresolve
Thank you @kashifkhan for the suggestion. I tried before submitting the issue but this still gets me an error. With the following code
with open(doc_path, "rb") as pdf_file:
poller = document_analysis_client.begin_analyze_document(
analyze_request=pdf_file,
content_type="application/octet-stream",
model_id="prebuilt-layout",
locale=language_locale,
)
ct = poller.continuation_token()
I get this error (at the moment I am testing using azure-ai-documentintelligence 1.0.0b3)
return base64.b64encode(pickle.dumps(self._initial_response)).decode("ascii") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: cannot pickle '_io.BufferedReader' object
@kashifkhan seems like the issue was related to how I was serving the PDF to Doc Intelligence. In the code below I added a '.read()' to the pdf_file variable and the continuation_token is indeed created and working like a charm :)
Thank you.
with open(doc_path, "rb") as pdf_file:
poller = document_analysis_client.begin_analyze_document(
analyze_request=pdf_file.read(),
content_type="application/octet-stream",
model_id="prebuilt-layout",
locale=language_locale,
pages=specific_pages,
)
ct = poller.continuation_token()
new_poller = document_analysis_client.begin_analyze_document(
model_id="prebuilt-layout",
continuation_token = ct)
print(new_poller.status())
data = new_poller.result()
Describe the bug I am trying to create a LROPoller object starting from a continuation_token received from a DocumentIntelligenceClient.begin_analyze_document operation. However when I try to create the LROPoller using the token i get the following error
An error occurred: argument should be a bytes-like object or ASCII string, not 'method'
To Reproduce
Expected behavior I need to extract the continuation token, save it and be able to access the poller object so that the extracted information can be accessed in a different environment
Additional context This s needed so that i can start the extraction operation in a AWS Lambda, save the continuation token and then recreat the LROPoller object and poll the object with a step function.