Skip to content

Commit 874d612

Browse files
jeffhandleyMackinnonBuckjmatthiesenjongallowayCopilot
authored
Microsoft.Extensions.AI.Templates version 9.4.0-preview.2 (#6303)
* Add missing reference to M.E.AI.OpenAI (#6275) * Update README.md with keyless auth guidance (#6261) * Update README.md * Update src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/README.md Co-authored-by: Jon Galloway <[email protected]> --------- Co-authored-by: Jon Galloway <[email protected]> * Add note on extending timeout for Ollama client (#6258) * Add note on extending timeout for Ollama client Standard HttpClient timeout of 10 seconds applied by Service Defaults under .NET Aspire is likely too short for Ollama calls. Add note with code to extend this timeout. * Update src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/README.Aspire.md Co-authored-by: Copilot <[email protected]> * Update src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/README.Aspire.md Co-authored-by: Mackinnon Buck <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Mackinnon Buck <[email protected]> * Update chat template dependencies, fix OpenAI/Aspire config, and address build warnings (#6280) * Update chat template dependencies * Update test snapshots * Update Aspire version * Revert Aspire + update CommunityToolkit.Aspire * Open README in VS after project creation * Add Known Issue to Aspire README for Qdrant * Update survey template URL * Set the Project Template package version to -preview.2 * Update template baseline * Update template pinned versions * Do not append template args to snapshot names * Fix vector store index in the README. Add an AzureAISearch template test. * Add a note to the Aspire README for trusting the development certificate * Use AddOpenAIClient for OpenAI and AddAzureOpenAIClient for Azure OpenAI * Remove duplicated using System.ClientModel * Update Aspire README to specify the exception thrown for the known issue * Augment the Aspire README for more Docker notes for Ollama and Qdrant * Fix Microsoft.Extensions.Http.Resilience warnings with separate pinned versions * Update test baseline for: Rename EmbeddingGeneratorExtensions.GenerateEmbedding extension methods (#6295) * Add --managed-identity to the template developer README * Apply the Ollama timeout recommendation in the template code * Call http.RemoveAllResilienceHandlers before adding the handler * Update template test baseline --------- Co-authored-by: Jeff Handley <[email protected]> Co-authored-by: David Cantu <[email protected]> --------- Co-authored-by: Mackinnon Buck <[email protected]> Co-authored-by: Jordan Matthiesen <[email protected]> Co-authored-by: Jon Galloway <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: David Cantu <[email protected]>
1 parent 398f7f6 commit 874d612

File tree

139 files changed

+17892
-72
lines changed

Some content is hidden

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

139 files changed

+17892
-72
lines changed

eng/Versions.props

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,19 @@
158158
<!-- AI templates -->
159159
<AspireVersion>9.1.0</AspireVersion>
160160
<AspireAzureAIOpenAIVersion>9.1.0-preview.1.25121.10</AspireAzureAIOpenAIVersion>
161-
<AzureAIProjectsVersion>1.0.0-beta.3</AzureAIProjectsVersion>
161+
<AzureAIProjectsVersion>1.0.0-beta.6</AzureAIProjectsVersion>
162162
<AzureAIOpenAIVersion>2.2.0-beta.4</AzureAIOpenAIVersion>
163163
<AzureIdentityVersion>1.13.2</AzureIdentityVersion>
164164
<AzureSearchDocumentsVersion>11.6.0</AzureSearchDocumentsVersion>
165-
<CommunityToolkitAspireHostingOllamaVersion>9.2.2-beta.236</CommunityToolkitAspireHostingOllamaVersion>
166-
<CommunityToolkitAspireHostingSqliteVersion>9.2.2-beta.236</CommunityToolkitAspireHostingSqliteVersion>
167-
<CommunityToolkitAspireMicrosoftEntityFrameworkCoreSqliteVersion>9.2.2-beta.236</CommunityToolkitAspireMicrosoftEntityFrameworkCoreSqliteVersion>
168-
<CommunityToolkitAspireOllamaSharpVersion>9.2.2-beta.236</CommunityToolkitAspireOllamaSharpVersion>
169-
<MicrosoftExtensionsServiceDiscoveryVersion>9.1.0</MicrosoftExtensionsServiceDiscoveryVersion>
170-
<MicrosoftSemanticKernelConnectorsAzureAISearchVersion>1.41.0-preview</MicrosoftSemanticKernelConnectorsAzureAISearchVersion>
171-
<MicrosoftSemanticKernelConnectorsQdrantVersion>1.41.0-preview</MicrosoftSemanticKernelConnectorsQdrantVersion>
172-
<MicrosoftSemanticKernelCoreVersion>1.41.0</MicrosoftSemanticKernelCoreVersion>
173-
<OllamaSharpVersion>5.1.9</OllamaSharpVersion>
165+
<CommunityToolkitAspireHostingOllamaVersion>9.3.1-beta.260</CommunityToolkitAspireHostingOllamaVersion>
166+
<CommunityToolkitAspireHostingSqliteVersion>9.3.1-beta.260</CommunityToolkitAspireHostingSqliteVersion>
167+
<CommunityToolkitAspireMicrosoftEntityFrameworkCoreSqliteVersion>9.3.1-beta.260</CommunityToolkitAspireMicrosoftEntityFrameworkCoreSqliteVersion>
168+
<CommunityToolkitAspireOllamaSharpVersion>9.3.1-beta.260</CommunityToolkitAspireOllamaSharpVersion>
169+
<MicrosoftExtensionsServiceDiscoveryVersion>9.2.0</MicrosoftExtensionsServiceDiscoveryVersion>
170+
<MicrosoftSemanticKernelConnectorsAzureAISearchVersion>1.45.0-preview</MicrosoftSemanticKernelConnectorsAzureAISearchVersion>
171+
<MicrosoftSemanticKernelConnectorsQdrantVersion>1.45.0-preview</MicrosoftSemanticKernelConnectorsQdrantVersion>
172+
<MicrosoftSemanticKernelCoreVersion>1.45.0</MicrosoftSemanticKernelCoreVersion>
173+
<OllamaSharpVersion>5.1.12</OllamaSharpVersion>
174174
<OpenTelemetryVersion>1.9.0</OpenTelemetryVersion>
175175
<PdfPigVersion>0.1.9</PdfPigVersion>
176176
<SystemLinqAsyncVersion>6.0.1</SystemLinqAsyncVersion>

src/ProjectTemplates/GeneratedContent.targets

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,24 @@
1515
<Target Name="ComputeGeneratedContentProperties">
1616
<PropertyGroup>
1717
<!-- Define optional pinned versions of certain dependencies. -->
18-
<TemplatePinnedRepoPackagesVersion>9.3.0-preview.1.25161.3</TemplatePinnedRepoPackagesVersion>
19-
<TemplatePinnedMicrosoftEntityFrameworkCoreSqliteVersion>9.0.3</TemplatePinnedMicrosoftEntityFrameworkCoreSqliteVersion>
18+
<TemplatePinnedRepoPackagesVersion>9.4.0</TemplatePinnedRepoPackagesVersion>
19+
<TemplatePinnedRepoAIPackagesVersion>9.4.0-preview.1.25207.5</TemplatePinnedRepoAIPackagesVersion>
20+
<TemplatePinnedMicrosoftEntityFrameworkCoreSqliteVersion>9.0.4</TemplatePinnedMicrosoftEntityFrameworkCoreSqliteVersion>
2021

2122
<!-- By default, don't use pinned dependency versions. -->
22-
<TemplateUsePinnedRepoPackagesVersion Condition="'$(TemplateUsePinnedRepoPackagesVersion)' == ''">false</TemplateUsePinnedRepoPackagesVersion>
23-
<TemplateUsePinnedMicrosoftEntityFrameworkCoreSqliteVersion Condition="'$(TemplateUsePinnedMicrosoftEntityFrameworkCoreSqliteVersion)' == ''">false</TemplateUsePinnedMicrosoftEntityFrameworkCoreSqliteVersion>
23+
<TemplateUsePinnedPackageVersions Condition="'$(TemplateUsePinnedPackageVersions)' == ''">false</TemplateUsePinnedPackageVersions>
2424

2525
<!-- Apply pinned dependency versions if enabled. -->
26-
<TemplateRepoPackagesVersion Condition="'$(TemplateUsePinnedRepoPackagesVersion)' == 'true'">$(TemplatePinnedRepoPackagesVersion)</TemplateRepoPackagesVersion>
27-
<TemplateMicrosoftEntityFrameworkCoreSqliteVersion Condition="'$(TemplateUsePinnedMicrosoftEntityFrameworkCoreSqliteVersion)' == 'true'">$(TemplatePinnedMicrosoftEntityFrameworkCoreSqliteVersion)</TemplateMicrosoftEntityFrameworkCoreSqliteVersion>
26+
<TemplateRepoPackagesVersion Condition="'$(TemplateUsePinnedPackageVersions)' == 'true'">$(TemplatePinnedRepoPackagesVersion)</TemplateRepoPackagesVersion>
27+
<TemplateRepoAIPackagesVersion Condition="'$(TemplateUsePinnedPackageVersions)' == 'true'">$(TemplatePinnedRepoAIPackagesVersion)</TemplateRepoAIPackagesVersion>
28+
<TemplateMicrosoftEntityFrameworkCoreSqliteVersion Condition="'$(TemplateUsePinnedPackageVersions)' == 'true'">$(TemplatePinnedMicrosoftEntityFrameworkCoreSqliteVersion)</TemplateMicrosoftEntityFrameworkCoreSqliteVersion>
2829

2930
<!-- Fall back on default dependency versions if pinned versions were not applied. -->
3031
<TemplateRepoPackagesVersion Condition="'$(TemplateRepoPackagesVersion)' == ''">$(Version)</TemplateRepoPackagesVersion>
32+
<TemplateRepoAIPackagesVersion Condition="'$(TemplateRepoAIPackagesVersion)' == ''">$(Version)</TemplateRepoAIPackagesVersion>
3133
<TemplateMicrosoftEntityFrameworkCoreSqliteVersion Condition="'$(TemplateMicrosoftEntityFrameworkCoreSqliteVersion)' == ''">$(MicrosoftEntityFrameworkCoreSqliteVersion)</TemplateMicrosoftEntityFrameworkCoreSqliteVersion>
3234

33-
<_TemplateUsingJustBuiltPackages Condition="'$(TemplateRepoPackagesVersion)' == '$(Version)'">true</_TemplateUsingJustBuiltPackages>
35+
<_TemplateUsingJustBuiltPackages Condition="'$(TemplateRepoAIPackagesVersion)' == '$(Version)'">true</_TemplateUsingJustBuiltPackages>
3436

3537
<!-- Specify package version variables used in template content. -->
3638
<GeneratedContentProperties>
@@ -51,7 +53,7 @@
5153
CommunityToolkitAspireMicrosoftEntityFrameworkCoreSqliteVersion=$(CommunityToolkitAspireMicrosoftEntityFrameworkCoreSqliteVersion);
5254
CommunityToolkitAspireOllamaSharpVersion=$(CommunityToolkitAspireOllamaSharpVersion);
5355
MicrosoftEntityFrameworkCoreSqliteVersion=$(TemplateMicrosoftEntityFrameworkCoreSqliteVersion);
54-
MicrosoftExtensionsAIVersion=$(TemplateRepoPackagesVersion);
56+
MicrosoftExtensionsAIVersion=$(TemplateRepoAIPackagesVersion);
5557
MicrosoftExtensionsHttpResilienceVersion=$(TemplateRepoPackagesVersion);
5658
MicrosoftExtensionsServiceDiscoveryVersion=$(MicrosoftExtensionsServiceDiscoveryVersion);
5759
MicrosoftSemanticKernelConnectorsAzureAISearchVersion=$(MicrosoftSemanticKernelConnectorsAzureAISearchVersion);

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/Microsoft.Extensions.AI.Templates.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<PackageTags>dotnet-new;templates;ai</PackageTags>
88

99
<Stage>preview</Stage>
10+
<PreReleaseVersionIteration>2</PreReleaseVersionIteration>
1011
<Workstream>AI</Workstream>
1112
<MinCodeCoverage>0</MinCodeCoverage>
1213
<MinMutationScore>0</MinMutationScore>

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/.template.config/template.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
"A7D19173-F0AD-4A8D-B8EA-E12DE203E409"
2323
],
2424
"primaryOutputs": [
25+
{
26+
"path": "./README.md"
27+
},
2528
{
2629
"condition": "(!IsAspire)",
2730
"path": "./ChatWithCustomData-CSharp.csproj"
@@ -41,9 +44,6 @@
4144
{
4245
"condition": "(IsAspire)",
4346
"path": "./ChatWithCustomData-CSharp.Web/ChatWithCustomData-CSharp.Web.csproj"
44-
},
45-
{
46-
"path": "./README.md"
4747
}
4848
],
4949
"sources": [{
@@ -563,7 +563,7 @@
563563
"manualInstructions": [ ],
564564
"actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
565565
"args": {
566-
"files": "1"
566+
"files": "0"
567567
},
568568
"continueOnError": true
569569
}],

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.ServiceDefaults/Extensions.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,25 @@ public static TBuilder AddServiceDefaults<TBuilder>(this TBuilder builder) where
2525

2626
builder.Services.ConfigureHttpClientDefaults(http =>
2727
{
28+
#pragma warning disable EXTEXP0001 // RemoveAllResilienceHandlers is experimental
29+
http.RemoveAllResilienceHandlers();
30+
#pragma warning restore EXTEXP0001
31+
32+
#if (IsOllama)
33+
// Turn on resilience by default
34+
http.AddStandardResilienceHandler(config =>
35+
{
36+
// Extend the HTTP Client timeout for Ollama
37+
config.AttemptTimeout.Timeout = TimeSpan.FromMinutes(3);
38+
39+
// Must be at least double the AttemptTimeout to pass options validation
40+
config.CircuitBreaker.SamplingDuration = TimeSpan.FromMinutes(10);
41+
config.TotalRequestTimeout.Timeout = TimeSpan.FromMinutes(10);
42+
});
43+
#else
2844
// Turn on resilience by default
2945
http.AddStandardResilienceHandler();
46+
#endif
3047

3148
// Turn on service discovery by default
3249
http.AddServiceDiscovery();

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/ChatWithCustomData-CSharp.Web.csproj.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#endif -->
1414
<!--#if (IsOllama)
1515
<PackageReference Include="OllamaSharp" Version="${OllamaSharpVersion}" />
16-
#elif (IsGHModels && !IsAspire)
16+
#elif ((IsGHModels || IsOpenAI) && !IsAspire)
1717
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="${MicrosoftExtensionsAIVersion}" />
1818
#elif (IsAzureAiFoundry)
1919
<PackageReference Include="Azure.AI.Projects" Version="${AzureAIProjectsVersion}" />

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Components/Layout/SurveyPrompt.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<div>
99
How well is this template working for you? Please take a
10-
<a target="_blank" href="https://aka.ms/dotnet-chat-template-survey">brief survey</a>
10+
<a target="_blank" href="https://aka.ms/dotnet-chat-templatePreview2-survey">brief survey</a>
1111
and tell us what you think.
1212
</div>
1313
</div>

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Program.Aspire.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@
2626
builder.AddOllamaApiClient("embeddings")
2727
.AddEmbeddingGenerator();
2828
#elif (IsAzureAiFoundry)
29-
#else // IsAzureOpenAI || IsOpenAI || IsGHModels
29+
#else // (IsOpenAI || IsAzureOpenAI || IsGHModels)
30+
#if (IsOpenAI)
31+
var openai = builder.AddOpenAIClient("openai");
32+
#else
3033
var openai = builder.AddAzureOpenAIClient("openai");
34+
#endif
3135
openai.AddChatClient("gpt-4o-mini")
3236
.UseFunctionInvocation()
3337
.UseOpenTelemetry(configure: c =>

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
using Azure;
99
#if (UseManagedIdentity)
1010
using Azure.Identity;
11-
#else
12-
using System.ClientModel;
1311
#endif
1412
#endif
1513
#if (IsOllama)

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AI Chat with Custom Data
22

3-
This project is an AI chat application that demonstrates how to chat with custom data using an AI language model. Please note that this template is currently in an early preview stage. If you have feedback, please take a [brief survey](https://aka.ms/dotnet-chat-template-survey).
3+
This project is an AI chat application that demonstrates how to chat with custom data using an AI language model. Please note that this template is currently in an early preview stage. If you have feedback, please take a [brief survey](https://aka.ms/dotnet-chat-templatePreview2-survey).
44

55
>[!NOTE]
66
> Before running this project you need to configure the API keys or endpoints for the providers you have chosen. See below for details specific to your choices.
@@ -96,7 +96,7 @@ Deploy the `gpt-4o-mini` and `text-embedding-3-small` models to your Azure OpenA
9696
9797
#### ---#if (UseManagedIdentity)
9898
### 3. Configure Azure OpenAI for Keyless Authentication
99-
This template is configured to use keyless authentication (also known as Managed Identity, with Entra ID). In the Azure Portal, when viewing the Azure OpenAI resource you just created, view access control settings and assign yourself the `Cognitive Services OpenAI User` role. [Learn more](https://learn.microsoft.com/azure/developer/ai/keyless-connections).
99+
This template is configured to use keyless authentication (also known as Managed Identity, with Entra ID). In the Azure Portal, when viewing the Azure OpenAI resource you just created, view access control settings and assign yourself the `Azure AI Developer` role. [Learn more about configuring authentication for local development](https://learn.microsoft.com/azure/developer/ai/keyless-connections?tabs=csharp%2Cazure-cli#authenticate-for-local-development).
100100
101101
### 4. Configure Azure OpenAI Endpoint
102102
Configure your Azure OpenAI endpoint for this project, using .NET User Secrets:
@@ -158,7 +158,7 @@ To use Azure AI Search, you will need an Azure account and an Azure AI Search re
158158
### 1. Create an Azure AI Search Resource
159159
Follow the instructions in the [Azure portal](https://portal.azure.com/) to create an Azure AI Search resource. Note that there is a free tier for the service but it is not currently the default setting on the portal.
160160
161-
Note that if you previously used the same Azure AI Search resource with different model using this project name, you may need to delete your `$$VectorStoreIndexName$$` index using the [Azure portal](https://portal.azure.com/) first before continuing; otherwise, data ingestion may fail due to a vector dimension mismatch.
161+
Note that if you previously used the same Azure AI Search resource with different model using this project name, you may need to delete your `data-ChatWithCustomData-CSharp.Web-ingestion` index using the [Azure portal](https://portal.azure.com/) first before continuing; otherwise, data ingestion may fail due to a vector dimension mismatch.
162162
163163
#### ---#if (UseManagedIdentity)
164164
### 2. Configure Azure AI Search for Keyless Authentication

0 commit comments

Comments
 (0)