TypeError: DocumentIntelligenceClientOperationsMixin.begin_analyze_document() missing 1 required positional argument: 'body' when trying to use the AzureAIDocumentIntelligenceLoader with the bytes_source parameter #28948
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
Checked other resources
Example Code
This raises a TypeError missing 1 required positional argument: 'body' (trying to use the bytes_source parameter)
Seems like the error is in the
parse_bytes
function of the file/langchain_community/document_loaders/parsers/doc_intelligence.py, line 116
all of the other parsers in this file do not specify the name for the second argument in self.client.begin_analyze_document
Example of working parser:
Parser that does NOT work
The
parse_bytes
function does not work properly, the second parameter should be body=... instead of analyze_request or do not specify the name of the parameter at allError Message and Stack Trace (if applicable)
File "/home/projects/intelligent_chat-be/server/routers/v1/conversation/file_loader.py", line 114, in _load_azure
document = loader.load()
^^^^^^^^^^^^^
File "/home/projects/intelligent_chat-be/.venv/lib/python3.12/site-packages/langchain_core/document_loaders/base.py", line 31, in load
return list(self.lazy_load())
^^^^^^^^^^^^^^^^^^^^^^
File "/home/projects/intelligent_chat-be/.venv/lib/python3.12/site-packages/langchain_community/document_loaders/doc_intelligence.py", line 105, in lazy_load
yield from self.parser.parse_bytes(self.bytes_source)
File "/home/projects/intelligent_chat-be/.venv/lib/python3.12/site-packages/langchain_community/document_loaders/parsers/doc_intelligence.py", line 116, in parse_bytes
poller = self.client.begin_analyze_document(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/projects/intelligent_chat-be/.venv/lib/python3.12/site-packages/azure/core/tracing/decorator.py", line 94, in wrapper_use_tracer
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
TypeError: DocumentIntelligenceClientOperationsMixin.begin_analyze_document() missing 1 required positional argument: 'body'
Description
I'm trying to use the azure document intelligence loader from langchain to process a sequence of bytes
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: