首页›.NET Blog›文章

Introducing DocumentExtractionClient (preview): Extract documents in .NET

Luis Quintanilla · 2026年11月24日

AI 摘要 AI 生成,可能有误

微软推出了 Microsoft.Extensions.DocumentExtraction 中的 DocumentExtractionClient 预览版,这是一个统一的 .NET API,可从 PDF、扫描件、图像和 Office 文件中提取结构化内容(标题、段落、表格、插图和来源)。.NET AI 社区工具包中的入门提供程序(包括 PdfPig、通过 IChatClient 的视觉语言模型、Azure Content Understanding、Azure AI 文档智能和 Mistral OCR)可以互换,因此代码无需重写即可更换提供程序,遵循熟悉的 IChatClient 模式,并支持中间件和自定义提供程序。提取的文档可以输入到 Microsoft.Extensions.DataIngestion 管道中,为上下文工程、智能体工作流和检索增强生成(RAG)提供支持,GitHub 存储库中提供了单文件 C# 示例。

A lot of the information your apps need lives in documents. Invoices, contracts, reports, forms, and slide decks arrive as PDFs, scans, images, and Office files. Getting their content and structure out is the first step for search, automation, data entry, and archiving. It’s also how AI apps get the context they need. Before a model can answer questions about a document, your app has to turn that document into something the model can work with. Until now, each parser or service came with its own SDK and object model. Moving to another tool meant rewriting the code that used the results.

Today we’re introducing a preview of DocumentExtractionClient in Microsoft.Extensions.DocumentExtraction, along with a set of starter providers in the .NET AI Community Toolkit. Whichever provider you choose, the flow is the same. You load a document, pick a provider, and extract its contents into a common structure. Providers include a PDF parser that runs in process, a vision model behind any IChatClient, and cloud services like Azure Content Understanding.

In this post, you’ll learn what document extraction is, where DocumentExtractionClient fits among the .NET AI building blocks, and how to extract your first document, swap providers, and add middleware. Then you’ll feed the results into a data ingestion pipeline with Microsoft.Extensions.DataIngestion, the foundation for context engineering, agentic workflows, and retrieval-augmented generation (RAG). Every sample is a single C# file you can run with dotnet run. They’re all in the document extraction samples repo.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 .NET Blog

Build a .NET decision agent with Microsoft Agent Framework and Foundry

AI 摘要The article walks through building a .NET agent that uses the Microsoft-Decision-1.1 decision model to route support tickets to the appropriate team, demonstrating that agents don't require conversational models to be useful. It shows how to implement the decision logic inside a Microsoft Agent Framework AIAgent, return structured results as typed C# records, and expose the agent through the Foundry Responses protocol. The same implementation can run locally with Azure CLI credentials or be hosted in Foundry using managed identity.

Run local models in your .NET apps with Llama on Windows

AI 摘要Llama on Windows is a free, open-source system tray app built by the Hugging Face and llama.cpp teams that lets you find, download, and chat with open AI models running locally on your PC. It manages a llama.cpp server on localhost that exposes an OpenAI-compatible API, so .NET apps can call local models using the familiar OpenAI client libraries and Microsoft.Extensions.AI's IChatClient, with no API key required. The article walks through installing Llama, downloading a model, and building a .NET 11 file-based chat app with streaming responses and tool calling.

AI is Changing the Cross-Platform Decision Matrix

AI 摘要The author ran an experiment using AI coding agents to rebuild the iOS and Android UIs of a .NET MAUI app with platform-specific UIs over a shared C# library, to assess how AI agents change the cross-platform technology decision. The agent-driven rewrite took under four hours of human time, and the platform UI versions outperformed .NET MAUI at runtime (roughly 50% faster startup on Android, 35% on iOS, and smaller packages), though adding a feature to two UIs cost about 1.4x the worker model time of the single MAUI version. The key finding is that AI agents make building a second UI cheap, but owning and verifying it still carries real costs—the coordinating agent consumed more model time than both implementation workers combined.

Introducing staged publishing on NuGet.org

AI 摘要NuGet.org has introduced staged publishing, a feature that lets package publishers upload packages privately for validation—such as malware scanning and signature checks—before an authorized maintainer explicitly promotes them to the public feed. Unlike unlisted packages, staged packages are completely unavailable to consumers, and publishers can organize related packages into staging groups for release-level review, with promotion requiring a signed-in authorized user with two-factor authentication. The feature is opt-in, supported in the .NET 11 RC2 SDK via a new stage push CLI command, and is recommended for security fixes awaiting coordinated disclosure, feature releases, and large updates, ideally combined with Trusted Publishing and staging-only credentials so compromised pipeline credentials cannot publish directly.

Announcing .NET 11

AI 摘要Microsoft has announced the release of .NET 11, a Standard Term Support release with two years of support, featuring improvements across C# 15 (including union types and closed hierarchies), ASP.NET Core, .NET MAUI, runtime performance, and SDK tooling. The release emphasizes AI-powered development with Microsoft.Extensions.AI, MCP server templates, and the Microsoft Agent Framework, alongside library enhancements such as Zstandard compression, expanded Process APIs, and new JSON capabilities. Developers can learn more at .NET Conf 2026, held November 10-13.