A programming framework for agentic AI
extract skills to a classlib WIP
Kosta Petan943222bcbf2d
diff --git a/cli/cli.csproj b/cli/cli.csprojindex a36d72b07..bcfba27de 100644--- a/cli/cli.csproj+++ b/cli/cli.csproj@@ -12,6 +12,7 @@<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /><PackageReference Include="Microsoft.SemanticKernel" Version="0.14.547.1-preview" /><PackageReference Include="Testcontainers" Version="3.2.0" />+ <ProjectReference Include="..\skills\skills.csproj" /></ItemGroup></Project>diff --git a/sk-azfunc-server/.vscode/tasks.json b/sk-azfunc-server/.vscode/tasks.jsonindex 151a54f79..4e655aa3d 100644--- a/sk-azfunc-server/.vscode/tasks.json+++ b/sk-azfunc-server/.vscode/tasks.json@@ -59,7 +59,7 @@"type": "func","dependsOn": "build (functions)","options": {- "cwd": "${workspaceFolder}/bin/Debug/net6.0"+ "cwd": "${workspaceFolder}/bin/Debug/net7.0"},"command": "host start","isBackground": true,diff --git a/sk-azfunc-server/ExecuteFunctionEndpoint.cs b/sk-azfunc-server/ExecuteFunctionEndpoint.csindex a88f378dc..a7edd4b48 100644--- a/sk-azfunc-server/ExecuteFunctionEndpoint.cs+++ b/sk-azfunc-server/ExecuteFunctionEndpoint.cs@@ -45,7 +45,16 @@ public class ExecuteFunctionEndpointreturn await CreateResponseAsync(requestData, HttpStatusCode.NotFound, new ErrorResponse() { Message = $"Unable to find {skillName}" }).ConfigureAwait(false);}++ //var pmReadme = _kernel.CreateSemanticFunction(skills.PM.Readme.PromptTemplate,);++var skill = this._kernel.ImportSemanticSkillFromDirectory(skillsDirectory, skillName);+++++if (!skill.ContainsKey(functionName)){return await CreateResponseAsync(requestData, HttpStatusCode.NotFound, new ErrorResponse() { Message = $"Unable to find {skillName}.{functionName}" }).ConfigureAwait(false);diff --git a/sk-azfunc-server/sk-csharp-azure-functions.csproj b/sk-azfunc-server/sk-csharp-azure-functions.csprojindex 1407af1b8..a649fdfc5 100644--- a/sk-azfunc-server/sk-csharp-azure-functions.csproj+++ b/sk-azfunc-server/sk-csharp-azure-functions.csproj@@ -6,11 +6,11 @@</PropertyGroup><PropertyGroup>- <TargetFramework>net6.0</TargetFramework>+ <TargetFramework>net7.0</TargetFramework><RootNamespace></RootNamespace><AzureFunctionsVersion>v4</AzureFunctionsVersion><OutputType>Exe</OutputType>- <LangVersion>10</LangVersion>+ <LangVersion>latest</LangVersion><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings><IsPackable>false</IsPackable>@@ -24,8 +24,10 @@<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenApi" Version="2.0.0-preview2" /><PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi" Version="2.0.0-preview2" TreatAsUsed="true" /><PackageReference Include="Microsoft.SemanticKernel" Version="0.14.547.1-preview" />+ <ProjectReference Include="..\skills\skills.csproj" /></ItemGroup>+<ItemGroup><None Update="host.json"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>@@ -37,9 +39,6 @@<None Update="config\appsettings.json"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></None>- <None Update="skills\**">- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>- </None></ItemGroup></Project>diff --git a/sk-azfunc-server/skills/DevLead/Plan/config.json b/sk-azfunc-server/skills/DevLead/Plan/config.jsondeleted file mode 100644index 6609514e8..000000000--- a/sk-azfunc-server/skills/DevLead/Plan/config.json+++ /dev/null@@ -1,12 +0,0 @@-{- "schema": 1,- "description": "From a simple description of an application output a development plan for building the application.",- "type": "completion",- "completion": {- "max_tokens": 4096,- "temperature": 0.0,- "top_p": 0.0,- "presence_penalty": 0.0,- "frequency_penalty": 0.0- }-}\ No newline at end of filediff --git a/sk-azfunc-server/skills/DevLead/Plan/skprompt.txt b/sk-azfunc-server/skills/DevLead/Plan/skprompt.txtdeleted file mode 100644index 5de2bbb9b..000000000--- a/sk-azfunc-server/skills/DevLead/Plan/skprompt.txt+++ /dev/null@@ -1,9 +0,0 @@-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 data structure 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.-Do not output any other text.-Input: {{$input}}\ No newline at end of filediff --git a/sk-azfunc-server/skills/Developer/Implement/config.json b/sk-azfunc-server/skills/Developer/Implement/config.jsondeleted file mode 100644index f55603460..000000000--- a/sk-azfunc-server/skills/Developer/Implement/config.json+++ /dev/null@@ -1,12 +0,0 @@-{- "schema": 1,- "description": "From a description of a coding task out put the code or scripts necessary to complete the task.",- "type": "completion",- "completion": {- "max_tokens": 4096,- "temperature": 0.0,- "top_p": 0.0,- "presence_penalty": 0.0,- "frequency_penalty": 0.0- }-}\ No newline at end of filediff --git a/sk-azfunc-server/skills/Developer/Implement/skprompt.txt b/sk-azfunc-server/skills/Developer/Implement/skprompt.txtdeleted file mode 100644index c396228a8..000000000--- a/sk-azfunc-server/skills/Developer/Implement/skprompt.txt+++ /dev/null@@ -1,6 +0,0 @@-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}}\ No newline at end of filediff --git a/sk-azfunc-server/skills/PM/BootstrapProject/config.json b/sk-azfunc-server/skills/PM/BootstrapProject/config.jsondeleted file mode 100644index 54819924a..000000000--- a/sk-azfunc-server/skills/PM/BootstrapProject/config.json+++ /dev/null@@ -1,12 +0,0 @@-{- "schema": 1,- "description": "Output a script that will help bootstrap a new code project in .NET",- "type": "completion",- "completion": {- "max_tokens": 7000,- "temperature": 0.0,- "top_p": 0.0,- "presence_penalty": 0.0,- "frequency_penalty": 0.0- }-}\ No newline at end of filediff --git a/sk-azfunc-server/skills/PM/BootstrapProject/skprompt.txt b/sk-azfunc-server/skills/PM/BootstrapProject/skprompt.txtdeleted file mode 100644index de1547e5d..000000000--- a/sk-azfunc-server/skills/PM/BootstrapProject/skprompt.txt+++ /dev/null@@ -1,5 +0,0 @@-Please write a bash script with the commands that would be required to generate applications as described in the following input.-You may add comments to the script and the generated output but do not add any other text except the bash script.-You may include commands to build the applications but do not run them.-Do not include any git commands.-Input: {{$input}}\ No newline at end of filediff --git a/sk-azfunc-server/skills/PM/Readme/config.json b/sk-azfunc-server/skills/PM/Readme/config.jsondeleted file mode 100644index 37c37a035..000000000--- a/sk-azfunc-server/skills/PM/Readme/config.json+++ /dev/null@@ -1,12 +0,0 @@-{- "schema": 1,- "description": "From a simple description output a README.md file for a GitHub repository.",- "type": "completion",- "completion": {- "max_tokens": 7600,- "temperature": 0.0,- "top_p": 0.0,- "presence_penalty": 0.0,- "frequency_penalty": 0.0- }-}\ No newline at end of filediff --git a/sk-azfunc-server/skills/PM/Readme/skprompt.txt b/sk-azfunc-server/skills/PM/Readme/skprompt.txtdeleted file mode 100644index aad14347d..000000000--- a/sk-azfunc-server/skills/PM/Readme/skprompt.txt+++ /dev/null@@ -1,5 +0,0 @@-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}}\ No newline at end of filediff --git a/skills/DevLead.cs b/skills/DevLead.csnew file mode 100644index 000000000..2f84dc613--- /dev/null+++ b/skills/DevLead.cs@@ -0,0 +1,25 @@+namespace skills;+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 data structure 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.+ 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 = 4096,+ Temperature = 0.0,+ TopP = 0.0,+ PPenalty = 0.0,+ FPenalty = 0.0+ };+}diff --git a/skills/Developer.cs b/skills/Developer.csnew file mode 100644index 000000000..fd63cc29b--- /dev/null+++ b/skills/Developer.cs@@ -0,0 +1,23 @@++namespace skills;+public static class Developer {+ 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 = 4096,+ Temperature = 0.0,+ TopP = 0.0,+ PPenalty = 0.0,+ FPenalty = 0.0+ };+}diff --git a/skills/PM.cs b/skills/PM.csnew file mode 100644index 000000000..766e4b8e4--- /dev/null+++ b/skills/PM.cs@@ -0,0 +1,40 @@+namespace skills;+public static class PM+{+ public static SemanticFunctionConfig BootstrapProject = new SemanticFunctionConfig+ {+ PromptTemplate = """+ Please write a bash script with the commands that would be required to generate applications as described in the following input.+ You may add comments to the script and the generated output but do not add any other text except the bash script.+ You may include commands to build the applications but do not run them.+ Do not include any git commands.+ Input: {{$input}}+ """,+ Name = nameof(BootstrapProject),+ SkillName = nameof(PM),+ Description = "Bootstrap a new project",+ MaxTokens = 7000,+ Temperature = 0.0,+ TopP = 0.0,+ PPenalty = 0.0,+ FPenalty = 0.0+ };+ 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 = 7600,+ Temperature = 0.0,+ TopP = 0.0,+ PPenalty = 0.0,+ FPenalty = 0.0+ };+}diff --git a/skills/SemanticFunctionConfig.cs b/skills/SemanticFunctionConfig.csnew file mode 100644index 000000000..f472dfc6e--- /dev/null+++ b/skills/SemanticFunctionConfig.cs@@ -0,0 +1,13 @@+namespace skills;+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; }+}\ No newline at end of filediff --git a/skills/skills.csproj b/skills/skills.csprojnew file mode 100644index 000000000..fd4d5df51--- /dev/null+++ b/skills/skills.csproj@@ -0,0 +1,9 @@+<Project Sdk="Microsoft.NET.Sdk">++ <PropertyGroup>+ <TargetFramework>net7.0</TargetFramework>+ <ImplicitUsings>enable</ImplicitUsings>+ <Nullable>enable</Nullable>+ <RootNamespace>skills</RootNamespace>+ </PropertyGroup>+</Project>