Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.35k stars 2.71k forks source link

Sample broken... #35893

Closed jainparakh closed 1 day ago

jainparakh commented 3 weeks ago

Steps to reproduce -

  1. Create a new Doc Intelligence Resource
  2. Try to use the python SDK sample

Expected:

Actual: Throws:

Inner error: { "code": "ParameterMissing", "message": "The parameter urlSource or base64Source is required."

jainparakh commented 3 weeks ago

Same issue as here - https://learn.microsoft.com/en-us/answers/questions/1639700/unable-to-use-new-api-for-document-intelligence

Please fix this

xiangyan99 commented 3 weeks ago

Thanks for the feedback, we’ll investigate asap.

YalinLi0312 commented 3 weeks ago

Hi @jainparakh , I've tried the layout model sample in this doc(link) but didn't see any errors. Based on the error you got, I looks the issue is from using begin_analyze_document(). Can you provide the package name, package version and code snippet for how you're using begin_analyze_document()? These would help us to reproduce and investigate the issue.

In general, if you're analyzing a doc from local, you can pass it directly or wrap it to a AnalyzeDocumentRequest object. e.g.

with open(path_to_sample_documents, "rb") as f:
    poller = document_intelligence_client.begin_analyze_document(
        "prebuilt-layout",
        analyze_request=f, # pass it directly
        content_type="application/octet-stream",
    )
result = poller.result()
with open(path_to_sample_documents, "rb") as f:
    poller = document_intelligence_client.begin_analyze_document(
        "prebuilt-layout",
        AnalyzeDocumentRequest(bytes_source=f.read()), # pass it to "AnalyzeDocumentRequest"
    )
result = poller.result()

Note: we've changed the parameter name in "AnalyzeDocumentRequest" from "base64_source" to "bytes_source" since azure-ai-documentintelligence package version 1.0.0b2 as we expect the input in bytes, not in base64 encoded. If you're analyzing a doc from remote, you can pass the url in "AnalyzeDocumentRequest" like this:

poller = document_intelligence_client.begin_analyze_document(
    "prebuilt-layout", AnalyzeDocumentRequest(url_source=url)
)
github-actions[bot] commented 3 weeks ago

Hi @jainparakh. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] commented 2 weeks ago

Hi @jainparakh, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!