-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DocumentIntelligenceClient raising a TypeError - begin_analyze_document() missing 'body' #2244
Comments
I'm in the same situation. You could use this one. async with DocumentIntelligenceClient(
endpoint=self.endpoint, credential=self.credential
) as document_intelligence_client:
if self.use_content_understanding:
if self.content_understanding_endpoint is None:
raise ValueError("Content Understanding is enabled but no endpoint was provided")
if isinstance(self.credential, AzureKeyCredential):
raise ValueError(
"AzureKeyCredential is not supported for Content Understanding, use keyless auth instead"
)
cu_describer = ContentUnderstandingDescriber(self.content_understanding_endpoint, self.credential)
content_bytes = content.read()
poller = await document_intelligence_client.begin_analyze_document(
model_id="prebuilt-layout",
body=AnalyzeDocumentRequest(bytes_source=content_bytes), # analyze_request -> body
output=["figures"],
features=["ocrHighResolution"],
output_content_format="markdown",
)
doc_for_pymupdf = pymupdf.open(stream=io.BytesIO(content_bytes))
else:
poller = await document_intelligence_client.begin_analyze_document(
model_id=self.model_id, analyze_request=content, content_type="application/octet-stream"
)
analyze_result: AnalyzeResult = await poller.result() |
Yeah, I have this too. Will do a pull request this weekend, just waiting to run the required tests. |
I tried this solution and it worked for me: Azure/azure-sdk-for-python#38622 |
This issue is for a: (mark with an
x
)Minimal steps to reproduce
pdfparser.py
file that uses theDocumentIntelligenceClient
withbegin_analyze_document
.pymupdf
, etc.) are installed.begin_analyze_document
.Log message
TypeError: DocumentIntelligenceClientOperationsMixin.begin_analyze_document() missing 1 required positional argument: 'body'
Expected/desired behavior
The
begin_analyze_document
method should successfully process the document without raising aTypeError
.Versions
Useful details
The problem arises when calling the
begin_analyze_document
method on theDocumentIntelligenceClient
. The error suggests that the requiredbody
argument is not being provided. Below is the relevant code snippet:The text was updated successfully, but these errors were encountered: