Skip to content

Commit 653256e

Browse files
trangevisophia-ramseynick863
authored
[Azure.AI.Projects] Beta 11 Changes (Azure#52062)
* Sramsey/datasets (Azure#50459) * regenerate code based on commit 06308c14162a70091d5ea4b079ae8740383a9e00 * change return type of `UploadFile` and `UploadFolder` from Response to DatasetVersion to better align with python + js * add connectionName input for `UploadFile` and `UploadFolder` * update snippets + api * add datasets regex filter (Azure#50649) * add optional regex filter for UploadFolder * update samples/api * regenerate code / remove body from datasets (Azure#50767) * regenerate code / remove body from datasets * update changelog * [Azure.AI.Projects] Remove Inference related code (Azure#50774) * Remove Inference related code. Modify samples to just use the base Inference client, by modifying the project endpoint Signed-off-by: trangevi <[email protected]> * missed the package dependency Signed-off-by: trangevi <[email protected]> * Missed an import Signed-off-by: trangevi <[email protected]> * Update snippets. Update readme Signed-off-by: trangevi <[email protected]> * API updates Signed-off-by: trangevi <[email protected]> * snippet fixes Signed-off-by: trangevi <[email protected]> --------- Signed-off-by: trangevi <[email protected]> * change string to uri (Azure#50831) * change DataUri, BlobUri, and SasUri from type string to uri, update references * update api to reflect changes * replace GetClient() with properties (Azure#50893) * add functionality to use `Connections`, `Datasets`, `Deployments`, and `Indexes` properties instead of `GetConnectionsClient()`, `GetDatasetsClient()`, `GetDeploymentsClient()`, and `GetIndexesClient()` * update changelog, samples, and api * still left to do: mark `GetConnectionsClient()`, `GetDatasetsClient()`, `GetDeploymentsClient()`, and `GetIndexesClient()` as internal * change Get*Client() functions to internal (Azure#50943) * update custom code for `GetConnectionsClient()`, `GetDatasetsClient()`, `GetDeploymentsClient()`, `GetEvaluationsClient()`, `GetIndexesClient()`, and `GetRedteamsClient()` to be internal * update api and samples * emitted the code with `generate-sample-project: false`, so that Generated/Docs and Generated/Samples would not be generated to use internal functions * add GetModelDeployment (Azure#50964) * rename connection, index, SasCredential, Sku (Azure#50997) * rename connection, index, SasCredential, Sku * update changelog * rename deployment (Azure#51000) * Add aoai embeddings (Azure#51095) * add aoai text embeddings * update model_deployment_name * Additional fixes for dataset upload (Azure#51138) * Fix authentication on data sets * Allow entra ID auth if SAS is not available * Initial SCM change (Azure#51196) * emit code with SCM * update custom code for SCM * update samples * update api * address comments * Clean up code (Azure#51310) * Uncomment Inference (Azure#51317) * [AI Projects] Datasets fixes (Azure#51391) * Update sample for consistency. Remove todo messages. Update generated code to not fail on 200 from delete Signed-off-by: trangevi <[email protected]> * Update snippets Signed-off-by: trangevi <[email protected]> --------- Signed-off-by: trangevi <[email protected]> * [AI Projects] Regenerate code after typespec renames (Azure#51424) * Regen and test fixes from regen Signed-off-by: trangevi <[email protected]> * Codechecks fixes Signed-off-by: trangevi <[email protected]> * Accidentally committed Signed-off-by: trangevi <[email protected]> --------- Signed-off-by: trangevi <[email protected]> * [AI.Projects] More work towards stable (Azure#51431) * Changelog updates. AOAI method renames Signed-off-by: trangevi <[email protected]> * CodeCheck updates Signed-off-by: trangevi <[email protected]> * Update version Signed-off-by: trangevi <[email protected]> * Some updates based on feedback Signed-off-by: trangevi <[email protected]> * CodeChecks updates Signed-off-by: trangevi <[email protected]> --------- Signed-off-by: trangevi <[email protected]> * Changelog for AOAI Client change * [Azure.AI.Projects] Addressing Typespec comments (Azure#51677) * Lots of renaming. All subclient classes are now appended with "Operations". All operations methods now include the object which they are handling. * Added back preview functionality so we can do another beta release. * Updated some custom methods to properly pass through all parameters to underlying generated code * Some code restructuring to properly fit dotnet standards * Updated CODEOWNERS to add a few more people on our team Signed-off-by: trangevi <[email protected]> * Regenerate after merge from main Signed-off-by: trangevi <[email protected]> * Minor fixes in AIProjectClient. Mark ClientConnectionProvider required methods hidden Signed-off-by: trangevi <[email protected]> * Fix some incorrect removals Signed-off-by: trangevi <[email protected]> * Code checks Signed-off-by: trangevi <[email protected]> * Fix evaluations sample Signed-off-by: trangevi <[email protected]> * Update changelog to mention SCM switch. Signed-off-by: trangevi <[email protected]> --------- Signed-off-by: trangevi <[email protected]> Co-authored-by: sophia-ramsey <[email protected]> Co-authored-by: Nikolay Rovinskiy <[email protected]>
1 parent 2d48921 commit 653256e

File tree

276 files changed

+17489
-11799
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+17489
-11799
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@
9898
# ServiceOwners: @trangevi @dargilco @jhakulin @glharper
9999

100100
# PRLabel: %AI Projects
101-
/sdk/ai/Azure.AI.Projects @jhakulin @nick863
101+
/sdk/ai/Azure.AI.Projects @dargilco @jhakulin @nick863 @trangevi
102102

103103
# ServiceLabel: %AI Projects
104-
# ServiceOwners: @dargilco @jhakulin @nick863
104+
# ServiceOwners: @dargilco @jhakulin @nick863 @trangevi
105105

106106
# ServiceLabel: %AKS
107107
# ServiceOwners: @Azure/aks-pm
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.runsettings

sdk/ai/Azure.AI.Projects/CHANGELOG.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@
33
## 1.0.0-beta.11 (Unreleased)
44

55
### Features Added
6+
* Added a constructor for `AIProjectClient` which takes a `System.ClientModel.AuthenticationTokenProvider` object for authentication. We will be switching away from `Azure.Core.TokenCredential` with the upcoming stable release.
67

78
### Breaking Changes
8-
9-
### Bugs Fixed
10-
11-
### Other Changes
9+
* Class changes:
10+
* `AIDeployment` has been renamed `AssetDeployment`
11+
* `AssetCredentialResponse` has been renamed `DatasetCredential`
12+
* `DatasetIndex` has been renamed `SearchIndex`
13+
* `PendingUploadRequest` has been renamed `PendingUploadConfiguration`
14+
* `PendingUploadResponse` has been renamed `PendingUploadResult`
15+
* In `Datasets`, methods `PendingUpload` and `PendingUploadAsync`, argument `body` was replaced with `configuration`
16+
* `GetAzureOpenAIChatClient` and `GetAzureOpenAIEmbeddingClient` methods have been removed and replaced with a single `GetOpenAIClient` method. This method returns an OpenAI client which has properties for accessing individual operation clients. More information is available in the `Inference` samples.
17+
* All operations methods have been renamed to include the object the operation is for. For example, `Connections.GetDefault` has been renamed to `Connections.GetDefaultConnection`, and `Datasets.Get` has been renamed to `Datasets.GetDatasets`.
18+
* `Deployments.GetModelDeployment` and `Deployments.GetModelDeploymentAsync` methods have been removed. Use `Deployments.GetDeployment` and `Deployments.GetDeploymentAsync` instead.`
1219

1320
## 1.0.0-beta.10 (2025-07-11)
1421

sdk/ai/Azure.AI.Projects/README.md

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ var endpoint = System.Environment.GetEnvironmentVariable("PROJECT_ENDPOINT");
164164
var modelDeploymentName = System.Environment.GetEnvironmentVariable("MODEL_DEPLOYMENT_NAME");
165165
var connectionName = System.Environment.GetEnvironmentVariable("CONNECTION_NAME");
166166
Console.WriteLine("Create the Azure OpenAI chat client");
167-
AIProjectClient projectClient = new AIProjectClient(new Uri(endpoint), new DefaultAzureCredential());
168-
ChatClient chatClient = projectClient.GetAzureOpenAIChatClient(deploymentName: modelDeploymentName, connectionName: connectionName, apiVersion: null);
167+
AIProjectClient projectClient = new(new Uri(endpoint), new DefaultAzureCredential());
168+
AzureOpenAIClient azureOpenAIClient = (AzureOpenAIClient)projectClient.GetOpenAIClient(connectionName: connectionName, apiVersion: null);
169+
ChatClient chatClient = azureOpenAIClient.GetChatClient(deploymentName: modelDeploymentName);
169170

170171
Console.WriteLine("Complete a chat");
171172
ChatCompletion result = chatClient.CompleteChat("List all the rainbow colors");
@@ -212,22 +213,23 @@ The code below shows some Deployments operations, which allow you to enumerate t
212213
var endpoint = System.Environment.GetEnvironmentVariable("PROJECT_ENDPOINT");
213214
var modelDeploymentName = System.Environment.GetEnvironmentVariable("MODEL_DEPLOYMENT_NAME");
214215
var modelPublisher = System.Environment.GetEnvironmentVariable("MODEL_PUBLISHER");
215-
AIProjectClient projectClient = new(new Uri(endpoint), new DefaultAzureCredential());
216+
217+
AIProjectClient projectClient = new AIProjectClient(new Uri(endpoint), new DefaultAzureCredential());
216218

217219
Console.WriteLine("List all deployments:");
218-
foreach (AIDeployment deployment in projectClient.Deployments.GetDeployments())
220+
foreach (AssetDeployment deployment in projectClient.Deployments.GetDeployments())
219221
{
220222
Console.WriteLine(deployment);
221223
}
222224

223225
Console.WriteLine($"List all deployments by the model publisher `{modelPublisher}`:");
224-
foreach (AIDeployment deployment in projectClient.Deployments.GetDeployments(modelPublisher: modelPublisher))
226+
foreach (AssetDeployment deployment in projectClient.Deployments.GetDeployments(modelPublisher: modelPublisher))
225227
{
226228
Console.WriteLine(deployment);
227229
}
228230

229231
Console.WriteLine($"Get a single model deployment named `{modelDeploymentName}`:");
230-
ModelDeployment deploymentDetails = projectClient.Deployments.GetModelDeployment(modelDeploymentName);
232+
ModelDeployment deploymentDetails = (ModelDeployment)projectClient.Deployments.GetDeployment(modelDeploymentName);
231233
Console.WriteLine(deploymentDetails);
232234
```
233235

@@ -254,19 +256,19 @@ foreach (ConnectionProperties connection in projectClient.Connections.GetConnect
254256
}
255257

256258
Console.WriteLine($"Get the properties of a connection named `{connectionName}`:");
257-
ConnectionProperties specificConnection = projectClient.Connections.Get(connectionName, includeCredentials: false);
259+
ConnectionProperties specificConnection = projectClient.Connections.GetConnection(connectionName, includeCredentials: false);
258260
Console.WriteLine(specificConnection);
259261

260262
Console.WriteLine("Get the properties of a connection with credentials:");
261-
ConnectionProperties specificConnectionCredentials = projectClient.Connections.Get(connectionName, includeCredentials: true);
263+
ConnectionProperties specificConnectionCredentials = projectClient.Connections.GetConnection(connectionName, includeCredentials: true);
262264
Console.WriteLine(specificConnectionCredentials);
263265

264266
Console.WriteLine($"Get the properties of the default connection:");
265-
ConnectionProperties defaultConnection = projectClient.Connections.GetDefault(includeCredentials: false);
267+
ConnectionProperties defaultConnection = projectClient.Connections.GetDefaultConnection(includeCredentials: false);
266268
Console.WriteLine(defaultConnection);
267269

268270
Console.WriteLine($"Get the properties of the default connection with credentials:");
269-
ConnectionProperties defaultConnectionCredentials = projectClient.Connections.GetDefault(includeCredentials: true);
271+
ConnectionProperties defaultConnectionCredentials = projectClient.Connections.GetDefaultConnection(includeCredentials: true);
270272
Console.WriteLine(defaultConnectionCredentials);
271273
```
272274

@@ -282,9 +284,10 @@ var datasetVersion1 = System.Environment.GetEnvironmentVariable("DATASET_VERSION
282284
var datasetVersion2 = System.Environment.GetEnvironmentVariable("DATASET_VERSION_2") ?? "2.0";
283285
var filePath = System.Environment.GetEnvironmentVariable("SAMPLE_FILE_PATH") ?? "sample_folder/sample_file1.txt";
284286
var folderPath = System.Environment.GetEnvironmentVariable("SAMPLE_FOLDER_PATH") ?? "sample_folder";
285-
AIProjectClient projectClient = new(new Uri(endpoint), new DefaultAzureCredential());
286287

287-
Console.WriteLine($"Uploading a single file to create Dataset version {datasetVersion1}:");
288+
AIProjectClient projectClient = new AIProjectClient(new Uri(endpoint), new DefaultAzureCredential());
289+
290+
Console.WriteLine($"Uploading a single file to create Dataset with name {datasetName} and version {datasetVersion1}:");
288291
FileDatasetVersion fileDataset = projectClient.Datasets.UploadFile(
289292
name: datasetName,
290293
version: datasetVersion1,
@@ -305,27 +308,28 @@ Console.WriteLine(folderDataset);
305308

306309
Console.WriteLine($"Retrieving Dataset version {datasetVersion1}:");
307310
DatasetVersion dataset = projectClient.Datasets.GetDataset(datasetName, datasetVersion1);
308-
Console.WriteLine(dataset);
311+
Console.WriteLine(dataset.Id);
309312

310313
Console.WriteLine($"Retrieving credentials of Dataset {datasetName} version {datasetVersion1}:");
311-
AssetCredentialResponse credentials = projectClient.Datasets.GetCredentials(datasetName, datasetVersion1);
314+
DatasetCredential credentials = projectClient.Datasets.GetCredentials(datasetName, datasetVersion1);
312315
Console.WriteLine(credentials);
313316

314317
Console.WriteLine($"Listing all versions for Dataset '{datasetName}':");
315-
foreach (DatasetVersion ds in projectClient.Datasets.GetVersions(datasetName))
318+
foreach (DatasetVersion ds in projectClient.Datasets.GetDatasetVersions(datasetName))
316319
{
317320
Console.WriteLine(ds);
318321
Console.WriteLine(ds.Version);
319322
}
320323

321324
Console.WriteLine($"Listing latest versions for all datasets:");
322-
foreach (DatasetVersion ds in projectClient.Datasets.GetDatasetVersions())
325+
foreach (DatasetVersion ds in projectClient.Datasets.GetDatasets())
323326
{
324-
Console.WriteLine(ds);
327+
Console.WriteLine($"{ds.Name}, {ds.Version}, {ds.Id}");
325328
}
326329

327330
Console.WriteLine($"Deleting Dataset versions {datasetVersion1} and {datasetVersion2}:");
328331
projectClient.Datasets.Delete(datasetName, datasetVersion1);
332+
329333
projectClient.Datasets.Delete(datasetName, datasetVersion2);
330334
```
331335

@@ -339,37 +343,38 @@ var indexName = Environment.GetEnvironmentVariable("INDEX_NAME") ?? "my-index";
339343
var indexVersion = Environment.GetEnvironmentVariable("INDEX_VERSION") ?? "1.0";
340344
var aiSearchConnectionName = Environment.GetEnvironmentVariable("AI_SEARCH_CONNECTION_NAME") ?? "my-ai-search-connection-name";
341345
var aiSearchIndexName = Environment.GetEnvironmentVariable("AI_SEARCH_INDEX_NAME") ?? "my-ai-search-index-name";
346+
342347
AIProjectClient projectClient = new(new Uri(endpoint), new DefaultAzureCredential());
343348

344-
RequestContent content = RequestContent.Create(new
349+
BinaryContent content = BinaryContent.Create(BinaryData.FromObjectAsJson(new
345350
{
346351
connectionName = aiSearchConnectionName,
347352
indexName = aiSearchIndexName,
348353
type = "AzureSearch",
349354
description = "Sample Index for testing",
350355
displayName = "Sample Index"
351-
});
356+
}));
352357

353358
Console.WriteLine($"Create an Index named `{indexName}` referencing an existing AI Search resource:");
354-
var index = projectClient.Indexes.CreateOrUpdate(
359+
SearchIndex index = (SearchIndex)projectClient.Indexes.CreateOrUpdate(
355360
name: indexName,
356361
version: indexVersion,
357362
content: content
358363
);
359364
Console.WriteLine(index);
360365

361366
Console.WriteLine($"Get an existing Index named `{indexName}`, version `{indexVersion}`:");
362-
DatasetIndex retrievedIndex = projectClient.Indexes.GetIndex(name: indexName, version: indexVersion);
367+
SearchIndex retrievedIndex = projectClient.Indexes.GetIndex(name: indexName, version: indexVersion);
363368
Console.WriteLine(retrievedIndex);
364369

365370
Console.WriteLine($"Listing all versions of the Index named `{indexName}`:");
366-
foreach (DatasetIndex version in projectClient.Indexes.GetVersions(name: indexName))
371+
foreach (SearchIndex version in projectClient.Indexes.GetIndexVersions(name: indexName))
367372
{
368373
Console.WriteLine(version);
369374
}
370375

371376
Console.WriteLine($"Listing all Indices:");
372-
foreach (DatasetIndex version in projectClient.Indexes.GetIndices())
377+
foreach (SearchIndex version in projectClient.Indexes.GetIndexes())
373378
{
374379
Console.WriteLine(version);
375380
}
@@ -387,7 +392,7 @@ try
387392
{
388393
projectClient.Datasets.GetDataset("non-existent-dataset-name", "non-existent-dataset-version");
389394
}
390-
catch (RequestFailedException ex) when (ex.Status == 404)
395+
catch (ClientResultException ex) when (ex.Status == 404)
391396
{
392397
Console.WriteLine($"Exception status code: {ex.Status}");
393398
Console.WriteLine($"Exception message: {ex.Message}");

0 commit comments

Comments
 (0)