|
Add this skill
npx mdskills install sickn33/azure-ai-projects-javaWell-structured SDK reference with clear examples, but not agent-actionable instructions
1---2name: azure-ai-projects-java3description: |4 Azure AI Projects SDK for Java. High-level SDK for Azure AI Foundry project management including connections, datasets, indexes, and evaluations.5 Triggers: "AIProjectClient java", "azure ai projects java", "Foundry project java", "ConnectionsClient", "DatasetsClient", "IndexesClient".6package: com.azure:azure-ai-projects7---89# Azure AI Projects SDK for Java1011High-level SDK for Azure AI Foundry project management with access to connections, datasets, indexes, and evaluations.1213## Installation1415```xml16<dependency>17 <groupId>com.azure</groupId>18 <artifactId>azure-ai-projects</artifactId>19 <version>1.0.0-beta.1</version>20</dependency>21```2223## Environment Variables2425```bash26PROJECT_ENDPOINT=https://<resource>.services.ai.azure.com/api/projects/<project>27```2829## Authentication3031```java32import com.azure.ai.projects.AIProjectClientBuilder;33import com.azure.identity.DefaultAzureCredentialBuilder;3435AIProjectClientBuilder builder = new AIProjectClientBuilder()36 .endpoint(System.getenv("PROJECT_ENDPOINT"))37 .credential(new DefaultAzureCredentialBuilder().build());38```3940## Client Hierarchy4142The SDK provides multiple sub-clients for different operations:4344| Client | Purpose |45|--------|---------|46| `ConnectionsClient` | Enumerate connected Azure resources |47| `DatasetsClient` | Upload documents and manage datasets |48| `DeploymentsClient` | Enumerate AI model deployments |49| `IndexesClient` | Create and manage search indexes |50| `EvaluationsClient` | Run AI model evaluations |51| `EvaluatorsClient` | Manage evaluator configurations |52| `SchedulesClient` | Manage scheduled operations |5354```java55// Build sub-clients from builder56ConnectionsClient connectionsClient = builder.buildConnectionsClient();57DatasetsClient datasetsClient = builder.buildDatasetsClient();58DeploymentsClient deploymentsClient = builder.buildDeploymentsClient();59IndexesClient indexesClient = builder.buildIndexesClient();60EvaluationsClient evaluationsClient = builder.buildEvaluationsClient();61```6263## Core Operations6465### List Connections6667```java68import com.azure.ai.projects.models.Connection;69import com.azure.core.http.rest.PagedIterable;7071PagedIterable<Connection> connections = connectionsClient.listConnections();72for (Connection connection : connections) {73 System.out.println("Name: " + connection.getName());74 System.out.println("Type: " + connection.getType());75 System.out.println("Credential Type: " + connection.getCredentials().getType());76}77```7879### List Indexes8081```java82indexesClient.listLatest().forEach(index -> {83 System.out.println("Index name: " + index.getName());84 System.out.println("Version: " + index.getVersion());85 System.out.println("Description: " + index.getDescription());86});87```8889### Create or Update Index9091```java92import com.azure.ai.projects.models.AzureAISearchIndex;93import com.azure.ai.projects.models.Index;9495String indexName = "my-index";96String indexVersion = "1.0";97String searchConnectionName = System.getenv("AI_SEARCH_CONNECTION_NAME");98String searchIndexName = System.getenv("AI_SEARCH_INDEX_NAME");99100Index index = indexesClient.createOrUpdate(101 indexName,102 indexVersion,103 new AzureAISearchIndex()104 .setConnectionName(searchConnectionName)105 .setIndexName(searchIndexName)106);107108System.out.println("Created index: " + index.getName());109```110111### Access OpenAI Evaluations112113The SDK exposes OpenAI's official SDK for evaluations:114115```java116import com.openai.services.EvalService;117118EvalService evalService = evaluationsClient.getOpenAIClient();119// Use OpenAI evaluation APIs directly120```121122## Best Practices1231241. **Use DefaultAzureCredential** for production authentication1252. **Reuse client builder** to create multiple sub-clients efficiently1263. **Handle pagination** when listing resources with `PagedIterable`1274. **Use environment variables** for connection names and configuration1285. **Check connection types** before accessing credentials129130## Error Handling131132```java133import com.azure.core.exception.HttpResponseException;134import com.azure.core.exception.ResourceNotFoundException;135136try {137 Index index = indexesClient.get(indexName, version);138} catch (ResourceNotFoundException e) {139 System.err.println("Index not found: " + indexName);140} catch (HttpResponseException e) {141 System.err.println("Error: " + e.getResponse().getStatusCode());142}143```144145## Reference Links146147| Resource | URL |148|----------|-----|149| Product Docs | https://learn.microsoft.com/azure/ai-studio/ |150| API Reference | https://learn.microsoft.com/rest/api/aifoundry/aiprojects/ |151| GitHub Source | https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/ai/azure-ai-projects |152| Samples | https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/ai/azure-ai-projects/src/samples |153
Full transparency — inspect the skill content before installing.