|
| 1 | +# Best Practices for Content Understanding |
| 2 | + |
| 3 | +## Overview |
| 4 | +This document provides guidance on how to effectively use Content Understanding for processing and analyzing various kinds of data. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## Use Field Descriptions to Guide Output |
| 9 | +When defining a schema, it is essential to provide detailed field descriptions and examples. Clear descriptions and relevant examples guide the model to focus on the correct information, improving the accuracy of the output. |
| 10 | + |
| 11 | +### Example 1: |
| 12 | +If you want to extract the date from an invoice, instead of just naming the field `"Date"`, provide a description such as: |
| 13 | +> **"The date when the invoice was issued, typically found at the top right corner of the document."** |
| 14 | +
|
| 15 | +### Example 2: |
| 16 | +Suppose you want to extract the `"Customer Name"` from an invoice. Your description might read: |
| 17 | +> **"It should be the name of the business or person, but not the entire mailing address. The name of the customer or client to whom this invoice is addressed, usually located near the billing address."** |
| 18 | +
|
| 19 | +--- |
| 20 | + |
| 21 | +## Fix Mistakes by Editing Field Descriptions |
| 22 | +If the system’s output isn’t meeting expectations, the first thing to try is refining and updating the field descriptions. By clarifying the context and being more explicit about what you need, you reduce ambiguity and improve accuracy. |
| 23 | + |
| 24 | +### Example: |
| 25 | +If the `"Shipping date"` field generated inconsistent or incorrect extraction, update it to something more precise like: |
| 26 | +> **"The date when the products were shipped, typically found below the item list. It may also be labeled something similar like Delivery Date or Dispatch Date. Dates should typically have a format like 1/23/2024 or 01-04-2025."** |
| 27 | +
|
| 28 | +This extra context guides the model to the right location in the document. |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## Use Classification Fields for Specific Outputs |
| 33 | +When you need the system to choose from a set of predefined options (e.g., document type, product category, or status), use classification fields. When there's ambiguity with the options, provide clear descriptions for each option, enabling the model to categorize the data accurately. |
| 34 | + |
| 35 | +### Example 1: |
| 36 | +If you need to classify documents as either `"Invoice"`, `"Claim"`, or `"Report"`, create a classification field with these words as class names. |
| 37 | + |
| 38 | +### Example 2: |
| 39 | +When processing product images, you might need to assign them to categories like `"Alcoholic Drinks"`, `"Soft Drinks"`, `"Snacks"`, and `"Dairy Products"`. Since some items may appear similar, providing precise definitions for close-call cases can help. For example: |
| 40 | + |
| 41 | +- **`"Alcoholic Drinks"`**: Beverages containing alcohol, such as beer, wine, and spirits. This excludes soft drinks or non-alcoholic beverages. |
| 42 | +- **`"Soft Drinks"`**: Carbonated non-alcoholic beverages, such as soda and sparkling water. This does not include juices or alcoholic drinks. |
| 43 | + |
| 44 | +By clearly defining each category, you ensure that the system correctly classifies products while minimizing misclassification. |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | +## Use Confidence Scores to Determine When Human Review is Needed |
| 49 | +Confidence scores help you decide when to involve human reviewers. Customers can interpret confidence scores using thresholds to decide which results need more review, minimizing the risk of errors. |
| 50 | + |
| 51 | +### Example: |
| 52 | +For an Invoice review use case, if a key extracted field like `"Total Invoice Amount"` has a confidence score under **80%**, the system routes that document for manual review. This ensures that critical fields like invoice totals or legal statements are verified by a human when necessary. |
| 53 | + |
| 54 | +You might set different confidence thresholds based on the type of field. For instance, a lower threshold for a `"comments"` field that’s less critical and a higher one for `"contract termination date"` to ensure no mistakes. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## Reduce Errors by Narrowing Language Selection for Audio and Video |
| 59 | +When working with audio and video content, selecting a narrow set of languages for transcription significantly reduces errors. The more languages you include, the more the system has to guess which language is being spoken, which can lead to increased misclassifications. |
| 60 | + |
| 61 | +### Example 1: |
| 62 | +If your content is only in English and Spanish, configure your transcription to those two languages only. Avoid adding options like French or Arabic unless you truly need them. |
| 63 | + |
| 64 | +### Example 2: |
| 65 | +If you have conference calls that occasionally include Portuguese speakers, add Portuguese only for those meetings. For all other calls, stick to English if that’s what you expect 90% of the time. |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +## Transcript, OCR Text, and Speaker Data Don’t Require Fields |
| 70 | +By default, Content Extraction information such as transcripts, OCR results, and video key frames can be accessed directly for immediate review or custom processing. Fields can be used when advanced transformations are needed (e.g., summarizing transcripts, identifying entities, or extracting specific items from OCR). Each field can instruct the system to extract or generate the content you need. |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Connect Analyzer to an Existing Content Understanding Project via REST API |
| 75 | +To connect an analyzer created through the REST API to an existing Content Understanding project, add the following `tags` to the analyzer JSON: |
| 76 | + |
| 77 | +```json |
| 78 | +"projectId": "<add your project's ID here! You can find the projectId on the Azure Portal in the Overview of the project resource or by reading any analyzer you created via the project in AI Foundry through the REST API>", |
| 79 | +"templateId": "postCallAnalytics-2024-12-01" |
| 80 | +``` |
| 81 | + |
| 82 | +### Example: |
| 83 | +```json |
| 84 | +"tags": {"projectId": "1232abcdef1234","templateId": "postCallAnalytics-2024-12-01"} |
| 85 | +``` |
| 86 | + |
| 87 | +### Available Template IDs: |
| 88 | +| Modality | Template IDs | |
| 89 | +|-----------|-------------| |
| 90 | +| **Audio** | postCallAnalytics-2024-12-01, conversationAnalysis-2024-12-01 | |
| 91 | +| **Text** | text-2024-12-01 | |
| 92 | +| **Image** | image-2024-12-01 | |
| 93 | +| **Document** | - | |
| 94 | +| **Video** | - | |
| 95 | + |
| 96 | +--- |
0 commit comments