mirror of
https://github.com/microsoft/autogen.git
synced 2026-01-26 08:27:58 -05:00
refactor WIP (#4)
Co-authored-by: Kosta Petan <Kosta.Petan@microsoft.com>
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
using Microsoft.SemanticKernel;
|
||||
|
||||
internal static class KernelConfigExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds a text completion service to the list. It can be either an OpenAI or Azure OpenAI backend service.
|
||||
/// </summary>
|
||||
/// <param name="kernelConfig"></param>
|
||||
/// <param name="kernelSettings"></param>
|
||||
/// <exception cref="Exception"></exception>
|
||||
internal static void AddCompletionBackend(this KernelConfig kernelConfig, KernelSettings kernelSettings)
|
||||
{
|
||||
switch (kernelSettings.ServiceType.ToUpperInvariant())
|
||||
{
|
||||
case KernelSettings.AzureOpenAI:
|
||||
kernelConfig.AddAzureChatCompletionService(kernelSettings.DeploymentOrModelId, kernelSettings.Endpoint, kernelSettings.ApiKey);
|
||||
break;
|
||||
|
||||
case KernelSettings.OpenAI:
|
||||
kernelConfig.AddOpenAITextCompletionService(modelId: kernelSettings.DeploymentOrModelId, apiKey: kernelSettings.ApiKey, orgId: kernelSettings.OrgId, serviceId: kernelSettings.ServiceId);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new System.Exception($"Invalid service type value: {kernelSettings.ServiceType}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
name: sk-dev-team
|
||||
services:
|
||||
sk-func:
|
||||
project: ./sk-azfunc-server
|
||||
project: ./src/apps/gh-flow-df
|
||||
language: dotnet
|
||||
host: function
|
||||
161
sk-dev-team.sln
161
sk-dev-team.sln
@@ -3,39 +3,29 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.001.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "sk-csharp-azure-functions", "sk-azfunc-server\sk-csharp-azure-functions.csproj", "{C787026C-9435-4FD4-AEE5-B005EAEF9E3D}"
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{088E1138-FF7B-4179-AD37-4E3819C56D7E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "skills", "skills\skills.csproj", "{51F987E4-3E70-4DB9-9493-AFCFA0CE3773}"
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "apps", "apps", "{4D8667EC-09BE-4CB1-A278-E1CCD83B62B0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cli", "cli\cli.csproj", "{C0073CEA-8A1B-43BC-BADE-F6323CDFA853}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cli", "src\apps\cli\cli.csproj", "{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "util", "util", "{16A0621E-E1B8-4737-9B3D-08EB9CEF87B0}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gh-flow", "src\apps\gh-flow\gh-flow.csproj", "{37C45587-DD0C-4BFE-817A-21301567A94A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "seed-memory", "util\seed-memory\seed-memory.csproj", "{94C4BF5F-50BF-41CF-8B94-11F39CA430FA}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gh-flow-df", "src\apps\gh-flow-df\gh-flow-df.csproj", "{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "seed-memory", "src\apps\seed-memory\seed-memory.csproj", "{110B2C34-0F48-41CE-BC8F-AE3D24E79627}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkflowsApp", "src\apps\WorkflowsApp\WorkflowsApp.csproj", "{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{24EB6E3A-C080-4B27-8EA7-F6C91446B840}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.SemanticKernel", "src\libs\Elsa.SemanticKernel\Elsa.SemanticKernel.csproj", "{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MS.AI.DevTeam", "src\libs\MS.AI.DevTeam\MS.AI.DevTeam.csproj", "{A064E523-718C-4464-B8AD-BC00BF2E358A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skills", "src\libs\skills\skills.csproj", "{3EAFB48F-FBF5-4362-8696-976D7E1EA309}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C787026C-9435-4FD4-AEE5-B005EAEF9E3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C787026C-9435-4FD4-AEE5-B005EAEF9E3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C787026C-9435-4FD4-AEE5-B005EAEF9E3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C787026C-9435-4FD4-AEE5-B005EAEF9E3D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{51F987E4-3E70-4DB9-9493-AFCFA0CE3773}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{51F987E4-3E70-4DB9-9493-AFCFA0CE3773}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{51F987E4-3E70-4DB9-9493-AFCFA0CE3773}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{51F987E4-3E70-4DB9-9493-AFCFA0CE3773}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C0073CEA-8A1B-43BC-BADE-F6323CDFA853}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C0073CEA-8A1B-43BC-BADE-F6323CDFA853}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C0073CEA-8A1B-43BC-BADE-F6323CDFA853}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C0073CEA-8A1B-43BC-BADE-F6323CDFA853}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{94C4BF5F-50BF-41CF-8B94-11F39CA430FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{94C4BF5F-50BF-41CF-8B94-11F39CA430FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{94C4BF5F-50BF-41CF-8B94-11F39CA430FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{94C4BF5F-50BF-41CF-8B94-11F39CA430FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
@@ -43,6 +33,121 @@ Global
|
||||
SolutionGuid = {30612385-E4F4-4FD9-B648-45AF74CB4915}
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{94C4BF5F-50BF-41CF-8B94-11F39CA430FA} = {16A0621E-E1B8-4737-9B3D-08EB9CEF87B0}
|
||||
{4D8667EC-09BE-4CB1-A278-E1CCD83B62B0} = {088E1138-FF7B-4179-AD37-4E3819C56D7E}
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA} = {4D8667EC-09BE-4CB1-A278-E1CCD83B62B0}
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A} = {4D8667EC-09BE-4CB1-A278-E1CCD83B62B0}
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3} = {4D8667EC-09BE-4CB1-A278-E1CCD83B62B0}
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627} = {4D8667EC-09BE-4CB1-A278-E1CCD83B62B0}
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0} = {4D8667EC-09BE-4CB1-A278-E1CCD83B62B0}
|
||||
{24EB6E3A-C080-4B27-8EA7-F6C91446B840} = {088E1138-FF7B-4179-AD37-4E3819C56D7E}
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0} = {24EB6E3A-C080-4B27-8EA7-F6C91446B840}
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A} = {24EB6E3A-C080-4B27-8EA7-F6C91446B840}
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309} = {088E1138-FF7B-4179-AD37-4E3819C56D7E}
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{1FE4A9AE-6403-48D6-8D06-A97CCCE608FA}.Release|x86.Build.0 = Release|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Release|x64.Build.0 = Release|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{37C45587-DD0C-4BFE-817A-21301567A94A}.Release|x86.Build.0 = Release|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CF0F7B0D-3CC4-4068-A1A8-64E3151D01E3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Release|x64.Build.0 = Release|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{110B2C34-0F48-41CE-BC8F-AE3D24E79627}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F288CF45-81EF-4F57-ABAC-D7ABE894E7A0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{1F6EE104-0B3F-49C1-BE3B-B93CAD18BAD0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A064E523-718C-4464-B8AD-BC00BF2E358A}.Release|x86.Build.0 = Release|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Release|x64.Build.0 = Release|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{3EAFB48F-FBF5-4362-8696-976D7E1EA309}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<packageSources>
|
||||
<clear/>
|
||||
|
||||
<!--add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" /-->
|
||||
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="Jint prereleases" value="https://www.myget.org/F/jint/api/v3/index.json" />
|
||||
<add key="Elsa prereleases" value="https://f.feedz.io/elsa-workflows/elsa-3/nuget/index.json" />
|
||||
</packageSources>
|
||||
@@ -7,13 +7,13 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Elsa" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa.EntityFrameworkCore" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa.EntityFrameworkCore.Sqlite" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa.Http" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa.Identity" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa.Workflows.Api" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa.Workflows.Designer" Version="3.0.0-preview.552" /><!--
|
||||
<PackageReference Include="Elsa" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Elsa.EntityFrameworkCore" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Elsa.EntityFrameworkCore.Sqlite" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Elsa.Http" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Elsa.Identity" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Elsa.Workflows.Api" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Elsa.Workflows.Designer" Version="3.0.0-preview.727" /><!--
|
||||
<PackageReference Include="Elsa.EntityFrameworkCore" Version="3.0.0-rc1" />
|
||||
<PackageReference Include="Elsa.EntityFrameworkCore.Sqlite" Version="3.0.0-rc1" />
|
||||
<PackageReference Include="Elsa.Http" Version="3.0.0-rc1" />
|
||||
@@ -23,7 +23,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Elsa.SemanticKernel\Elsa.SemanticKernel.csproj" />
|
||||
<ProjectReference Include="..\..\libs\Elsa.SemanticKernel\Elsa.SemanticKernel.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -128,7 +128,6 @@ class Program
|
||||
public static async Task<T> CallFunction<T>(string skillName, string functionName, string input, int maxRetry)
|
||||
{
|
||||
var kernelSettings = KernelSettings.LoadSettings();
|
||||
var kernelConfig = new KernelConfig();
|
||||
|
||||
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
||||
{
|
||||
@@ -142,21 +141,13 @@ class Program
|
||||
var semanticTextMemory = new SemanticTextMemory(memoryStore, embedingGeneration);
|
||||
|
||||
var kernel = new KernelBuilder()
|
||||
.WithLogger(loggerFactory.CreateLogger<IKernel>())
|
||||
.WithLoggerFactory(loggerFactory)
|
||||
.WithAzureChatCompletionService(kernelSettings.DeploymentOrModelId, kernelSettings.Endpoint, kernelSettings.ApiKey, true, kernelSettings.ServiceId, true)
|
||||
.WithMemory(semanticTextMemory)
|
||||
.WithConfiguration(kernelConfig)
|
||||
.Configure(c => c.SetDefaultHttpRetryConfig(new HttpRetryConfig
|
||||
{
|
||||
MaxRetryCount = maxRetry,
|
||||
UseExponentialBackoff = true,
|
||||
// MinRetryDelay = TimeSpan.FromSeconds(2),
|
||||
// MaxRetryDelay = TimeSpan.FromSeconds(8),
|
||||
MaxTotalRetryTime = TimeSpan.FromSeconds(300),
|
||||
// RetryableStatusCodes = new[] { HttpStatusCode.TooManyRequests, HttpStatusCode.RequestTimeout },
|
||||
// RetryableExceptions = new[] { typeof(HttpRequestException) }
|
||||
}))
|
||||
.Build();
|
||||
|
||||
|
||||
|
||||
//Console.WriteLine($"Calling skill '{skillName}' function '{functionName}' with input '{input}'");
|
||||
var interestingMemories = kernel.Memory.SearchAsync("waf-pages", input, 2);
|
||||
var wafContext = "Consider the following architectural guidelines:";
|
||||
@@ -13,10 +13,10 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.18.230725.3-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.18.230725.3-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Testcontainers" Version="3.2.0" />
|
||||
<ProjectReference Include="..\skills\skills.csproj" />
|
||||
<ProjectReference Include="..\..\libs\skills\skills.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -91,7 +91,6 @@ public static class Program
|
||||
var openAiConfig = provider.GetService<IOptions<OpenAIOptions>>().Value;
|
||||
var qdrantConfig = provider.GetService<IOptions<QdrantOptions>>().Value;
|
||||
|
||||
var kernelConfig = new KernelConfig();
|
||||
|
||||
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
||||
{
|
||||
@@ -106,9 +105,9 @@ public static class Program
|
||||
var semanticTextMemory = new SemanticTextMemory(memoryStore, embedingGeneration);
|
||||
|
||||
return new KernelBuilder()
|
||||
.WithLogger(loggerFactory.CreateLogger<IKernel>())
|
||||
.WithLoggerFactory(loggerFactory)
|
||||
.WithAzureChatCompletionService(openAiConfig.DeploymentOrModelId, openAiConfig.Endpoint, openAiConfig.ApiKey, true, openAiConfig.ServiceId, true)
|
||||
.WithMemory(semanticTextMemory)
|
||||
.WithConfiguration(kernelConfig).Build();
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,8 @@
|
||||
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.19.0" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
|
||||
<PackageReference Include="Octokit.Webhooks.AzureFunctions" Version="2.0.3" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.18.230725.3-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.18.230725.3-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Tables" Version="1.2.0" />
|
||||
<PackageReference Include="Octokit" Version="7.1.0" />
|
||||
@@ -37,7 +37,7 @@
|
||||
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.16.0-beta.1" />
|
||||
<PackageReference Include="Azure.Data.Tables" Version="12.8.1" />
|
||||
<PackageReference Include="Azure.Identity" Version="1.10.0-beta.1" />
|
||||
<ProjectReference Include="..\skills\skills.csproj" />
|
||||
<ProjectReference Include="..\..\libs\skills\skills.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
111
src/apps/gh-flow/Program.cs
Normal file
111
src/apps/gh-flow/Program.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Connectors.AI.OpenAI.TextEmbedding;
|
||||
using Microsoft.SemanticKernel.Connectors.Memory.Qdrant;
|
||||
using Microsoft.SemanticKernel.Memory;
|
||||
using MS.AI.DevTeam;
|
||||
using Octokit.Webhooks;
|
||||
using Octokit.Webhooks.AspNetCore;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddSingleton<WebhookEventProcessor, GithubWebHookProcessor>();
|
||||
builder.Services.AddTransient(CreateKernel);
|
||||
|
||||
builder.Services.AddSingleton(s =>
|
||||
{
|
||||
var ghOptions = s.GetService<IOptions<GithubOptions>>();
|
||||
var ghService = new GithubAuthService(ghOptions);
|
||||
var client = ghService.GetGitHubClient().Result;
|
||||
return client;
|
||||
});
|
||||
builder.Services.AddSingleton<GithubAuthService>();
|
||||
|
||||
builder.Services.AddApplicationInsightsTelemetry();
|
||||
builder.Services.AddOptions<GithubOptions>()
|
||||
.Configure<IConfiguration>((settings, configuration) =>
|
||||
{
|
||||
configuration.GetSection("GithubOptions").Bind(settings);
|
||||
});
|
||||
builder.Services.AddOptions<AzureOptions>()
|
||||
.Configure<IConfiguration>((settings, configuration) =>
|
||||
{
|
||||
configuration.GetSection("AzureOptions").Bind(settings);
|
||||
});
|
||||
builder.Services.AddOptions<OpenAIOptions>()
|
||||
.Configure<IConfiguration>((settings, configuration) =>
|
||||
{
|
||||
configuration.GetSection("OpenAIOptions").Bind(settings);
|
||||
});
|
||||
builder.Services.AddOptions<QdrantOptions>()
|
||||
.Configure<IConfiguration>((settings, configuration) =>
|
||||
{
|
||||
configuration.GetSection("QdrantOptions").Bind(settings);
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton<IManageAzure, AzureService>();
|
||||
builder.Services.AddSingleton<IManageGithub, GithubService>();
|
||||
|
||||
|
||||
builder.Host.UseOrleans(siloBuilder =>
|
||||
{
|
||||
var connectionString = builder.Configuration.GetValue<string>("AzureOptions:CosmosConnectionString");
|
||||
siloBuilder.UseCosmosReminderService( o =>
|
||||
{
|
||||
o.ConfigureCosmosClient(connectionString);
|
||||
o.ContainerName = "devteam";
|
||||
o.DatabaseName = "reminders";
|
||||
o.IsResourceCreationEnabled = true;
|
||||
});
|
||||
siloBuilder.AddCosmosGrainStorage(
|
||||
name: "messages",
|
||||
configureOptions: o =>
|
||||
{
|
||||
o.ConfigureCosmosClient(connectionString);
|
||||
o.ContainerName = "devteam";
|
||||
o.DatabaseName = "persistence";
|
||||
o.IsResourceCreationEnabled = true;
|
||||
});
|
||||
siloBuilder.UseLocalhostClustering();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
builder.Services.Configure<JsonSerializerOptions>(options =>
|
||||
{
|
||||
options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
||||
});
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapGitHubWebhooks();
|
||||
});
|
||||
|
||||
app.Run();
|
||||
|
||||
static IKernel CreateKernel(IServiceProvider provider)
|
||||
{
|
||||
var openAiConfig = provider.GetService<IOptions<OpenAIOptions>>().Value;
|
||||
var qdrantConfig = provider.GetService<IOptions<QdrantOptions>>().Value;
|
||||
|
||||
var loggerFactory = LoggerFactory.Create(builder =>
|
||||
{
|
||||
builder
|
||||
.SetMinimumLevel(LogLevel.Debug)
|
||||
.AddConsole()
|
||||
.AddDebug();
|
||||
});
|
||||
|
||||
var memoryStore = new QdrantMemoryStore(new QdrantVectorDbClient(qdrantConfig.Endpoint, qdrantConfig.VectorSize));
|
||||
var embedingGeneration = new AzureTextEmbeddingGeneration(openAiConfig.EmbeddingDeploymentOrModelId, openAiConfig.Endpoint, openAiConfig.ApiKey);
|
||||
var semanticTextMemory = new SemanticTextMemory(memoryStore, embedingGeneration);
|
||||
|
||||
return new KernelBuilder()
|
||||
.WithLoggerFactory(loggerFactory)
|
||||
.WithAzureChatCompletionService(openAiConfig.DeploymentOrModelId, openAiConfig.Endpoint, openAiConfig.ApiKey, true, openAiConfig.ServiceId, true)
|
||||
.WithMemory(semanticTextMemory).Build();
|
||||
}
|
||||
38
src/apps/gh-flow/Properties/launchSettings.json
Normal file
38
src/apps/gh-flow/Properties/launchSettings.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:59668",
|
||||
"sslPort": 44354
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5244",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7227;http://localhost:5244",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
223
src/apps/gh-flow/Services/GithubWebHookProcessor.cs
Normal file
223
src/apps/gh-flow/Services/GithubWebHookProcessor.cs
Normal file
@@ -0,0 +1,223 @@
|
||||
using MS.AI.DevTeam;
|
||||
using Octokit.Webhooks;
|
||||
using Octokit.Webhooks.Events;
|
||||
using Octokit.Webhooks.Events.IssueComment;
|
||||
using Octokit.Webhooks.Events.Issues;
|
||||
using Octokit.Webhooks.Models;
|
||||
|
||||
public sealed class GithubWebHookProcessor : WebhookEventProcessor
|
||||
{
|
||||
private readonly ILogger<GithubWebHookProcessor> _logger;
|
||||
private readonly IGrainFactory _grains;
|
||||
private readonly IManageGithub _ghService;
|
||||
private readonly IManageAzure _azService;
|
||||
|
||||
public GithubWebHookProcessor(ILogger<GithubWebHookProcessor> logger, IGrainFactory grains, IManageGithub ghService, IManageAzure azService)
|
||||
{
|
||||
_logger = logger;
|
||||
_grains = grains;
|
||||
_ghService = ghService;
|
||||
_azService = azService;
|
||||
}
|
||||
protected override async Task ProcessIssuesWebhookAsync(WebhookHeaders headers, IssuesEvent issuesEvent, IssuesAction action)
|
||||
{
|
||||
var org = issuesEvent.Organization.Login;
|
||||
var repo = issuesEvent.Repository.Name;
|
||||
var issueNumber = issuesEvent.Issue.Number;
|
||||
var input = issuesEvent.Issue.Body;
|
||||
// Assumes the label follows the following convention: Skill.Function example: PM.Readme
|
||||
var labels = issuesEvent.Issue.Labels.First().Name.Split(".");
|
||||
var skillName = labels[0];
|
||||
var functionName = labels[1];
|
||||
var suffix = $"{org}-{repo}";
|
||||
if (issuesEvent.Action == IssuesAction.Opened)
|
||||
{
|
||||
await HandleNewAsk(issueNumber, skillName, functionName, suffix, input, org, repo);
|
||||
}
|
||||
else if (issuesEvent.Action == IssuesAction.Closed && issuesEvent.Issue.User.Type.Value == UserType.Bot)
|
||||
{
|
||||
await HandleClosingIssue(issueNumber, skillName, functionName, suffix, org, repo);
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task ProcessIssueCommentWebhookAsync(
|
||||
WebhookHeaders headers,
|
||||
IssueCommentEvent issueCommentEvent,
|
||||
IssueCommentAction action)
|
||||
{
|
||||
var org = issueCommentEvent.Organization.Login;
|
||||
var repo = issueCommentEvent.Repository.Name;
|
||||
var issueNumber = issueCommentEvent.Issue.Number;
|
||||
var input = issueCommentEvent.Issue.Body;
|
||||
// Assumes the label follows the following convention: Skill.Function example: PM.Readme
|
||||
var labels = issueCommentEvent.Issue.Labels.First().Name.Split(".");
|
||||
var skillName = labels[0];
|
||||
var functionName = labels[1];
|
||||
var suffix = $"{org}-{repo}";
|
||||
// we only resond to non-bot comments
|
||||
if (issueCommentEvent.Sender.Type.Value != UserType.Bot)
|
||||
{
|
||||
await HandleNewAsk(issueNumber, skillName, functionName, suffix, input, org, repo);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task HandleClosingIssue(long issueNumber, string skillName, string functionName, string suffix, string org, string repo)
|
||||
{
|
||||
if (skillName == nameof(PM) && functionName == nameof(PM.Readme))
|
||||
{
|
||||
await HandleClosingReadme(issueNumber, suffix, org, repo);
|
||||
}
|
||||
else if (skillName == nameof(DevLead) && functionName == nameof(DevLead.Plan))
|
||||
{
|
||||
await HandleClosingDevPlan(issueNumber, suffix, org, repo);
|
||||
}
|
||||
else if (skillName == nameof(Dev) && functionName == nameof(Dev.Implement))
|
||||
{
|
||||
await HandleClosingDevImplement(issueNumber, suffix, org, repo);
|
||||
}
|
||||
else { } // something went wrong
|
||||
}
|
||||
|
||||
private async Task HandleClosingDevImplement(long issueNumber, string suffix, string org, string repo)
|
||||
{
|
||||
var dev = _grains.GetGrain<IDevelopCode>(issueNumber, suffix);
|
||||
var code = await dev.GetLastMessage();
|
||||
var lookup = _grains.GetGrain<ILookupMetadata>(suffix);
|
||||
var parentIssue = await lookup.GetMetadata((int)issueNumber);
|
||||
await _azService.Store(new SaveOutputRequest
|
||||
{
|
||||
ParentIssueNumber = parentIssue.IssueNumber,
|
||||
IssueNumber = (int)issueNumber,
|
||||
Output = code,
|
||||
Extension = "sh",
|
||||
Directory = "output",
|
||||
FileName = "run",
|
||||
Org = org,
|
||||
Repo = repo
|
||||
});
|
||||
var sandboxRequest = new SandboxRequest
|
||||
{
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
IssueNumber = (int)issueNumber,
|
||||
ParentIssueNumber = parentIssue.IssueNumber
|
||||
};
|
||||
await _azService.RunInSandbox(sandboxRequest);
|
||||
|
||||
var commitRequest = new CommitRequest
|
||||
{
|
||||
Dir = "output",
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
ParentNumber = parentIssue.IssueNumber,
|
||||
Number = (int)issueNumber,
|
||||
Branch = $"sk-{parentIssue.IssueNumber}"
|
||||
};
|
||||
var markTaskCompleteRequest = new MarkTaskCompleteRequest
|
||||
{
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
CommentId = parentIssue.CommentId
|
||||
};
|
||||
|
||||
var sandbox = _grains.GetGrain<IManageSandbox>(issueNumber, suffix);
|
||||
await sandbox.ScheduleCommitSandboxRun(commitRequest, markTaskCompleteRequest, sandboxRequest);
|
||||
}
|
||||
|
||||
private async Task HandleClosingDevPlan(long issueNumber, string suffix, string org, string repo)
|
||||
{
|
||||
var devLead = _grains.GetGrain<ILeadDevelopment>(issueNumber, suffix);
|
||||
var lookup = _grains.GetGrain<ILookupMetadata>(suffix);
|
||||
var parentIssue = await lookup.GetMetadata((int)issueNumber);
|
||||
var conductor = _grains.GetGrain<IOrchestrateWorkflows>(parentIssue.IssueNumber, suffix);
|
||||
var plan = await devLead.GetLatestPlan();
|
||||
await conductor.ImplementationFlow(plan, org, repo, parentIssue.IssueNumber);
|
||||
|
||||
await _ghService.MarkTaskComplete(new MarkTaskCompleteRequest
|
||||
{
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
CommentId = parentIssue.CommentId
|
||||
});
|
||||
}
|
||||
|
||||
private async Task HandleClosingReadme(long issueNumber, string suffix, string org, string repo)
|
||||
{
|
||||
var pm = _grains.GetGrain<IManageProduct>(issueNumber, suffix);
|
||||
var readme = await pm.GetLastMessage();
|
||||
var lookup = _grains.GetGrain<ILookupMetadata>(suffix);
|
||||
var parentIssue = await lookup.GetMetadata((int)issueNumber);
|
||||
await _azService.Store(new SaveOutputRequest
|
||||
{
|
||||
ParentIssueNumber = parentIssue.IssueNumber,
|
||||
IssueNumber = (int)issueNumber,
|
||||
Output = readme,
|
||||
Extension = "md",
|
||||
Directory = "output",
|
||||
FileName = "readme",
|
||||
Org = org,
|
||||
Repo = repo
|
||||
});
|
||||
await _ghService.CommitToBranch(new CommitRequest
|
||||
{
|
||||
Dir = "output",
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
ParentNumber = parentIssue.IssueNumber,
|
||||
Number = (int)issueNumber,
|
||||
Branch = $"sk-{parentIssue.IssueNumber}"
|
||||
});
|
||||
await _ghService.MarkTaskComplete(new MarkTaskCompleteRequest
|
||||
{
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
CommentId = parentIssue.CommentId
|
||||
});
|
||||
}
|
||||
|
||||
private async Task HandleNewAsk(long issueNumber, string skillName, string functionName, string suffix, string input, string org, string repo)
|
||||
{
|
||||
if (skillName == "Do" && functionName == "It")
|
||||
{
|
||||
var conductor = _grains.GetGrain<IOrchestrateWorkflows>(issueNumber, suffix);
|
||||
await conductor.InitialFlow(input, org, repo, issueNumber);
|
||||
}
|
||||
else if (skillName == nameof(PM) && functionName == nameof(PM.Readme))
|
||||
{
|
||||
var pm = _grains.GetGrain<IManageProduct>(issueNumber, suffix);
|
||||
var readme = await pm.CreateReadme(input);
|
||||
await _ghService.PostComment(new PostCommentRequest
|
||||
{
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
Number = (int)issueNumber,
|
||||
Content = readme
|
||||
});
|
||||
}
|
||||
else if (skillName == nameof(DevLead) && functionName == nameof(DevLead.Plan))
|
||||
{
|
||||
var devLead = _grains.GetGrain<ILeadDevelopment>(issueNumber, suffix);
|
||||
var plan = await devLead.CreatePlan(input);
|
||||
await _ghService.PostComment(new PostCommentRequest
|
||||
{
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
Number = (int)issueNumber,
|
||||
Content = plan
|
||||
});
|
||||
}
|
||||
else if (skillName == nameof(Dev) && functionName == nameof(Dev.Implement))
|
||||
{
|
||||
var dev = _grains.GetGrain<IDevelopCode>(issueNumber, suffix);
|
||||
var code = await dev.GenerateCode(input);
|
||||
await _ghService.PostComment(new PostCommentRequest
|
||||
{
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
Number = (int)issueNumber,
|
||||
Content = code
|
||||
});
|
||||
}
|
||||
else { }// something went wrong
|
||||
}
|
||||
}
|
||||
23
src/apps/gh-flow/gh-flow.csproj
Normal file
23
src/apps/gh-flow/gh-flow.csproj
Normal file
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\libs\MS.AI.DevTeam\MS.AI.DevTeam.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Octokit.Webhooks.AspNetCore" Version="2.0.3" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Microsoft.Orleans.Server" Version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.Orleans.Persistence.Cosmos" Version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
|
||||
<PackageReference Include="Microsoft.Orleans.Reminders.Cosmos" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
@@ -15,7 +15,6 @@ class Program
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
var kernelSettings = KernelSettings.LoadSettings();
|
||||
var kernelConfig = new KernelConfig();
|
||||
|
||||
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
||||
{
|
||||
@@ -30,10 +29,10 @@ class Program
|
||||
var semanticTextMemory = new SemanticTextMemory(memoryStore, embedingGeneration);
|
||||
|
||||
var kernel = new KernelBuilder()
|
||||
.WithLogger(loggerFactory.CreateLogger<IKernel>())
|
||||
.WithLoggerFactory(loggerFactory)
|
||||
.WithAzureChatCompletionService(kernelSettings.DeploymentOrModelId, kernelSettings.Endpoint, kernelSettings.ApiKey, true, kernelSettings.ServiceId, true)
|
||||
.WithMemory(semanticTextMemory)
|
||||
.WithConfiguration(kernelConfig).Build();
|
||||
.Build();
|
||||
await ImportDocumentAsync(kernel, WafFileName);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.18.230725.3-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.18.230725.3-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="PdfPig" Version="0.1.8-alpha-20230529-6daa2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
@@ -210,7 +210,6 @@ public class SemanticKernelActivityProvider : IActivityProvider
|
||||
private IKernel KernelBuilder()
|
||||
{
|
||||
var kernelSettings = KernelSettings.LoadSettings();
|
||||
var kernelConfig = new KernelConfig();
|
||||
|
||||
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
||||
{
|
||||
@@ -218,19 +217,8 @@ public class SemanticKernelActivityProvider : IActivityProvider
|
||||
});
|
||||
|
||||
var kernel = new KernelBuilder()
|
||||
.WithLogger(loggerFactory.CreateLogger<IKernel>())
|
||||
.WithLoggerFactory(loggerFactory)
|
||||
.WithAzureChatCompletionService(kernelSettings.DeploymentOrModelId, kernelSettings.Endpoint, kernelSettings.ApiKey, true, kernelSettings.ServiceId, true)
|
||||
.WithConfiguration(kernelConfig)
|
||||
.Configure(c => c.SetDefaultHttpRetryConfig(new HttpRetryConfig
|
||||
{
|
||||
MaxRetryCount = KernelSettings.DefaultMaxRetries,
|
||||
UseExponentialBackoff = true,
|
||||
// MinRetryDelay = TimeSpan.FromSeconds(2),
|
||||
// MaxRetryDelay = TimeSpan.FromSeconds(8),
|
||||
MaxTotalRetryTime = TimeSpan.FromSeconds(300),
|
||||
// RetryableStatusCodes = new[] { HttpStatusCode.TooManyRequests, HttpStatusCode.RequestTimeout },
|
||||
// RetryableExceptions = new[] { typeof(HttpRequestException) }
|
||||
}))
|
||||
.Build();
|
||||
|
||||
return kernel;
|
||||
@@ -171,7 +171,6 @@ public class SemanticKernelSkill : CodeActivity<string>
|
||||
private IKernel KernelBuilder()
|
||||
{
|
||||
var kernelSettings = KernelSettings.LoadSettings();
|
||||
var kernelConfig = new KernelConfig();
|
||||
|
||||
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
||||
{
|
||||
@@ -185,20 +184,9 @@ public class SemanticKernelSkill : CodeActivity<string>
|
||||
*/
|
||||
|
||||
var kernel = new KernelBuilder()
|
||||
.WithLogger(loggerFactory.CreateLogger<IKernel>())
|
||||
.WithLoggerFactory(loggerFactory)
|
||||
.WithAzureChatCompletionService(kernelSettings.DeploymentOrModelId, kernelSettings.Endpoint, kernelSettings.ApiKey, true, kernelSettings.ServiceId, true)
|
||||
//.WithMemory(semanticTextMemory)
|
||||
.WithConfiguration(kernelConfig)
|
||||
.Configure(c => c.SetDefaultHttpRetryConfig(new HttpRetryConfig
|
||||
{
|
||||
MaxRetryCount = KernelSettings.DefaultMaxRetries,
|
||||
UseExponentialBackoff = true,
|
||||
// MinRetryDelay = TimeSpan.FromSeconds(2),
|
||||
// MaxRetryDelay = TimeSpan.FromSeconds(8),
|
||||
MaxTotalRetryTime = TimeSpan.FromSeconds(300),
|
||||
// RetryableStatusCodes = new[] { HttpStatusCode.TooManyRequests, HttpStatusCode.RequestTimeout },
|
||||
// RetryableExceptions = new[] { typeof(HttpRequestException) }
|
||||
}))
|
||||
.Build();
|
||||
|
||||
return kernel;
|
||||
@@ -9,11 +9,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Elsa" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa.Http" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa.Workflows.Api" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa.Workflows.Core" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa.Workflows.Management" Version="3.0.0-preview.552" />
|
||||
<PackageReference Include="Elsa" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Elsa.Http" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Elsa.Workflows.Api" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Elsa.Workflows.Core" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Elsa.Workflows.Management" Version="3.0.0-preview.727" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
|
||||
@@ -21,8 +21,8 @@
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="AspNetCore.Authentication.ApiKey" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.17.230704.3-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.17.230704.3-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.24.230918.1-preview" />
|
||||
<ProjectReference Include="..\skills\skills.csproj" />
|
||||
|
||||
</ItemGroup>
|
||||
@@ -3,7 +3,7 @@
|
||||
<packageSources>
|
||||
<clear/>
|
||||
|
||||
<!--add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" /-->
|
||||
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="Jint prereleases" value="https://www.myget.org/F/jint/api/v3/index.json" />
|
||||
<add key="Elsa prereleases" value="https://f.feedz.io/elsa-workflows/elsa-3/nuget/index.json" />
|
||||
</packageSources>
|
||||
26
src/libs/MS.AI.DevTeam/Actors/Architect/Architect.cs
Normal file
26
src/libs/MS.AI.DevTeam/Actors/Architect/Architect.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public class Architect : SemanticPersona, IArchitectSolutions
|
||||
{
|
||||
public Architect( [PersistentState("state", "messages")]IPersistentState<ChatHistory> state) : base(state)
|
||||
{
|
||||
|
||||
}
|
||||
public Task<string> GenerateProjectStructure(string ask)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<string> ReviewPlan(string plan)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IArchitectSolutions : IGrainWithIntegerCompoundKey
|
||||
{
|
||||
Task<string> ReviewPlan(string plan);
|
||||
Task<string> GenerateProjectStructure(string ask);
|
||||
}
|
||||
88
src/libs/MS.AI.DevTeam/Actors/Conductor/Conductor.cs
Normal file
88
src/libs/MS.AI.DevTeam/Actors/Conductor/Conductor.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using Orleans.Concurrency;
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public class Conductor : Grain, IOrchestrateWorkflows
|
||||
{
|
||||
private readonly IManageGithub _ghService;
|
||||
public Conductor( IManageGithub ghService)
|
||||
{
|
||||
_ghService = ghService;
|
||||
}
|
||||
public async Task InitialFlow(string input, string org, string repo, long parentNumber)
|
||||
{
|
||||
await _ghService.CreateBranch(new CreateBranchRequest
|
||||
{
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
Branch = $"sk-{parentNumber}"
|
||||
});
|
||||
|
||||
var pmIssue = await _ghService.CreateIssue(new CreateIssueRequest
|
||||
{
|
||||
Label = $"{nameof(PM)}.{nameof(PM.Readme)}",
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
Input = input,
|
||||
ParentNumber = parentNumber
|
||||
});
|
||||
var devLeadIssue = await _ghService.CreateIssue(new CreateIssueRequest
|
||||
{
|
||||
Label = $"{nameof(DevLead)}.{nameof(DevLead.Plan)}",
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
Input = input,
|
||||
ParentNumber = parentNumber
|
||||
});
|
||||
var suffix = $"{org}-{repo}";
|
||||
var pm = GrainFactory.GetGrain<IManageProduct>(pmIssue.IssueNumber, suffix);
|
||||
var devLead = GrainFactory.GetGrain<ILeadDevelopment>(devLeadIssue.IssueNumber, suffix);
|
||||
var lookup = GrainFactory.GetGrain<ILookupMetadata>(suffix);
|
||||
|
||||
var metadataList = new List<StoreMetadataPairs>{
|
||||
new StoreMetadataPairs
|
||||
{
|
||||
Key = pmIssue.IssueNumber,
|
||||
Value = new NewIssueResponse { CommentId = pmIssue.CommentId, IssueNumber = (int)parentNumber}
|
||||
},
|
||||
new StoreMetadataPairs
|
||||
{
|
||||
Key = devLeadIssue.IssueNumber,
|
||||
Value = new NewIssueResponse { CommentId = devLeadIssue.CommentId, IssueNumber = (int)parentNumber}
|
||||
}
|
||||
};
|
||||
await lookup.StoreMetadata(metadataList);
|
||||
|
||||
// await githubActor.CreatePR(); // TODO: this should happen when all tasks are done?
|
||||
}
|
||||
public async Task ImplementationFlow(DevLeadPlanResponse plan, string org, string repo, int parentNumber)
|
||||
{
|
||||
var suffix = $"{org}-{repo}";
|
||||
var prompts = plan.steps.SelectMany(s => s.subtasks.Select(st => st.prompt));
|
||||
var lookup = GrainFactory.GetGrain<ILookupMetadata>(suffix);
|
||||
var metadataList = new List<StoreMetadataPairs>();
|
||||
foreach(var prompt in prompts)
|
||||
{
|
||||
var issue = await _ghService.CreateIssue(new CreateIssueRequest
|
||||
{
|
||||
Label = $"{nameof(Dev)}.{nameof(Dev.Implement)}",
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
Input = prompt,
|
||||
ParentNumber = parentNumber
|
||||
});
|
||||
metadataList.Add(new StoreMetadataPairs
|
||||
{
|
||||
Key = issue.IssueNumber,
|
||||
Value = new NewIssueResponse { CommentId = issue.CommentId, IssueNumber = (int)parentNumber}
|
||||
});
|
||||
}
|
||||
await lookup.StoreMetadata(metadataList);
|
||||
}
|
||||
|
||||
public Task ScheduleCommitSandboxRun(CommitRequest commitRequest, MarkTaskCompleteRequest markTaskCompleteRequest)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Orleans.Concurrency;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public interface IOrchestrateWorkflows : IGrainWithIntegerCompoundKey
|
||||
{
|
||||
[OneWay]
|
||||
Task InitialFlow(string input, string org, string repo, long parentNumber);
|
||||
[OneWay]
|
||||
Task ImplementationFlow(DevLeadPlanResponse plan, string org, string repo, int parentNumber);
|
||||
}
|
||||
47
src/libs/MS.AI.DevTeam/Actors/DevLead/DevLead.cs
Normal file
47
src/libs/MS.AI.DevTeam/Actors/DevLead/DevLead.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public static class DevLead {
|
||||
public static SemanticFunctionConfig Plan = new SemanticFunctionConfig
|
||||
{
|
||||
PromptTemplate = """
|
||||
You are a Dev Lead for an application team, building the application described below.
|
||||
Please break down the steps and modules required to develop the complete application, describe each step in detail.
|
||||
Make prescriptive architecture, language, and frameowrk choices, do not provide a range of choices.
|
||||
For each step or module then break down the steps or subtasks required to complete that step or module.
|
||||
For each subtask write an LLM prompt that would be used to tell a model to write the coee that will accomplish that subtask. If the subtask involves taking action/running commands tell the model to write the script that will run those commands.
|
||||
In each LLM prompt restrict the model from outputting other text that is not in the form of code or code comments.
|
||||
Please output a JSON array data structure, in the precise schema shown below, with a list of steps and a description of each step, and the steps or subtasks that each requires, and the LLM prompts for each subtask.
|
||||
Example:
|
||||
{
|
||||
"steps": [
|
||||
{
|
||||
"step": "1",
|
||||
"description": "This is the first step",
|
||||
"subtasks": [
|
||||
{
|
||||
"subtask": "Subtask 1",
|
||||
"description": "This is the first subtask",
|
||||
"prompt": "Write the code to do the first subtask"
|
||||
},
|
||||
{
|
||||
"subtask": "Subtask 2",
|
||||
"description": "This is the second subtask",
|
||||
"prompt": "Write the code to do the second subtask"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Do not output any other text.
|
||||
Input: {{$input}}
|
||||
""",
|
||||
Name = nameof(Plan),
|
||||
SkillName = nameof(DevLead),
|
||||
Description = "From a simple description of an application output a development plan for building the application.",
|
||||
MaxTokens = 6500,
|
||||
Temperature = 0.0,
|
||||
TopP = 0.0,
|
||||
PPenalty = 0.0,
|
||||
FPenalty = 0.0
|
||||
};
|
||||
}
|
||||
86
src/libs/MS.AI.DevTeam/Actors/DevLead/DeveloperLead.cs
Normal file
86
src/libs/MS.AI.DevTeam/Actors/DevLead/DeveloperLead.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Orchestration;
|
||||
using Orleans.Runtime;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
public class DeveloperLead : SemanticPersona, ILeadDevelopment
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
protected override string MemorySegment => "dev-lead-memory";
|
||||
|
||||
public DeveloperLead(IKernel kernel, [PersistentState("state", "messages")] IPersistentState<ChatHistory> state) : base(state)
|
||||
{
|
||||
_kernel = kernel;
|
||||
}
|
||||
public async Task<string> CreatePlan(string ask)
|
||||
{
|
||||
// var architectId = Guid.NewGuid();
|
||||
// var plan = "this is my plan";
|
||||
// var architect = GrainFactory.GetGrain<IArchitectSolutions>(architectId);
|
||||
// var review = architect.ReviewPlan(plan);
|
||||
// return Task.FromResult(plan);
|
||||
|
||||
var function = _kernel.LoadFunction(nameof(DevLead), nameof(DevLead.Plan));
|
||||
var context = new ContextVariables();
|
||||
context.Set("input", ask);
|
||||
if (_state.State.History == null) _state.State.History = new List<ChatHistoryItem>();
|
||||
_state.State.History.Add(new ChatHistoryItem
|
||||
{
|
||||
Message = ask,
|
||||
Order = _state.State.History.Count + 1,
|
||||
UserType = ChatUserType.User
|
||||
});
|
||||
context.Set("input", ask);
|
||||
|
||||
var result = await _kernel.RunAsync(context, function);
|
||||
var resultMessage = result.ToString();
|
||||
_state.State.History.Add(new ChatHistoryItem
|
||||
{
|
||||
Message = resultMessage,
|
||||
Order = _state.State.History.Count + 1,
|
||||
UserType = ChatUserType.Agent
|
||||
});
|
||||
await _state.WriteStateAsync();
|
||||
|
||||
return resultMessage;
|
||||
}
|
||||
|
||||
public Task<DevLeadPlanResponse> GetLatestPlan()
|
||||
{
|
||||
var plan = _state.State.History.Last().Message;
|
||||
var response = JsonSerializer.Deserialize<DevLeadPlanResponse>(plan);
|
||||
return Task.FromResult(response);
|
||||
}
|
||||
}
|
||||
|
||||
[GenerateSerializer]
|
||||
public class DevLeadPlanResponse
|
||||
{
|
||||
[Id(0)]
|
||||
public List<Step> steps { get; set; }
|
||||
}
|
||||
|
||||
[GenerateSerializer]
|
||||
public class Step
|
||||
{
|
||||
[Id(0)]
|
||||
public string description { get; set; }
|
||||
[Id(1)]
|
||||
public string step { get; set; }
|
||||
[Id(2)]
|
||||
public List<Subtask> subtasks { get; set; }
|
||||
}
|
||||
|
||||
[GenerateSerializer]
|
||||
public class Subtask
|
||||
{
|
||||
[Id(0)]
|
||||
public string subtask { get; set; }
|
||||
[Id(1)]
|
||||
public string prompt { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public interface ILeadDevelopment: IGrainWithIntegerCompoundKey, IChatHistory
|
||||
{
|
||||
Task<string> CreatePlan(string ask);
|
||||
Task<DevLeadPlanResponse> GetLatestPlan();
|
||||
}
|
||||
45
src/libs/MS.AI.DevTeam/Actors/Developer/Dev.cs
Normal file
45
src/libs/MS.AI.DevTeam/Actors/Developer/Dev.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public static class Dev {
|
||||
public static SemanticFunctionConfig Implement = new SemanticFunctionConfig
|
||||
{
|
||||
PromptTemplate = """
|
||||
You are a Developer for an application.
|
||||
Please output the code required to accomplish the task assigned to you below and wrap it in a bash script that creates the files.
|
||||
Do not use any IDE commands and do not build and run the code.
|
||||
Make specific choices about implementation. Do not offer a range of options.
|
||||
Use comments in the code to describe the intent. Do not include other text other than code and code comments.
|
||||
Input: {{$input}}
|
||||
""",
|
||||
Name = nameof(Implement),
|
||||
SkillName = nameof(Developer),
|
||||
Description = "From a description of a coding task out put the code or scripts necessary to complete the task.",
|
||||
MaxTokens = 6500,
|
||||
Temperature = 0.0,
|
||||
TopP = 0.0,
|
||||
PPenalty = 0.0,
|
||||
FPenalty = 0.0
|
||||
};
|
||||
|
||||
public static SemanticFunctionConfig Improve = new SemanticFunctionConfig
|
||||
{
|
||||
PromptTemplate = """
|
||||
You are a Developer for an application. Your job is to imrove the code that you are given in the input below.
|
||||
Please output a new version of code that fixes any problems with this version.
|
||||
If there is an error message in the input you should fix that error in the code.
|
||||
Wrap the code output up in a bash script that creates the necessary files by overwriting any previous files.
|
||||
Do not use any IDE commands and do not build and run the code.
|
||||
Make specific choices about implementation. Do not offer a range of options.
|
||||
Use comments in the code to describe the intent. Do not include other text other than code and code comments.
|
||||
Input: {{$input}}
|
||||
""",
|
||||
Name = nameof(Improve),
|
||||
SkillName = nameof(Developer),
|
||||
Description = "From a description of a coding task out put the code or scripts necessary to complete the task.",
|
||||
MaxTokens = 6500,
|
||||
Temperature = 0.0,
|
||||
TopP = 0.0,
|
||||
PPenalty = 0.0,
|
||||
FPenalty = 0.0
|
||||
};
|
||||
}
|
||||
45
src/libs/MS.AI.DevTeam/Actors/Developer/Developer.cs
Normal file
45
src/libs/MS.AI.DevTeam/Actors/Developer/Developer.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Orchestration;
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public class Developer : SemanticPersona, IDevelopCode
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
protected override string MemorySegment => "dev-memory";
|
||||
|
||||
public Developer(IKernel kernel, [PersistentState("state", "messages")]IPersistentState<ChatHistory> state) : base(state)
|
||||
{
|
||||
_kernel = kernel;
|
||||
}
|
||||
|
||||
public async Task<string> GenerateCode(string ask)
|
||||
{
|
||||
var function = _kernel.LoadFunction(nameof(Dev), nameof(Dev.Implement));
|
||||
var context = new ContextVariables();
|
||||
if (_state.State.History == null) _state.State.History = new List<ChatHistoryItem>();
|
||||
_state.State.History.Add(new ChatHistoryItem{
|
||||
Message = ask,
|
||||
Order = _state.State.History.Count+1,
|
||||
UserType = ChatUserType.User
|
||||
});
|
||||
context.Set("input", ask);
|
||||
|
||||
var result = await _kernel.RunAsync(context, function);
|
||||
var resultMessage = result.ToString();
|
||||
_state.State.History.Add(new ChatHistoryItem{
|
||||
Message = resultMessage,
|
||||
Order = _state.State.History.Count+1,
|
||||
UserType = ChatUserType.Agent
|
||||
});
|
||||
await _state.WriteStateAsync();
|
||||
|
||||
return resultMessage;
|
||||
}
|
||||
|
||||
public Task<string> ReviewPlan(string plan)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
7
src/libs/MS.AI.DevTeam/Actors/Developer/IDevelopCode.cs
Normal file
7
src/libs/MS.AI.DevTeam/Actors/Developer/IDevelopCode.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public interface IDevelopCode : IGrainWithIntegerCompoundKey, IChatHistory
|
||||
{
|
||||
Task<string> GenerateCode(string ask);
|
||||
Task<string> ReviewPlan(string plan);
|
||||
}
|
||||
7
src/libs/MS.AI.DevTeam/Actors/Lookup/ILookupMetadata.cs
Normal file
7
src/libs/MS.AI.DevTeam/Actors/Lookup/ILookupMetadata.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public interface ILookupMetadata : IGrainWithStringKey
|
||||
{
|
||||
Task<NewIssueResponse> GetMetadata(int key);
|
||||
Task StoreMetadata(List<StoreMetadataPairs> pairs);
|
||||
}
|
||||
42
src/libs/MS.AI.DevTeam/Actors/Lookup/Lookup.cs
Normal file
42
src/libs/MS.AI.DevTeam/Actors/Lookup/Lookup.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public class Lookup : Grain, ILookupMetadata
|
||||
{
|
||||
protected readonly IPersistentState<ConductorLookup> _state;
|
||||
public Lookup([PersistentState("state", "messages")] IPersistentState<ConductorLookup> state)
|
||||
{
|
||||
_state = state;
|
||||
}
|
||||
|
||||
public Task<NewIssueResponse> GetMetadata(int key)
|
||||
{
|
||||
return Task.FromResult(_state.State.Metadata[key]);
|
||||
}
|
||||
|
||||
public Task StoreMetadata(List<StoreMetadataPairs> pairs)
|
||||
{
|
||||
if(_state.State.Metadata == null) _state.State.Metadata = new Dictionary<int, NewIssueResponse>();
|
||||
foreach(var pair in pairs)
|
||||
{
|
||||
_state.State.Metadata[pair.Key] = pair.Value;
|
||||
}
|
||||
return _state.WriteStateAsync();
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ConductorLookup
|
||||
{
|
||||
public Dictionary<int, NewIssueResponse> Metadata { get; set; }
|
||||
}
|
||||
|
||||
[GenerateSerializer]
|
||||
public class StoreMetadataPairs
|
||||
{
|
||||
[Id(0)]
|
||||
public int Key { get; set; }
|
||||
[Id(1)]
|
||||
public NewIssueResponse Value { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public interface IManageProduct : IGrainWithIntegerCompoundKey, IChatHistory
|
||||
{
|
||||
Task<string> CreateReadme(string ask);
|
||||
}
|
||||
23
src/libs/MS.AI.DevTeam/Actors/ProductManager/PM.cs
Normal file
23
src/libs/MS.AI.DevTeam/Actors/ProductManager/PM.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public static class PM
|
||||
{
|
||||
public static SemanticFunctionConfig Readme = new SemanticFunctionConfig
|
||||
{
|
||||
PromptTemplate = """
|
||||
You are a program manager on a software development team. You are working on an app described below.
|
||||
Based on the input below, and any dialog or other context, please output a raw README.MD markdown file documenting the main features of the app and the architecture or code organization.
|
||||
Do not describe how to create the application.
|
||||
Write the README as if it were documenting the features and architecture of the application. You may include instructions for how to run the application.
|
||||
Input: {{$input}}
|
||||
""",
|
||||
Name = nameof(Readme),
|
||||
SkillName = nameof(PM),
|
||||
Description = "From a simple description output a README.md file for a GitHub repository.",
|
||||
MaxTokens = 6500,
|
||||
Temperature = 0.0,
|
||||
TopP = 0.0,
|
||||
PPenalty = 0.0,
|
||||
FPenalty = 0.0
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Orchestration;
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
public class ProductManager : SemanticPersona, IManageProduct
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
protected override string MemorySegment => "pm-memory";
|
||||
|
||||
public ProductManager(IKernel kernel,[PersistentState("state", "messages")] IPersistentState<ChatHistory> state) : base(state)
|
||||
{
|
||||
_kernel = kernel;
|
||||
}
|
||||
public async Task<string> CreateReadme(string ask)
|
||||
{
|
||||
var function = _kernel.LoadFunction(nameof(PM), nameof(PM.Readme));
|
||||
var context = new ContextVariables();
|
||||
context.Set("input", ask);
|
||||
if(_state.State.History == null) _state.State.History = new List<ChatHistoryItem>();
|
||||
_state.State.History.Add(new ChatHistoryItem
|
||||
{
|
||||
Message = ask,
|
||||
Order = _state.State.History.Count + 1,
|
||||
UserType = ChatUserType.User
|
||||
});
|
||||
context.Set("input", ask);
|
||||
|
||||
var result = await _kernel.RunAsync(context, function);
|
||||
var resultMessage = result.ToString();
|
||||
_state.State.History.Add(new ChatHistoryItem
|
||||
{
|
||||
Message = resultMessage,
|
||||
Order = _state.State.History.Count + 1,
|
||||
UserType = ChatUserType.Agent
|
||||
});
|
||||
await _state.WriteStateAsync();
|
||||
return resultMessage;
|
||||
}
|
||||
}
|
||||
6
src/libs/MS.AI.DevTeam/Actors/Sandbox/IManageSandbox.cs
Normal file
6
src/libs/MS.AI.DevTeam/Actors/Sandbox/IManageSandbox.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public interface IManageSandbox : IGrainWithIntegerCompoundKey
|
||||
{
|
||||
Task ScheduleCommitSandboxRun(CommitRequest commitRequest, MarkTaskCompleteRequest markTaskCompleteRequest, SandboxRequest sandboxRequest);
|
||||
}
|
||||
77
src/libs/MS.AI.DevTeam/Actors/Sandbox/Sandbox.cs
Normal file
77
src/libs/MS.AI.DevTeam/Actors/Sandbox/Sandbox.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
using Orleans.Runtime;
|
||||
using Orleans.Timers;
|
||||
|
||||
public class Sandbox : Grain, IManageSandbox, IRemindable
|
||||
{
|
||||
private const string ReminderName = "SandboxRunReminder";
|
||||
private readonly IManageGithub _ghService;
|
||||
private readonly IManageAzure _azService;
|
||||
private readonly IReminderRegistry _reminderRegistry;
|
||||
private IGrainReminder? _reminder;
|
||||
|
||||
protected readonly IPersistentState<SandboxMetadata> _state;
|
||||
|
||||
public Sandbox([PersistentState("state", "messages")] IPersistentState<SandboxMetadata> state, IManageGithub ghService,
|
||||
IReminderRegistry reminderRegistry, IManageAzure azService)
|
||||
{
|
||||
_ghService = ghService;
|
||||
_reminderRegistry = reminderRegistry;
|
||||
_azService = azService;
|
||||
_state = state;
|
||||
}
|
||||
public async Task ScheduleCommitSandboxRun(CommitRequest commitRequest, MarkTaskCompleteRequest markTaskCompleteRequest, SandboxRequest sandboxRequest)
|
||||
{
|
||||
await StoreState(commitRequest, markTaskCompleteRequest, sandboxRequest);
|
||||
_reminder = await _reminderRegistry.RegisterOrUpdateReminder(
|
||||
callingGrainId: this.GetGrainId(),
|
||||
reminderName: ReminderName,
|
||||
dueTime: TimeSpan.Zero,
|
||||
period: TimeSpan.FromMinutes(1));
|
||||
}
|
||||
|
||||
async Task IRemindable.ReceiveReminder(string reminderName, TickStatus status)
|
||||
{
|
||||
if (!_state.State.IsCompleted)
|
||||
{
|
||||
var sandboxId = $"sk-sandbox-{_state.State.SandboxRequest.Org}-{_state.State.SandboxRequest.Repo}-{_state.State.SandboxRequest.ParentIssueNumber}-{_state.State.SandboxRequest.IssueNumber}";
|
||||
if (await _azService.IsSandboxCompleted(sandboxId))
|
||||
{
|
||||
await _azService.DeleteSandbox(sandboxId);
|
||||
await _ghService.CommitToBranch(_state.State.CommitRequest);
|
||||
await _ghService.MarkTaskComplete(_state.State.MarkTaskCompleteRequest);
|
||||
await Cleanup();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await Cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task StoreState(CommitRequest commitRequest, MarkTaskCompleteRequest markTaskCompleteRequest, SandboxRequest sandboxRequest)
|
||||
{
|
||||
_state.State.CommitRequest = commitRequest;
|
||||
_state.State.MarkTaskCompleteRequest = markTaskCompleteRequest;
|
||||
_state.State.SandboxRequest = sandboxRequest;
|
||||
_state.State.IsCompleted = false;
|
||||
await _state.WriteStateAsync();
|
||||
}
|
||||
|
||||
private async Task Cleanup()
|
||||
{
|
||||
_state.State.IsCompleted = true;
|
||||
await _reminderRegistry.UnregisterReminder(
|
||||
this.GetGrainId(), _reminder);
|
||||
await _state.WriteStateAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SandboxMetadata
|
||||
{
|
||||
public CommitRequest CommitRequest { get; set; }
|
||||
public MarkTaskCompleteRequest MarkTaskCompleteRequest { get; set; }
|
||||
public SandboxRequest SandboxRequest { get; set; }
|
||||
public bool IsCompleted { get; set; }
|
||||
}
|
||||
45
src/libs/MS.AI.DevTeam/Actors/SemanticPersona.cs
Normal file
45
src/libs/MS.AI.DevTeam/Actors/SemanticPersona.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Orleans.Runtime;
|
||||
|
||||
public abstract class SemanticPersona : Grain, IChatHistory
|
||||
{
|
||||
public SemanticPersona(
|
||||
[PersistentState("state", "messages")] IPersistentState<ChatHistory> state)
|
||||
{
|
||||
_state = state;
|
||||
}
|
||||
protected virtual string MemorySegment { get; set; }
|
||||
protected List<ChatHistoryItem> History { get; set; }
|
||||
protected readonly IPersistentState<ChatHistory> _state;
|
||||
|
||||
public async Task<string> GetLastMessage()
|
||||
{
|
||||
return _state.State.History.Last().Message;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IChatHistory
|
||||
{
|
||||
Task<string> GetLastMessage();
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class ChatHistoryItem
|
||||
{
|
||||
public string Message { get; set; }
|
||||
public ChatUserType UserType { get; set; }
|
||||
public int Order { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ChatHistory
|
||||
{
|
||||
public List<ChatHistoryItem> History { get; set; }
|
||||
}
|
||||
|
||||
public enum ChatUserType
|
||||
{
|
||||
System,
|
||||
User,
|
||||
Agent
|
||||
}
|
||||
25
src/libs/MS.AI.DevTeam/Actors/Tester/Tester.cs
Normal file
25
src/libs/MS.AI.DevTeam/Actors/Tester/Tester.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Orleans.Runtime;
|
||||
|
||||
public class Tester : SemanticPersona, ITestCode
|
||||
{
|
||||
public Tester(
|
||||
[PersistentState("state", "messages")]IPersistentState<ChatHistory> state) : base(state)
|
||||
{
|
||||
|
||||
}
|
||||
public Task<string> ReviewPlan(string plan)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<string> TestCode(string ask)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public interface ITestCode : IGrainWithIntegerCompoundKey
|
||||
{
|
||||
Task<string> TestCode(string ask);
|
||||
Task<string> ReviewPlan(string plan);
|
||||
}
|
||||
38
src/libs/MS.AI.DevTeam/Config/SemanticFunctionConfig.cs
Normal file
38
src/libs/MS.AI.DevTeam/Config/SemanticFunctionConfig.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.SkillDefinition;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public class SemanticFunctionConfig
|
||||
{
|
||||
public string PromptTemplate { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string SkillName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public int MaxTokens { get; set; }
|
||||
public double Temperature { get; set; }
|
||||
public double TopP { get; set; }
|
||||
public double PPenalty { get; set; }
|
||||
public double FPenalty { get; set; }
|
||||
public static SemanticFunctionConfig ForSkillAndFunction(string skillName, string functionName) =>
|
||||
(skillName, functionName) switch
|
||||
{
|
||||
(nameof(PM), nameof(PM.Readme)) => PM.Readme,
|
||||
(nameof(DevLead), nameof(DevLead.Plan)) => DevLead.Plan,
|
||||
// (nameof(CodeExplainer), nameof(CodeExplainer.Explain)) => CodeExplainer.Explain,
|
||||
(nameof(Dev), nameof(Dev.Implement)) => Dev.Implement,
|
||||
// (nameof(Developer), nameof(Developer.Improve)) => Developer.Improve,
|
||||
_ => throw new ArgumentException($"Unable to find {skillName}.{functionName}")
|
||||
};
|
||||
}
|
||||
|
||||
public static class SemanticKernelExtensions
|
||||
{
|
||||
public static ISKFunction LoadFunction(this IKernel kernel, string skill, string function)
|
||||
{
|
||||
var skillConfig = SemanticFunctionConfig.ForSkillAndFunction(skill, function);
|
||||
return kernel.CreateSemanticFunction(skillConfig.PromptTemplate, skillConfig.Name, skillConfig.SkillName,
|
||||
skillConfig.Description, skillConfig.MaxTokens, skillConfig.Temperature,
|
||||
skillConfig.TopP, skillConfig.PPenalty, skillConfig.FPenalty);
|
||||
}
|
||||
}
|
||||
22
src/libs/MS.AI.DevTeam/MS.AI.DevTeam.csproj
Normal file
22
src/libs/MS.AI.DevTeam/MS.AI.DevTeam.csproj
Normal file
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Orleans.Sdk" Version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.Orleans.Runtime" Version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Octokit" Version="7.1.0" />
|
||||
<PackageReference Include="GitHubJwt" Version="0.0.6" />
|
||||
<PackageReference Include="Azure.ResourceManager.ContainerInstance" Version="1.2.0-beta.1" />
|
||||
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.16.0-beta.1" />
|
||||
<PackageReference Include="Azure.Data.Tables" Version="12.8.1" />
|
||||
<PackageReference Include="Azure.Identity" Version="1.10.0-beta.1" />
|
||||
<PackageReference Include="Microsoft.Orleans.Reminders" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
11
src/libs/MS.AI.DevTeam/Options/AzureOptions.cs
Normal file
11
src/libs/MS.AI.DevTeam/Options/AzureOptions.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
public class AzureOptions
|
||||
{
|
||||
public string SubscriptionId { get; set; }
|
||||
public string Location { get; set; }
|
||||
public string ContainerInstancesResourceGroup { get; set; }
|
||||
public string FilesShareName { get; set; }
|
||||
public string FilesAccountName { get; set; }
|
||||
public string FilesAccountKey { get; set; }
|
||||
public string CosmosConnectionString { get; set; }
|
||||
public string SandboxImage { get; set; }
|
||||
}
|
||||
6
src/libs/MS.AI.DevTeam/Options/GithubOptions.cs
Normal file
6
src/libs/MS.AI.DevTeam/Options/GithubOptions.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
public class GithubOptions
|
||||
{
|
||||
public string AppKey { get; set; }
|
||||
public int AppId { get; set; }
|
||||
public long InstallationId { get; set; }
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user