I’m working with Google Document AI in Python to process JPG images and extract entities, but I’m encountering some issues. I’ve successfully set up a Document AI processor (Form Parser) and tested it on the console, where the entities were extracted correctly from the same document. However, when I try to do the same via Python, the entities field is coming back empty.
Has anyone encountered a similar issue where entities are not being extracted in Python but are correctly extracted in the console? Am I missing something in the request setup? Any help or suggestions would be greatly appreciated!
Thank you!
1 Like
It sounds like you’re encountering a mismatch between how the Document AI Form Parser works in the console versus in your Python setup. Here are a few things to check that might help resolve the issue :-
-
Processor Type
-
Image Encoding
-
Processor Configuration
-
Region-Specific Endpoint
-
API Permissions
-
Document MIME Type
If you’ve already checked these but the issue persists, you can try logging the request and response objects to see if there’s any discrepancy compared to the console.
Hi, I have already checked all the items you mentioned, but the issue still persists. I’ve only tested the function’s return so far, and the entities are coming back empty. Could you advise on how I can test and log the request and response objects to better diagnose the issue?
1 Like
To diagnose the issue with your function returning empty entities, it would be helpful to log both the request and response objects. This will give you insight into what is being sent to the API and what is being returned.
Here’s how you can log the request and response in Python:-
-
Logging the request
-
Logging the response
Additional Debugging Steps
-
Validate the Image Input
-
Check for Permissions
-
Enable Debug Logging