Add CommunityToolkit.DataIngestion.VisionLMOcr (IOcrClient over vision IChatClient) (draft)#15
Closed
luisquintanilla wants to merge 8 commits into
Closed
Conversation
… DataIngestion) Port intelligent PDF ingestion packages from luisquintanilla/PdfPig (feature/intelligent-pdf-ingestion branch, PRs #1 and #2) into the AI Community Toolkit as a new MEDI top-level feature area. New packages: - CommunityToolkit.DocumentProcessing.PdfPig.OnnxLayoutAnalysis ONNX-based layout detection (RT-DETR, configurable models, image preprocessing, NMS) implementing PdfPig IPageSegmenter - CommunityToolkit.DocumentProcessing.PdfPig.DataIngestion MEDI bridge with vision LLM enrichers (OCR, table extraction, contextual chunking) for PDF document ingestion Infrastructure: - MEDI/ directory structure following MEVD pattern - Directory.Build.props for src and test - Central package management updates - MEDI.slnf solution filter - medi.yml CI workflow - nuget.config with source mapping for dotnet-public feed Test results: 216 total (213 passed, 3 skipped for missing ONNX model) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port retrieval processors from MEDIExtensions to CommunityToolkit: - DataRetrieval: MultiQueryExpander, HydeQueryTransformer, AdaptiveRouter, CragValidator, LlmReranker, TreeSearchRetriever, SelfRagOrchestrator, SpeculativeRagOrchestrator, RetrievalPipelineBuilder, DI extensions - DataRetrieval.OnnxReranker: CrossEncoderReranker with ONNX inference, TextPairTokenizer, TokenizerFactory (BERT/BPE/SentencePiece support) Both packages target net10.0;net8.0, build with 0 errors/0 warnings. Added local NuGet source for Microsoft.Extensions.DataRetrieval packages. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a terminal method to RetrievalPipelineBuilder that registers
a VectorStoreRetriever<TKey,TRecord> as IRetriever in DI. This
enables the builder pattern: services.AddRetrievalPipeline(b => {
b.AddQueryProcessor(...); }).AsRetriever<K,R>(...);
Also exposes Services property on builder so the terminal can
register the retriever in the service collection.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port 4 LLM-powered ingestion chunk processors from MEDIExtensions: - EntityExtractionProcessor: NER via LLM (people, orgs, tech, versions) - TopicClassificationProcessor: Configurable taxonomy classification - HypotheticalQueryProcessor: Reverse HyDE question generation - TreeIndexProcessor: RAPTOR-style tree index (leaf/branch/root summaries) Includes: - IngestionPipelineBuilder<T> with fluent builder extensions - DataIngestionServiceCollectionExtensions for DI registration - MetadataKeys constants (FDG compliance) - Optional ILogger on all processors (FDG compliance) - JsonDefaults internal utility Implements IngestionChunkProcessor<string> from the stable Microsoft.Extensions.DataIngestion package. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port retrieval processor unit tests from MEDIExtensions with namespace remapping. Covers: MultiQueryExpander, LlmReranker, HydeQueryTransformer, CragValidator, AdaptiveRouter, SelfRagOrchestrator, SpeculativeRagOrchestrator, TreeSearchRetriever. Includes test utilities (TestChatClient, TestVectorStoreCollection) for deterministic LLM-free testing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port ingestion processor unit tests covering: EntityExtraction, TopicClassification, HypotheticalQuery, TreeIndex processors. All tests use TestChatClient for deterministic LLM-free execution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Adds
CommunityToolkit.DataIngestion.VisionLMOcr— a provider-neutralIOcrClientbacked byany vision-capable
Microsoft.Extensions.AI.IChatClient. It relocates the vision-LM OCRprompt/request logic out of the PdfPig
VisionOcrEnricherand behind theIOcrClientseam, so avision LM becomes one swappable OCR provider (alongside Mistral OCR / Azure DI).
Closes #13.
mainhas no MEDI scaffolding yet — it lives on thefeature/data-ingestionbranch (PR #10). Thispackage is a satellite of
CommunityToolkit.DataIngestion, so it is built on top of #10. Until#10 merges to
main, this PR's diff also shows #10's files; please review only the new filesbelow (everything else is #10 and drops out automatically once #10 lands):
MEDI/src/DataIngestion.VisionLMOcr/DataIngestion.VisionLMOcr.csprojMEDI/src/DataIngestion.VisionLMOcr/VisionLMOcrClient.csMEDI/src/DataIngestion.VisionLMOcr/VisionLMOcrOptions.csMEDI/src/DataIngestion.VisionLMOcr/VisionLMOcrPrompts.csMEDI/src/DataIngestion.VisionLMOcr/VisionLMOcrServiceCollectionExtensions.csMEDI/test/DataIngestion.VisionLMOcr.UnitTests/DataIngestion.VisionLMOcr.UnitTests.csprojMEDI/test/DataIngestion.VisionLMOcr.UnitTests/VisionLMOcrClientTests.csCommunityToolkit.AI.slnx(2 project entries)I'll rebase/retarget onto
mainonce #10 merges, collapsing the diff to just these files.Notes
IOcrClientshape (dotnet/extensions #7588). Un-vendor and referenceMicrosoft.Extensions.DataIngestion.Abstractionswhen #7588 ships.IOcrClientprovider; the abstraction stays indotnet/extensions, concrete providers live here.
net10.0;net8.0, 6/6 unit tests pass on both TFMs (fakeIChatClient, no network).Validation