feat: add AG2 multi-agent document processing example#4326
Open
faridun-ag2 wants to merge 2 commits intoUnstructured-IO:mainfrom
Open
feat: add AG2 multi-agent document processing example#4326faridun-ag2 wants to merge 2 commits intoUnstructured-IO:mainfrom
faridun-ag2 wants to merge 2 commits intoUnstructured-IO:mainfrom
Conversation
Demonstrate AG2 (formerly AutoGen) multi-agent framework with Unstructured for intelligent document processing and analysis. Two agents collaborate: - Document Agent: partitions docs via Unstructured (25+ file types) - Analyst Agent: analyzes extracted elements, produces summaries Includes: - examples/ag2_multiagent_document_processing/run.py — main script - examples/ag2_multiagent_document_processing/test_e2e.py — 12 e2e tests - examples/ag2_multiagent_document_processing/README.md — setup guide
…red-IO#4320) Address issue Unstructured-IO#4320 by leveraging existing detection_class_prob metadata: - Use hi_res strategy by default for PDFs to get confidence scores - format_elements_summary displays [conf=X.XX] and [origin=...] per element - New filter_elements_by_confidence() filters low-confidence extractions - New AG2 tool filter_low_confidence lets agents filter noisy elements - find_sample_document prefers PDFs for richer confidence demo - 5 new tests for confidence filtering (16 total offline tests)
Author
|
Hi @cragwolfe @qued ! Happy to address any feedback. Thanks! |
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.
Summary
Add an example demonstrating AG2 (formerly AutoGen) multi-agent framework combined with Unstructured for intelligent document processing and analysis.
Also addresses #4320 (confidence scores) by showcasing the existing
detection_class_probmetadata — agents can filter low-confidence extractions for better RAG quality.What's included
examples/ag2_multiagent_document_processing/run.py— Main example scriptexamples/ag2_multiagent_document_processing/test_e2e.py— 17 end-to-end testsexamples/ag2_multiagent_document_processing/README.md— Setup instructionsHow it works
Key features
[conf=X.XX]scores from Hi-Res detection model; agents can filter low-confidence extractions viafilter_low_confidencetoolpython run.py --file path/to/document.pdfConfidence scores demo (addresses #4320)
When processing PDFs with Hi-Res strategy, each element shows its detection confidence:
The
filter_low_confidenceAG2 tool lets agents filter noisy elements:Testing
Why AG2?
AG2 is a major multi-agent framework with 500K+ monthly PyPI downloads and 4,300+ GitHub stars.
Unstructured is the natural document processing layer for AG2 agentic RAG pipelines — this example
shows how they work together.
Checklist