Skip to content

Commit c6a10c6

Browse files
brandom-msftCopilotfoundry-samples automation
authored
Restore 283 samples wiped by 2026-06-08 sync incident (#767)
* Restore samples wiped by 2026-06-08 sync incident (#765 follow-up) This PR restores 283 customer-facing sample files that were wiped from public main by the orphan-wipe sync incident on 2026-06-08. PR #765 only restored the 6 files that landed on private between 7215e58 and 0e67b24; it did not address the broader pre-existing wipe. Affected sample directories (82 total) include: - ALL quickstarts: Python, TypeScript, C#, Java (samples/{lang}/quickstart/{agent-service,chat-with-agent,create-agent,responses}) - ALL csharp/foundry-local samples (audio, embeddings, web-server, model-mgmt, tutorials, etc.) - csharp/foundry-workstream-manager-autopilot-agent - python/foundry-local entire tree - python/foundry-models/model-router - python/hosted-agents/agent-framework/a2a/01-delegation/{caller,executor} - python/hosted-agents/agent-framework/responses/10-downstream-azure - python/hosted-agents/bring-your-own/invocations/event-grid-trigger Also updates 4 stale files to match current private HEAD: - infrastructure/infrastructure-setup-bicep/10-private-network-basic/main.bicep - samples/csharp/foundry-local/Directory.Packages.props - samples/python/hosted-agents/agent-framework/responses/04-foundry-toolbox/README.md - samples/python/hosted-agents/agent-framework/responses/04-foundry-toolbox/agent.manifest.yaml NOT modified: private-endpoint-and-dns.bicep (template 19) -- public has PR #762's DNS fix that's being backported to private via a separate PR. After merge, public main becomes tree-equivalent to private HEAD over the sync include-set, unblocking marks reseed and sync resume. Refs: ADO Task 5347122 (cron re-enable), Bug 5347121 (guard fix, fixed in microsoft-foundry/foundry-samples-pr#493). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Automatic fixes --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: foundry-samples automation <foundry-samples@noreply.github.com>
1 parent b41b7dc commit c6a10c6

288 files changed

Lines changed: 16183 additions & 24 deletions

File tree

Some content is hidden

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

infrastructure/infrastructure-setup-bicep/10-private-network-basic/azuredeploy.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
"metadata": {
55
"_generator": {
66
"name": "bicep",
7-
"version": "0.39.26.7824",
8-
"templateHash": "258335635459710717"
7+
"version": "0.44.1.10279",
8+
"templateHash": "964975521955820946"
99
}
1010
},
1111
"parameters": {
1212
"aiFoundryName": {
1313
"type": "string",
14-
"defaultValue": "foundrypnadisabled",
14+
"defaultValue": "[format('foundrypnadisabled-{0}', uniqueString(resourceGroup().id))]",
1515
"metadata": {
16-
"description": "That name is the name of our application. It has to be unique. Type a name followed by your resource group name. (<name>-<resourceGroupName>)"
16+
"description": "Name for the AI Foundry account. Used as customSubDomainName (globally unique). Default appends a per-RG suffix to avoid collisions."
1717
}
1818
},
1919
"location": {
@@ -120,6 +120,7 @@
120120
},
121121
"dependsOn": [
122122
"[resourceId('Microsoft.CognitiveServices/accounts', parameters('aiFoundryName'))]",
123+
"[resourceId('Microsoft.CognitiveServices/accounts/projects', parameters('aiFoundryName'), parameters('defaultProjectName'))]",
123124
"[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('peSubnetName'))]"
124125
]
125126
},

infrastructure/infrastructure-setup-bicep/10-private-network-basic/main.bicep

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
- Creates an AI Foundry (previously known as Azure AI Services) account and public network access disabled.
66
- Creates a gpt-4o model deployment
77
*/
8-
@description('That name is the name of our application. It has to be unique. Type a name followed by your resource group name. (<name>-<resourceGroupName>)')
9-
param aiFoundryName string = 'foundrypnadisabled'
8+
@description('Name for the AI Foundry account. Used as customSubDomainName (globally unique). Default appends a per-RG suffix to avoid collisions.')
9+
param aiFoundryName string = 'foundrypnadisabled-${uniqueString(resourceGroup().id)}'
1010

1111
@description('Location for all resources.')
1212
param location string = 'eastus'
@@ -106,6 +106,12 @@ resource aiAccountPrivateEndpoint 'Microsoft.Network/privateEndpoints@2024-05-01
106106
}
107107
]
108108
}
109+
// Wait for project; account PUT returns in 'Accepted' state and binding a
110+
// PE before the backend converges fails with AccountProvisioningStateInvalid.
111+
// Project creation only succeeds post-convergence, so it acts as a sync point.
112+
dependsOn: [
113+
project
114+
]
109115
}
110116

111117
/*

samples/csharp/foundry-local/Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<CentralPackageFloatingVersionsEnabled>true</CentralPackageFloatingVersionsEnabled>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageVersion Include="Microsoft.AI.Foundry.Local" Version="*-*" />
8-
<PackageVersion Include="Microsoft.AI.Foundry.Local.WinML" Version="*-*" />
7+
<PackageVersion Include="Microsoft.AI.Foundry.Local" Version="1.2.1" />
8+
<PackageVersion Include="Microsoft.AI.Foundry.Local.WinML" Version="1.2.1" />
99
<PackageVersion Include="Betalgo.Ranul.OpenAI" Version="9.1.0" />
1010
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.15" />
1111
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.15" />
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<!-- Windows: target Windows SDK for WinML hardware acceleration -->
10+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
11+
<TargetFramework>net8.0-windows10.0.18362.0</TargetFramework>
12+
<Platforms>ARM64;x64</Platforms>
13+
<WindowsPackageType>None</WindowsPackageType>
14+
<EnableCoreMrtTooling>false</EnableCoreMrtTooling>
15+
</PropertyGroup>
16+
17+
<!-- Non-Windows: standard .NET -->
18+
<PropertyGroup Condition="!$([MSBuild]::IsOSPlatform('Windows'))">
19+
<TargetFramework>net8.0</TargetFramework>
20+
</PropertyGroup>
21+
22+
<PropertyGroup Condition="'$(RuntimeIdentifier)'==''">
23+
<RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
24+
</PropertyGroup>
25+
26+
<!-- Windows: WinML for hardware acceleration -->
27+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
28+
<PackageReference Include="Microsoft.AI.Foundry.Local.WinML" />
29+
</ItemGroup>
30+
31+
<!-- Non-Windows: standard SDK -->
32+
<ItemGroup Condition="!$([MSBuild]::IsOSPlatform('Windows'))">
33+
<PackageReference Include="Microsoft.AI.Foundry.Local" />
34+
</ItemGroup>
35+
36+
<!-- Linux GPU support -->
37+
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
38+
<PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu" />
39+
<PackageReference Include="Microsoft.ML.OnnxRuntimeGenAI.Cuda" />
40+
</ItemGroup>
41+
42+
<!-- Include audio file in output directory -->
43+
<ItemGroup>
44+
<None Include="Recording.mp3">
45+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
46+
</None>
47+
</ItemGroup>
48+
49+
<!-- Shared utilities -->
50+
<ItemGroup>
51+
<Compile Include="../Shared/*.cs" />
52+
</ItemGroup>
53+
54+
</Project>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31903.59
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AudioTranscriptionExample", "AudioTranscriptionExample.csproj", "{11616852-BB4F-4B60-9FAC-D94E2688BB30}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Debug|x64 = Debug|x64
12+
Debug|x86 = Debug|x86
13+
Release|Any CPU = Release|Any CPU
14+
Release|x64 = Release|x64
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Debug|Any CPU.ActiveCfg = Debug|ARM64
19+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Debug|Any CPU.Build.0 = Debug|ARM64
20+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Debug|x64.ActiveCfg = Debug|x64
21+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Debug|x64.Build.0 = Debug|x64
22+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Debug|x86.ActiveCfg = Debug|ARM64
23+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Debug|x86.Build.0 = Debug|ARM64
24+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Release|Any CPU.ActiveCfg = Release|ARM64
25+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Release|Any CPU.Build.0 = Release|ARM64
26+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Release|x64.ActiveCfg = Release|x64
27+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Release|x64.Build.0 = Release|x64
28+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Release|x86.ActiveCfg = Release|ARM64
29+
{11616852-BB4F-4B60-9FAC-D94E2688BB30}.Release|x86.Build.0 = Release|ARM64
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
EndGlobal
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// <complete_code>
2+
// <imports>
3+
using Microsoft.AI.Foundry.Local;
4+
// </imports>
5+
6+
// <init>
7+
var config = new Configuration
8+
{
9+
AppName = "foundry_local_samples",
10+
LogLevel = Microsoft.AI.Foundry.Local.LogLevel.Information
11+
};
12+
13+
14+
// Initialize the singleton instance.
15+
await FoundryLocalManager.CreateAsync(config, Utils.GetAppLogger());
16+
var mgr = FoundryLocalManager.Instance;
17+
18+
19+
// Ensure that any Execution Provider (EP) downloads run and are completed.
20+
// Download and register all execution providers.
21+
var currentEp = "";
22+
await mgr.DownloadAndRegisterEpsAsync((epName, percent) =>
23+
{
24+
if (epName != currentEp)
25+
{
26+
if (currentEp != "") Console.WriteLine();
27+
currentEp = epName;
28+
}
29+
Console.Write($"\r {epName.PadRight(30)} {percent,6:F1}%");
30+
});
31+
if (currentEp != "") Console.WriteLine();
32+
// </init>
33+
34+
35+
// <model_setup>
36+
// Get the model catalog
37+
var catalog = await mgr.GetCatalogAsync();
38+
39+
40+
// Get a model using an alias and select the CPU model variant
41+
var model = await catalog.GetModelAsync("whisper-tiny") ?? throw new System.Exception("Model not found");
42+
var modelVariant = model.Variants.First(v => v.Info.Runtime?.DeviceType == DeviceType.CPU);
43+
model.SelectVariant(modelVariant);
44+
45+
46+
// Download the model (the method skips download if already cached)
47+
await model.DownloadAsync(progress =>
48+
{
49+
Console.Write($"\rDownloading model: {progress:F2}%");
50+
if (progress >= 100f)
51+
{
52+
Console.WriteLine();
53+
}
54+
});
55+
56+
57+
// Load the model
58+
Console.Write($"Loading model {model.Id}...");
59+
await model.LoadAsync();
60+
Console.WriteLine("done.");
61+
// </model_setup>
62+
63+
64+
// <transcription>
65+
// Get an audio client
66+
var audioClient = await model.GetAudioClientAsync();
67+
audioClient.Settings.Language = "en";
68+
69+
// Get a transcription with streaming outputs
70+
var audioFile = args.Length > 0 ? args[0] : Path.Combine(AppContext.BaseDirectory, "Recording.mp3");
71+
Console.WriteLine($"Transcribing audio with streaming output: {Path.GetFileName(audioFile)}");
72+
var response = audioClient.TranscribeAudioStreamingAsync(audioFile, CancellationToken.None);
73+
await foreach (var chunk in response)
74+
{
75+
Console.Write(chunk.Text);
76+
Console.Out.Flush();
77+
}
78+
79+
Console.WriteLine();
80+
// </transcription>
81+
82+
83+
// <cleanup>
84+
// Tidy up - unload the model
85+
await model.UnloadAsync();
86+
// </cleanup>
87+
// </complete_code>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Audio Transcription (C#)
2+
3+
Transcribe audio files using the Foundry Local C# SDK.
4+
5+
> Part of the [Foundry Local samples for C#](../).
6+
7+
## Prerequisites
8+
9+
- [Foundry Local](https://learn.microsoft.com/azure/foundry-local/) installed
10+
- .NET 9 SDK
11+
12+
## Run
13+
14+
```bash
15+
dotnet run
16+
```
17+
18+
See the [Foundry Local documentation](https://learn.microsoft.com/azure/foundry-local/) for more details.
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: Audio Transcription (C#)
2+
description: Transcribe audio files using the Foundry Local C# SDK.
3+
4+
build: "dotnet restore --source https://api.nuget.org/v3/index.json && dotnet build --no-restore --verbosity minimal"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<!-- Windows: target Windows SDK for WinML hardware acceleration -->
10+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
11+
<TargetFramework>net8.0-windows10.0.18362.0</TargetFramework>
12+
<Platforms>ARM64;x64</Platforms>
13+
<WindowsPackageType>None</WindowsPackageType>
14+
<EnableCoreMrtTooling>false</EnableCoreMrtTooling>
15+
</PropertyGroup>
16+
17+
<!-- Non-Windows: standard .NET -->
18+
<PropertyGroup Condition="!$([MSBuild]::IsOSPlatform('Windows'))">
19+
<TargetFramework>net8.0</TargetFramework>
20+
</PropertyGroup>
21+
22+
<PropertyGroup Condition="'$(RuntimeIdentifier)'==''">
23+
<RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
24+
</PropertyGroup>
25+
26+
<!-- Windows: WinML for hardware acceleration -->
27+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
28+
<PackageReference Include="Microsoft.AI.Foundry.Local.WinML" />
29+
</ItemGroup>
30+
31+
<!-- Non-Windows: standard SDK -->
32+
<ItemGroup Condition="!$([MSBuild]::IsOSPlatform('Windows'))">
33+
<PackageReference Include="Microsoft.AI.Foundry.Local" />
34+
</ItemGroup>
35+
36+
<!-- Linux GPU support -->
37+
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
38+
<PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu" />
39+
<PackageReference Include="Microsoft.ML.OnnxRuntimeGenAI.Cuda" />
40+
</ItemGroup>
41+
42+
<!-- Shared utilities -->
43+
<ItemGroup>
44+
<Compile Include="../Shared/*.cs" />
45+
</ItemGroup>
46+
47+
</Project>

0 commit comments

Comments
 (0)