feat: Implement OCR and native vision support for Doc Event file attachments#257
Open
Sanjusha-tridz wants to merge 4 commits into
Open
feat: Implement OCR and native vision support for Doc Event file attachments#257Sanjusha-tridz wants to merge 4 commits into
Sanjusha-tridz wants to merge 4 commits into
Conversation
- Added 'files=None' to the 'run_agent_sync' function signature to resolve a 'TypeError' when triggered by Doc Events. - Included the 'files' array in the execution 'context' dictionary so that attachment metadata correctly propagates downstream to the AI provider context runner.
- Added logic to dynamically extract attached file URLs from specified 'DocField' or 'Child Table Field' sources. - Implemented MIME type checking to differentiate between image and non-image document attachments. - Integrated 'handle_ocr_document' via an asyncio event loop to automatically perform OCR on non-image files (like PDFs) and seamlessly prepend the extracted text to the agent's prompt context.
- Updated 'run' and 'run_stream' methods to extract 'files' from the execution context. - Implemented logic to automatically filter files by 'is_image' and append them directly to the 'user_content' payload as 'image_url' blocks. - This ensures multi-modal image support is natively handled for LLMs when files are attached during Doc Events.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.