-
Notifications
You must be signed in to change notification settings - Fork 768
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d63f2b4
commit fa798ad
Showing
48 changed files
with
1,855 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# We're not tracking any package-lock.json files in source control here because | ||
# we don't ship pre-generated NPM lockfiles in the templates. But we don't put | ||
# them in the project template's .gitignore file because they should be tracked | ||
# in source control when people actually create projects from the templates. | ||
package-lock.json | ||
|
||
*/src/**/*.csproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" /> | ||
|
||
<PropertyGroup> | ||
<NoWarn>$(NoWarn);SA1633;CS1591</NoWarn> | ||
<SkipAnalyzers>true</SkipAnalyzers> | ||
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally> | ||
</PropertyGroup> | ||
</Project> |
40 changes: 40 additions & 0 deletions
40
...ojectTemplates/Microsoft.Extensions.AI.Templates/Microsoft.Extensions.AI.Templates.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<PackageType>Template</PackageType> | ||
<TargetFrameworks>$(NetCoreTargetFrameworks);netstandard2.0</TargetFrameworks> | ||
<Description>Project templates for Microsoft.Extensions.AI.</Description> | ||
<PackageTags>dotnet-new;templates;ai</PackageTags> | ||
|
||
<Stage>preview</Stage> | ||
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion> | ||
<Workstream>AI</Workstream> | ||
<MinCodeCoverage>0</MinCodeCoverage> | ||
<MinMutationScore>0</MinMutationScore> | ||
|
||
<IsPackable>true</IsPackable> | ||
<IsProjectReferenceProvider>false</IsProjectReferenceProvider> | ||
<IncludeContentInPack>true</IncludeContentInPack> | ||
<IncludeBuildOutput>false</IncludeBuildOutput> | ||
<IncludeSymbols>false</IncludeSymbols> | ||
<ContentTargetFolders>content</ContentTargetFolders> | ||
<EnableDefaultItems>false</EnableDefaultItems> | ||
<NoDefaultExcludes>true</NoDefaultExcludes> | ||
<NoPackageAnalysis>true</NoPackageAnalysis> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="src\ChatWithCustomData\**\*" Exclude="**\bin\**;**\obj\**;**\node_modules\**;**\*.user;**\*.csproj.in;**\*.out.js;**\*.generated.css;**\package-lock.json" /> | ||
<Compile Remove="**\*" /> | ||
</ItemGroup> | ||
|
||
<!-- Copy the .csproj.in files to corresponding .csproj files --> | ||
<!-- The reason they are initially .csproj.in is that there's no other way to exclude them from the main build --> | ||
<Target Name="PrepareCsprojFiles" BeforeTargets="PrepareForBuild"> | ||
<ItemGroup> | ||
<_CsprojFiles Include="src\**\*.csproj.in" /> | ||
</ItemGroup> | ||
<Copy SourceFiles="@(_CsprojFiles)" DestinationFiles="@(_CsprojFiles->'$([System.String]::Copy('%(Identity)').Replace('.csproj.in', '.csproj'))')" SkipUnchangedFiles="true" /> | ||
</Target> | ||
|
||
</Project> |
Empty file.
3 changes: 3 additions & 0 deletions
3
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Microsoft.Extensions.AI.Templates | ||
|
||
Provides project templates for Microsoft.Extensions.AI. |
Binary file added
BIN
+5.42 KB
...rosoft.Extensions.AI.Templates/src/ChatWithCustomData/.template.config/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions
19
...s/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/.template.config/ide.host.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/ide.host", | ||
"order": 0, | ||
"icon": "icon.png", | ||
"symbolInfo": [ | ||
{ | ||
"id": "AiServiceProvider", | ||
"isVisible": true | ||
}, | ||
{ | ||
"id": "UseManagedIdentity", | ||
"isVisible": true | ||
}, | ||
{ | ||
"id": "VectorStore", | ||
"isVisible": true | ||
} | ||
] | ||
} |
212 changes: 212 additions & 0 deletions
212
...s/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/.template.config/template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/template", | ||
"author": "Microsoft", | ||
"classifications": [ "Common", "AI", "Web" ], | ||
"identity": "Microsoft.Extensions.AI.Templates.Chat.CSharp", | ||
"name": "AI Chat with Custom Data", | ||
"description": "A project template for creating an AI chat application. It can perform retrieval-augmented generation (RAG) using your own data.", | ||
"shortName": "chat", | ||
"defaultName": "ChatApp", | ||
"sourceName": "ChatWithCustomData.Web", // TODO: When we support multi-project output, this needs to change to ChatWithCustomData, then we need some other technique to make it avoid emitting a .Web suffix in the single-project case | ||
"tags": { | ||
"language": "C#", | ||
"type": "project" | ||
}, | ||
"guids": [ | ||
"d5681fae-b21b-4114-b781-48180f08c0c4" | ||
], | ||
"sources": [{ | ||
"source": "./", | ||
"target": "./", | ||
"modifiers": [ | ||
{ | ||
// For now, we only produce single-project output. | ||
// Later when we support multi-project output with Qdrant on Docker, we'll also emit | ||
// a second project ChatWithCustomData.AppHost and hence will suppress this renaming. | ||
"rename": { | ||
"ChatWithCustomData.Web/": "./" | ||
} | ||
} | ||
] | ||
}], | ||
"symbols":{ | ||
"framework": { | ||
"type": "parameter", | ||
"description": "The target framework for the project.", | ||
"datatype": "choice", | ||
"choices": [ | ||
{ | ||
"choice": "net9.0", | ||
"description": "Target net9.0" | ||
} | ||
], | ||
"replaces": "net9.0", | ||
"defaultValue": "net9.0" | ||
}, | ||
"hostIdentifier": { | ||
"type": "bind", | ||
"binding": "HostIdentifier" | ||
}, | ||
"AiServiceProvider": { | ||
"type": "parameter", | ||
"displayName": "_AI service provider", | ||
"datatype": "choice", | ||
"defaultValue": "azureopenai", | ||
"choices": [ | ||
// { | ||
// "choice": "githubmodels", | ||
// "displayName": "GitHub Models", | ||
// "description": "Uses GitHub Models" | ||
// }, | ||
{ | ||
"choice": "azureopenai", | ||
"displayName": "Azure OpenAI", | ||
"description": "Uses Azure OpenAI service" | ||
}, | ||
{ | ||
"choice": "openai", | ||
"displayName": "OpenAI Platform", | ||
"description": "Uses the OpenAI Platform" | ||
}, | ||
{ | ||
"choice": "ollama", | ||
"displayName": "Ollama (for local development)", | ||
"description": "Uses Ollama with the llama3.2 model for local development" | ||
} | ||
// { | ||
// "choice": "azureaifoundry", | ||
// "displayName": "Azure AI Foundry (Preview)", | ||
// "description": "Uses Azure AI Foundry (Preview)" | ||
// } | ||
] | ||
}, | ||
"UseManagedIdentity": { | ||
"type": "parameter", | ||
"displayName": "Use managed identity", | ||
"datatype": "bool", | ||
"defaultValue": "true", | ||
"isEnabled": "(AiServiceProvider == \"azureopenai\")", | ||
"description": "Use managed identity to access Azure services" | ||
}, | ||
"VectorStore": { | ||
"type": "parameter", | ||
"displayName": "_Vector store", | ||
"datatype": "choice", | ||
"defaultValue": "local", | ||
"choices": [ | ||
{ | ||
"choice": "local", | ||
"displayName": "Local on-disk (for prototyping)", | ||
"description": "Uses a JSON file on disk. You can change the implementation to a real vector database before publishing." | ||
}, | ||
{ | ||
"choice": "azureaisearch", | ||
"displayName": "Azure AI Search", | ||
"description": "Uses Azure AI Search. This also avoids the need to define a data ingestion pipeline, since it's managed by Azure AI Search." | ||
} | ||
] | ||
}, | ||
"IsAzureOpenAi": { | ||
"type": "computed", | ||
"value": "(AiServiceProvider == \"azureopenai\")" | ||
}, | ||
"IsOpenAi": { | ||
"type": "computed", | ||
"value": "(AiServiceProvider == \"openai\")" | ||
}, | ||
"IsGHModels": { | ||
"type": "computed", | ||
"value": "(AiServiceProvider == \"githubmodels\")" | ||
}, | ||
"IsOllama": { | ||
"type": "computed", | ||
"value": "(AiServiceProvider == \"ollama\")" | ||
}, | ||
"IsAzureAiFoundry": { | ||
"type": "computed", | ||
"value": "(AiServiceProvider == \"azureaifoundry\")" | ||
}, | ||
"UseAzureAISearch": { | ||
"type": "computed", | ||
"value": "(VectorStore == \"azureaisearch\")" | ||
}, | ||
"UseLocalVectorStore": { | ||
"type": "computed", | ||
"value": "(VectorStore == \"local\")" | ||
}, | ||
"ChatModel": { | ||
"type": "parameter", | ||
"displayName": "Model/deployment for chat completions. Example: gpt-4o-mini", | ||
"description": "Model/deployment for chat completions. Example: gpt-4o-mini" | ||
}, | ||
"EmbeddingModel": { | ||
"type": "parameter", | ||
"displayName": "Model/deployment for embeddings. Example: text-embedding-3-small", | ||
"description": "Model/deployment for embeddings. Example: text-embedding-3-small" | ||
}, | ||
"OpenAiChatModelDefault": { | ||
"type": "generated", | ||
"generator": "constant", | ||
"parameters": { | ||
"value": "gpt-4o-mini" | ||
} | ||
}, | ||
"OpenAiEmbeddingModelDefault": { | ||
"type": "generated", | ||
"generator": "constant", | ||
"parameters": { | ||
"value": "text-embedding-3-small" | ||
} | ||
}, | ||
"OpenAiChatModel": { | ||
"type": "generated", | ||
"generator": "coalesce", | ||
"parameters": { | ||
"sourceVariableName": "ChatModel", | ||
"fallbackVariableName": "OpenAiChatModelDefault" | ||
}, | ||
"replaces": "gpt-4o-mini" | ||
}, | ||
"OpenAiEmbeddingModel": { | ||
"type": "generated", | ||
"generator": "coalesce", | ||
"parameters": { | ||
"sourceVariableName": "EmbeddingModel", | ||
"fallbackVariableName": "OpenAiEmbeddingModelDefault" | ||
}, | ||
"replaces": "text-embedding-3-small" | ||
}, | ||
"OllamaChatModelDefault": { | ||
"type": "generated", | ||
"generator": "constant", | ||
"parameters": { | ||
"value": "llama3.1" | ||
} | ||
}, | ||
"OllamaEmbeddingModelDefault": { | ||
"type": "generated", | ||
"generator": "constant", | ||
"parameters": { | ||
"value": "all-minilm" | ||
} | ||
}, | ||
"OllamaChatModel": { | ||
"type": "generated", | ||
"generator": "coalesce", | ||
"parameters": { | ||
"sourceVariableName": "ChatModel", | ||
"fallbackVariableName": "OllamaChatModelDefault" | ||
}, | ||
"replaces": "llama3.2" | ||
}, | ||
"OllamaEmbeddingModel": { | ||
"type": "generated", | ||
"generator": "coalesce", | ||
"parameters": { | ||
"sourceVariableName": "EmbeddingModel", | ||
"fallbackVariableName": "OllamaEmbeddingModelDefault" | ||
}, | ||
"replaces": "all-minilm" | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...icrosoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData.Web/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.db | ||
*.db-* | ||
wwwroot/lib.out.js | ||
wwwroot/*.generated.css |
48 changes: 48 additions & 0 deletions
48
....Templates/src/ChatWithCustomData/ChatWithCustomData.Web/ChatWithCustomData.Web.csproj.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<Import Project="Tailwind.targets" /> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<UserSecretsId>d5681fae-b21b-4114-b781-48180f08c0c4</UserSecretsId> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!--#if (IsOllama) | ||
<PackageReference Include="OllamaSharp" Version="5.0.5" /> | ||
#elif (IsGHModels) | ||
<PackageReference Include="OpenAI" Version="2.1.0" /> | ||
#elif (IsAzureAiFoundry) | ||
<PackageReference Include="Azure.AI.Projects" Version="1.0.0-beta.3" /> | ||
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0" /> | ||
#else --> | ||
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0" /> | ||
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.1.0-preview.1.25064.3" /> | ||
<!--#endif --> | ||
<!--#if (UseManagedIdentity) --> | ||
<PackageReference Include="Azure.Identity" Version="1.13.2" /> | ||
<!--#endif --> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.AI" Version="9.1.0-preview.1.25064.3" /> | ||
<PackageReference Include="Microsoft.SemanticKernel.Core" Version="1.34.0" /> | ||
<PackageReference Include="PdfPig" Version="0.1.9" /> | ||
<PackageReference Include="System.Linq.Async" Version="6.0.1" /> | ||
<!--#if (UseAzureAISearch) | ||
<PackageReference Include="Azure.Search.Documents" Version="11.6.0" /> | ||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.AzureAISearch" Version="1.34.0-preview" /> | ||
#endif --> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="Data\**" CopyToOutputDirectory="PreserveNewest" /> | ||
</ItemGroup> | ||
|
||
<Target Name="BuildNpmDependencies" BeforeTargets="PrepareForBuild" | ||
Inputs="package-lock.json; rollup.config.js; wwwroot\lib.js" Outputs="wwwroot\lib.out.js"> | ||
<Exec Command="npm install" /> | ||
<Exec Command="npm run build" EnvironmentVariables="FORCE_COLOR=0" /> | ||
</Target> | ||
|
||
</Project> |
24 changes: 24 additions & 0 deletions
24
...xtensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData.Web/Components/App.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<base href="/" /> | ||
<link rel="stylesheet" href="@Assets["app.generated.css"]" /> | ||
<link rel="stylesheet" href="@Assets["ChatWithCustomData.Web.styles.css"]" /> | ||
<ImportMap /> | ||
<HeadOutlet @rendermode="@renderMode" /> | ||
</head> | ||
|
||
<body> | ||
<Routes @rendermode="@renderMode" /> | ||
<script src="lib.out.js"></script> | ||
<script src="_framework/blazor.web.js"></script> | ||
</body> | ||
|
||
</html> | ||
|
||
@code { | ||
private readonly IComponentRenderMode renderMode = new InteractiveServerRenderMode(prerender: false); | ||
} |
1 change: 1 addition & 0 deletions
1
...ates/src/ChatWithCustomData/ChatWithCustomData.Web/Components/Layout/LoadingSpinner.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div> |
Oops, something went wrong.