cu-sdk-sample-run

Runs Azure AI Content Understanding Java SDK samples via Maven with interactive environment configuration.

2.6k|2.2k|Updated Dec 6, 2011
One-click install
npx skills add https://github.com/Azure/azure-sdk-for-java --skill cu-sdk-sample-run
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cu-sdk-sample-run
Source: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/contentunderstanding/azure-ai-contentunderstanding/.github/skills/cu-sdk-sample-run
Command: npx skills add https://github.com/Azure/azure-sdk-for-java --skill cu-sdk-sample-run

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Running Azure AI Content Understanding Java SDK samples requires correct Maven invocation, environment variables, model deployment defaults, and sample-specific configuration, which is error-prone to set up manually.

Core Features & Use Cases

  • Guided sample execution: Walks through prerequisites, SDK build, environment variables, and sample selection before running any of the 20+ samples (sync or async) with mvn exec:java.
  • Sample-specific configuration: Handles extra setup for cross-resource copy (Sample15), labeled training data via Azure Blob SAS URLs (Sample16), and one-time model defaults (Sample00_UpdateDefaults).
  • Helper script: run_sample.sh lists available samples, safely loads .env files without eval, warns about missing endpoints, and flags Sample16 demo mode.
  • Use Case: A developer wants to try invoice field extraction; the skill verifies their Foundry endpoint, ensures Sample00 defaults ran, then executes Sample03_AnalyzeInvoice.

Quick Start

Ask the assistant to run Sample02_AnalyzeUrl for the Azure AI Content Understanding Java SDK and follow the interactive prompts for endpoint and authentication.

Frequently Asked Questions about cu-sdk-sample-run

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Azure AI Content Understanding Java samples?

Run samples with mvn exec:java from the sdk/contentunderstanding/azure-ai-contentunderstanding directory, specifying the sample class and -Dexec.classpathScope=test. Set CONTENTUNDERSTANDING_ENDPOINT and credentials as environment variables first, and run Sample00_UpdateDefaults before using prebuilt analyzers.

Why does mvn exec:java fail with ClassNotFoundException for samples?

Samples live in src/samples and are compiled as test sources, so you must pass -Dexec.classpathScope=test to mvn exec:java. Without this flag Maven cannot find the sample classes because they are not part of the main classpath.

How do I authenticate Azure AI Content Understanding samples?

Set CONTENTUNDERSTANDING_ENDPOINT and either provide CONTENTUNDERSTANDING_KEY for key-based auth or leave it empty to use DefaultAzureCredential via az login. Java samples read these through System.getenv(), so export them in the shell or source a .env file before running.

Why do prebuilt analyzer samples fail with model deployment not found?

Prebuilt analyzers like prebuilt-invoice require model deployment mappings configured by running Sample00_UpdateDefaults once per Foundry resource. It maps gpt-5.2 and text-embedding-3-large deployments and prebuilt analyzer aliases.

How do I train a Content Understanding analyzer with labeled data in Java?

Use Sample16_CreateAnalyzerWithLabels with either a container SAS URL in CONTENTUNDERSTANDING_TRAINING_DATA_SAS_URL or auto-upload via DefaultAzureCredential by setting the storage account and container variables. Without these, the sample runs in demo mode without labeled data.