Chuyển đến nội dung
Skillpedia
Agent48k · #3884

azure-ai-document-intelligence-dotnet

Skill này làm gì

Công cụ này giúp trích xuất thông tin quan trọng từ tài liệu như hóa đơn, biên lai và thẻ căn cước. Nó có thể đọc văn bản, bảng và dữ liệu có cấu trúc.

Khi nào nên dùng

  • ✓Khi bạn muốn tự động sắp xếp hóa đơn và biên lai.
  • ✓Khi bạn cần trích xuất dữ liệu từ giấy tờ tùy thân.
  • ✓Khi bạn cần đọc văn bản và bảng từ bất kỳ tài liệu nào.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-ai-document-intelligence-dotnet/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-ai-document-intelligence-dotnet/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Trích xuất tên nhà cung cấp và tổng số tiền từ hóa đơn PDF này.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Bạn cung cấp một tài liệu (như PDF hoặc hình ảnh) và chọn một mô hình có sẵn (như “invoice” hoặc “receipt”). Công cụ đọc tài liệu và trả về thông tin bạn yêu cầu.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Azure.AI.DocumentIntelligence (.NET)

Extract text, tables, and structured data from documents using prebuilt and custom models.

Installation

dotnet add package Azure.AI.DocumentIntelligence
dotnet add package Azure.Identity

Current Version: v1.0.0 (GA)

Environment Variables

DOCUMENT_INTELLIGENCE_ENDPOINT=https://<resource-name>.cognitiveservices.azure.com/
DOCUMENT_INTELLIGENCE_API_KEY=<your-api-key>
BLOB_CONTAINER_SAS_URL=https://<storage>.blob.core.windows.net/<container>?<sas-token>

Authentication

Microsoft Entra ID (Recommended)

using Azure.Identity;
using Azure.AI.DocumentIntelligence;

string endpoint = Environment.GetEnvironmentVariable("DOCUMENT_INTELLIGENCE_ENDPOINT");
var credential = new DefaultAzureCredential();
var client = new DocumentIntelligenceClient(new Uri(endpoint), credential);

Note: Entra ID requires a custom subdomain (e.g., https://<resource-name>.cognitiveservices.azure.com/), not a regional endpoint.

API Key

string endpoint = Environment.GetEnvironmentVariable("DOCUMENT_INTELLIGENCE_ENDPOINT");
string apiKey = Environment.GetEnvironmentVariable("DOCUMENT_INTELLIGENCE_API_KEY");
var client = new DocumentIntelligenceClient(new Uri(endpoint), new AzureKeyCredential(apiKey));

Client Types

Client Purpose
DocumentIntelligenceClient Analyze documents, classify documents
DocumentIntelligenceAdministrationClient Build/manage custom models and classifiers

Prebuilt Models

Model ID Description
prebuilt-read Extract text, languages, handwriting
prebuilt-layout Extract text, tables, selection marks, structure
prebuilt-invoice Extract invoice fields (vendor, items, totals)
prebuilt-receipt Extract receipt fields (merchant, items, total)
prebuilt-idDocument Extract ID document fields (name, DOB, address)
prebuilt-businessCard Extract business card fields
prebuilt-tax.us.w2 Extract W-2 tax form fields
prebuilt-healthInsuranceCard.us Extract health insurance card fields

Core Workflows

1. Analyze Invoice

using Azure.AI.DocumentIntelligence;

Uri invoiceUri = new Uri("https://example.com/invoice.pdf");

Operation<AnalyzeResult> operation = await client.AnalyzeDocumentAsync(
    WaitUntil.Completed, 
    "prebuilt-invoice", 
    invoiceUri);

AnalyzeResult result = operation.Value;

foreach (AnalyzedDocument document in result.Documents)
{
    if (document.Fields.TryGetValue("VendorName", out DocumentField vendorNameField)
        && vendorNameField.FieldType == DocumentFieldType.String)
    {
        string vendorName = vendorNameField.ValueString;
        Console.WriteLine($"Vendor Name: '{vendorName}', confidence: {vendorNameField.Confidence}");
    }

    if (document.Fields.TryGetValue("InvoiceTotal", out DocumentField invoiceTotalField)
        && invoiceTotalField.FieldType == DocumentFieldType.Currency)
    {
        CurrencyValue invoiceTotal = invoiceTotalField.ValueCurrency;
        Console.WriteLine($"Invoice Total: '{invoiceTotal.CurrencySymbol}{invoiceTotal.Amount}'");
    }
    
    // Extract line items
    if (document.Fields.TryGetValue("Items", out DocumentField itemsField)
        && itemsField.FieldType == DocumentFieldType.List)
    {
        foreach (DocumentField item in itemsField.ValueList)
        {
            var itemFields = item.ValueDictionary;
            if (itemFields.TryGetValue("Description", out DocumentField descField))
                Console.WriteLine($"  Item: {descField.ValueString}");
        }
    }
}

2. Extract Layout (Text, Tables, Structure)

Uri fileUri = new Uri("https://example.com/document.pdf");

Operation<AnalyzeResult> operation = await client.AnalyzeDocumentAsync(
    WaitUntil.Completed, 
    "prebuilt-layout", 
    fileUri);

AnalyzeResult result = operation.Value;

// Extract text by page
foreach (DocumentPage page in result.Pages)
{
    Console.WriteLine($"Page {page.PageNumber}: {page.Lines.Count} lines, {page.Words.Count} words");
    
    foreach (DocumentLine line in page.Lines)
    {
        Console.WriteLine($"  Line: '{line.Content}'");
    }
}

// Extract tables
foreach (DocumentTable table in result.Tables)
{
    Console.WriteLine($"Table: {table.RowCount} rows x {table.ColumnCount} columns");
    foreach (DocumentTableCell cell in table.Cells)
    {

…
Câu hỏi thường gặp

“Mô hình có sẵn” là gì?

Đó là các mô hình mà công cụ đã hiểu sẵn, được huấn luyện để nhận diện các loại tài liệu cụ thể như hóa đơn hoặc biên lai.

Tôi có thể dùng tài liệu của mình để huấn luyện công cụ không?

Có, bạn có thể tạo mô hình tùy chỉnh cho các tài liệu mà mô hình có sẵn không bao gồm.

Thông tin trích xuất được lưu ở đâu?

Công cụ trích xuất thông tin và trả về để bạn dùng trong chương trình. Cách lưu phụ thuộc vào cách bạn thiết lập mã của mình.

Chi tiết

Mô tả gốc của tác giả

Azure AI Document Intelligence SDK for .NET. Extract text, tables, and structured data from documents using prebuilt and custom models.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#3884
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự