Skip to content

A programming framework for agentic AI

breaking SK upgrade

Kosta Petanb2a5c9a4470d
diff --git a/src/apps/cli/SandboxSkill.cs b/src/apps/cli/SandboxSkill.cs
index a44782a13..918a722e9 100644
--- a/src/apps/cli/SandboxSkill.cs
+++ b/src/apps/cli/SandboxSkill.cs
@@ -1,5 +1,4 @@
using DotNet.Testcontainers.Builders;
-using Microsoft.SemanticKernel.SkillDefinition;
public class SandboxSkill
{
diff --git a/src/apps/gh-flow-df/Services/WebHookEventProcessor.cs b/src/apps/gh-flow-df/Services/WebHookEventProcessor.cs
index 70168f5dd..ab7a43a51 100644
--- a/src/apps/gh-flow-df/Services/WebHookEventProcessor.cs
+++ b/src/apps/gh-flow-df/Services/WebHookEventProcessor.cs
@@ -3,6 +3,7 @@ using System.Text;
using Microsoft.AI.DevTeam.Skills;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
+using Microsoft.SemanticKernel.Connectors.AI.OpenAI;
using Microsoft.SemanticKernel.Orchestration;
using Newtonsoft.Json;
using Octokit.Webhooks;
@@ -96,10 +97,8 @@ public class SKWebHookEventProcessor : WebhookEventProcessor
private async Task<string> RunSkill(string skillName, string functionName, string input)
{
- var skillConfig = SemanticFunctionConfig.ForSkillAndFunction(skillName, functionName);
- var function = _kernel.CreateSemanticFunction(skillConfig.PromptTemplate, skillConfig.Name, skillConfig.SkillName,
- skillConfig.Description, skillConfig.MaxTokens, skillConfig.Temperature,
- skillConfig.TopP, skillConfig.PPenalty, skillConfig.FPenalty);
+ var prompt = ForSkillAndFunction(skillName, functionName);
+ var function = _kernel.CreateSemanticFunction(prompt, new OpenAIRequestSettings { MaxTokens = 100, Temperature = 0.4, TopP = 1 });
var interestingMemories = _kernel.Memory.SearchAsync("waf-pages", input, 2);
var wafContext = "Consider the following architectural guidelines:";
@@ -115,4 +114,15 @@ public class SKWebHookEventProcessor : WebhookEventProcessor
var result = await _kernel.RunAsync(context, function);
return result.ToString();
}
+
+ private static string ForSkillAndFunction(string skillName, string functionName) =>
+ (skillName, functionName) switch
+ {
+ (nameof(PM), nameof(PM.BootstrapProject)) => PM.BootstrapProject,
+ (nameof(PM), nameof(PM.Readme)) => PM.Readme,
+ (nameof(DevLead), nameof(DevLead.Plan)) => DevLead.Plan,
+ (nameof(Developer), nameof(Developer.Implement)) => Developer.Implement,
+ (nameof(Developer), nameof(Developer.Improve)) => Developer.Improve,
+ _ => throw new ArgumentException($"Unable to find {skillName}.{functionName}")
+ };
}
\ No newline at end of file
diff --git a/src/libs/Elsa.SemanticKernel/Activities/ActivityProviders/SemanticKernelSkillActivityProvider.cs b/src/libs/Elsa.SemanticKernel/Activities/ActivityProviders/SemanticKernelSkillActivityProvider.cs
index a6d1ced74..bc5fcc754 100644
--- a/src/libs/Elsa.SemanticKernel/Activities/ActivityProviders/SemanticKernelSkillActivityProvider.cs
+++ b/src/libs/Elsa.SemanticKernel/Activities/ActivityProviders/SemanticKernelSkillActivityProvider.cs
@@ -8,11 +8,9 @@ using Elsa.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
-using Microsoft.AI.DevTeam.Skills;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Orchestration;
-using Microsoft.SemanticKernel.SkillDefinition;
namespace Elsa.SemanticKernel;
@@ -37,17 +35,14 @@ public class SemanticKernelActivityProvider : IActivityProvider
// get a list of skills in the assembly
var skills = LoadSkillsFromAssemblyAsync("skills", kernel);
SKContext context = kernel.CreateNewContext();
- var functionsAvailable = context.Skills.GetFunctionsView();
+ var functionsAvailable = context.Functions.GetFunctionViews();
// create activity descriptors for each skilland function
var activities = new List<ActivityDescriptor>();
- foreach (KeyValuePair<string, List<FunctionView>> skill in functionsAvailable.SemanticFunctions)
+ foreach (var function in functionsAvailable)
{
- Console.WriteLine($"Creating Activities for Skill: {skill.Key}");
- foreach (FunctionView func in skill.Value)
- {
- activities.Add(CreateActivityDescriptorFromSkillAndFunction(func, cancellationToken));
- }
+ Console.WriteLine($"Creating Activities for Plugin: {function.PluginName}");
+ activities.Add(CreateActivityDescriptorFromSkillAndFunction(function, cancellationToken));
}
return activities;
@@ -63,13 +58,13 @@ public class SemanticKernelActivityProvider : IActivityProvider
{
// Create a fully qualified type name for the activity
var thisNamespace = GetType().Namespace;
- var fullTypeName = $"{thisNamespace}.{function.SkillName}.{function.Name}";
+ var fullTypeName = $"{thisNamespace}.{function.PluginName}.{function.Name}";
Console.WriteLine($"Creating Activity: {fullTypeName}");
// create inputs from the function parameters - the SemanticKernelSkill activity will be the base for each activity
var inputs = new List<InputDescriptor>();
foreach (var p in function.Parameters) { inputs.Add(CreateInputDescriptorFromSKParameter(p)); }
- inputs.Add(CreateInputDescriptor(typeof(string), "SkillName", function.SkillName, "The name of the skill to use (generated, do not change)"));
+ inputs.Add(CreateInputDescriptor(typeof(string), "SkillName", function.PluginName, "The name of the skill to use (generated, do not change)"));
inputs.Add(CreateInputDescriptor(typeof(string), "FunctionName", function.Name, "The name of the function to use (generated, do not change)"));
inputs.Add(CreateInputDescriptor(typeof(int), "MaxRetries", KernelSettings.DefaultMaxRetries, "Max Retries to contact AI Service"));
@@ -80,8 +75,8 @@ public class SemanticKernelActivityProvider : IActivityProvider
Description = function.Description,
Name = function.Name,
TypeName = fullTypeName,
- Namespace = $"{thisNamespace}.{function.SkillName}",
- DisplayName = $"{function.SkillName}.{function.Name}",
+ Namespace = $"{thisNamespace}.{function.PluginName}",
+ DisplayName = $"{function.PluginName}.{function.Name}",
Inputs = inputs,
Outputs = new[] {new OutputDescriptor()},
Constructor = context =>
@@ -95,7 +90,7 @@ public class SemanticKernelActivityProvider : IActivityProvider
activityInstance.Type = fullTypeName;
// Configure the activity's URL and method properties.
- activityInstance.SkillName = new Input<string?>(function.SkillName);
+ activityInstance.SkillName = new Input<string?>(function.PluginName);
activityInstance.FunctionName = new Input<string?>(function.Name);
return activityInstance;
diff --git a/src/libs/Elsa.SemanticKernel/Activities/SemanticKernel.cs b/src/libs/Elsa.SemanticKernel/Activities/SemanticKernel.cs
index 4ba5f8cbc..409725377 100644
--- a/src/libs/Elsa.SemanticKernel/Activities/SemanticKernel.cs
+++ b/src/libs/Elsa.SemanticKernel/Activities/SemanticKernel.cs
@@ -6,7 +6,6 @@ using JetBrains.Annotations;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Orchestration;
-using Microsoft.SemanticKernel.SkillDefinition;
using System;
using System.Text;
@@ -15,6 +14,7 @@ using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AI.DevTeam.Skills;
+using Microsoft.SemanticKernel.Connectors.AI.OpenAI;
namespace Elsa.SemanticKernel;
@@ -86,11 +86,9 @@ public class SemanticKernelSkill : CodeActivity<string>
var kernel = KernelBuilder();
// load the skill
- var skillConfig = SemanticFunctionConfig.ForSkillAndFunction(skillName, functionName);
+ var promptTemplate = ForSkillAndFunction(skillName, functionName);
- var function = kernel.CreateSemanticFunction(skillConfig.PromptTemplate, skillConfig.Name, skillConfig.SkillName,
- skillConfig.Description, skillConfig.MaxTokens, skillConfig.Temperature,
- skillConfig.TopP, skillConfig.PPenalty, skillConfig.FPenalty);
+ var function = kernel.CreateSemanticFunction(promptTemplate, new OpenAIRequestSettings { MaxTokens = 100, Temperature = 0.4, TopP = 1 });
// set the context (our prompt)
var contextVars = new ContextVariables();
@@ -106,10 +104,8 @@ public class SemanticKernelSkill : CodeActivity<string>
//context.Set("wafContext", wafContext);
- SKContext answer = await kernel.RunAsync(contextVars, function).ConfigureAwait(false);
- string result = answer.Result;
-
- workflowContext.SetResult(result);
+ var answer = await kernel.RunAsync(contextVars, function);
+ workflowContext.SetResult(answer);
}
}
@@ -121,42 +117,51 @@ public class SemanticKernelSkill : CodeActivity<string>
var theSkills = LoadSkillsFromAssemblyAsync("skills", kernel);
SKContext context = kernel.CreateNewContext();
- var functionsAvailable = context.Skills.GetFunctionsView();
+ var functionsAvailable = context.Functions.GetFunctionViews();
var list = new StringBuilder();
- foreach (KeyValuePair<string, List<FunctionView>> skill in functionsAvailable.SemanticFunctions)
+ foreach (var function in functionsAvailable)
{
- Console.WriteLine($"Skill: {skill.Key}");
- foreach (FunctionView func in skill.Value)
- {
+ Console.WriteLine($"Skill: {function.PluginName}");
+
// Function description
- if (func.Description != null)
+ if (function.Description != null)
{
- list.AppendLine($"// {func.Description}");
+ list.AppendLine($"// {function.Description}");
}
else
{
- Console.WriteLine("{0}.{1} is missing a description", func.SkillName, func.Name);
- list.AppendLine($"// Function {func.SkillName}.{func.Name}.");
+ Console.WriteLine("{0}.{1} is missing a description", function.PluginName, function.Name);
+ list.AppendLine($"// Function {function.PluginName}.{function.Name}.");
}
// Function name
- list.AppendLine($"{func.SkillName}.{func.Name}");
+ list.AppendLine($"{function.PluginName}.{function.Name}");
// Function parameters
- foreach (var p in func.Parameters)
+ foreach (var p in function.Parameters)
{
var description = string.IsNullOrEmpty(p.Description) ? p.Name : p.Description;
var defaultValueString = string.IsNullOrEmpty(p.DefaultValue) ? string.Empty : $" (default value: {p.DefaultValue})";
list.AppendLine($"Parameter \"{p.Name}\": {description} {defaultValueString}");
}
- }
}
Console.WriteLine($"List of all skills ----- {list.ToString()}");
return list.ToString();
}
+ private static string ForSkillAndFunction(string skillName, string functionName) =>
+ (skillName, functionName) switch
+ {
+ (nameof(PM), nameof(PM.BootstrapProject)) => PM.BootstrapProject,
+ (nameof(PM), nameof(PM.Readme)) => PM.Readme,
+ (nameof(DevLead), nameof(DevLead.Plan)) => DevLead.Plan,
+ (nameof(Developer), nameof(Developer.Implement)) => Developer.Implement,
+ (nameof(Developer), nameof(Developer.Improve)) => Developer.Improve,
+ _ => throw new ArgumentException($"Unable to find {skillName}.{functionName}")
+ };
+
/// <summary>
/// Gets a semantic kernel instance
/// </summary>
@@ -204,17 +209,9 @@ public class SemanticKernelSkill : CodeActivity<string>
string field = function.FieldType.ToString();
if (field.Equals("Microsoft.SKDevTeam.SemanticFunctionConfig"))
{
- var skillConfig = SemanticFunctionConfig.ForSkillAndFunction(skillType.Name, function.Name);
+ var prompt = ForSkillAndFunction(skillType.Name, function.Name);
var skfunc = kernel.CreateSemanticFunction(
- skillConfig.PromptTemplate,
- skillConfig.Name,
- skillConfig.SkillName,
- skillConfig.Description,
- skillConfig.MaxTokens,
- skillConfig.Temperature,
- skillConfig.TopP,
- skillConfig.PPenalty,
- skillConfig.FPenalty);
+ prompt, new OpenAIRequestSettings { MaxTokens = 100, Temperature = 0.4, TopP = 1 });
Console.WriteLine($"SK Added function: {skfunc.SkillName}.{skfunc.Name}");
}
diff --git a/src/libs/Microsoft.AI.DevTeam.Skills/Chat.cs b/src/libs/Microsoft.AI.DevTeam.Skills/Chat.cs
deleted file mode 100644
index 2f192a723..000000000
--- a/src/libs/Microsoft.AI.DevTeam.Skills/Chat.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace Microsoft.AI.DevTeam.Skills;
-public static class Chat
-{
- public static SemanticFunctionConfig ChatCompletion = new SemanticFunctionConfig
- {
- PromptTemplate = """
- You are a helpful assistant. Please complete the prompt as instructed in the Input.
- Provide as many references and links as needed to support the accuracy of your answer.
- Input: {{$input}}
- """,
- Name = nameof(ChatCompletion),
- SkillName = nameof(Chat),
- Description = "Use the Model as a Chatbot.",
- MaxTokens = 6500,
- Temperature = 0.0,
- TopP = 0.0,
- PPenalty = 0.0,
- FPenalty = 0.0
- };
-
-}
diff --git a/src/libs/Microsoft.AI.DevTeam.Skills/CodeExplainer.cs b/src/libs/Microsoft.AI.DevTeam.Skills/CodeExplainer.cs
deleted file mode 100644
index ffba6a71e..000000000
--- a/src/libs/Microsoft.AI.DevTeam.Skills/CodeExplainer.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-
-namespace Microsoft.AI.DevTeam.Skills;
-public static class CodeExplainer {
- public static SemanticFunctionConfig Explain = new SemanticFunctionConfig
- {
- PromptTemplate = """
- You are a Software Developer.
- Please explain the code that is in the input below. You can include references or documentation links in your explanation.
- Also where appropriate please output a list of keywords to describe the code or its capabilities.
- example:
- Keywords: Azure, networking, security, authentication
-
- If the code's purpose is not clear output an error:
- Error: The model could not determine the purpose of the code.
-
- --
- Input: {{$input}}
- """,
- Name = nameof(Explain),
- SkillName = nameof(CodeExplainer),
- 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
- };
-
-}
diff --git a/src/libs/Microsoft.AI.DevTeam.Skills/DevLead.cs b/src/libs/Microsoft.AI.DevTeam.Skills/DevLead.cs
index 5c26d70d6..a1c677bc1 100644
--- a/src/libs/Microsoft.AI.DevTeam.Skills/DevLead.cs
+++ b/src/libs/Microsoft.AI.DevTeam.Skills/DevLead.cs
@@ -1,8 +1,6 @@
namespace Microsoft.AI.DevTeam.Skills;
public static class DevLead {
- public static SemanticFunctionConfig Plan = new SemanticFunctionConfig
- {
- PromptTemplate = """
+ public static string Plan = """
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.
@@ -34,20 +32,9 @@ public static class DevLead {
Do not output any other text.
Input: {{$input}}
{{$wafContext}}
- """,
- 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
- };
+ """;
- public static SemanticFunctionConfig Explain = new SemanticFunctionConfig
- {
- PromptTemplate = """
+ public static string Explain = """
You are a Dev Lead.
Please explain the code that is in the input below. You can include references or documentation links in your explanation.
Also where appropriate please output a list of keywords to describe the code or its capabilities.
@@ -59,14 +46,5 @@ public static class DevLead {
--
Input: {{$input}}
- """,
- Name = nameof(Explain),
- SkillName = nameof(CodeExplainer),
- 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
- };
+ """;
}
diff --git a/src/libs/Microsoft.AI.DevTeam.Skills/Developer.cs b/src/libs/Microsoft.AI.DevTeam.Skills/Developer.cs
index a6e51484c..54cfb0dc8 100644
--- a/src/libs/Microsoft.AI.DevTeam.Skills/Developer.cs
+++ b/src/libs/Microsoft.AI.DevTeam.Skills/Developer.cs
@@ -1,9 +1,7 @@
namespace Microsoft.AI.DevTeam.Skills;
public static class Developer {
- public static SemanticFunctionConfig Implement = new SemanticFunctionConfig
- {
- PromptTemplate = """
+ public static string Implement = """
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.
@@ -11,20 +9,9 @@ public static class Developer {
Use comments in the code to describe the intent. Do not include other text other than code and code comments.
Input: {{$input}}
{{$wafContext}}
- """,
- 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 = """
+ public static string Improve = """
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.
@@ -34,20 +21,9 @@ public static class Developer {
Use comments in the code to describe the intent. Do not include other text other than code and code comments.
Input: {{$input}}
{{$wafContext}}
- """,
- 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
- };
+ """;
- public static SemanticFunctionConfig Explain = new SemanticFunctionConfig
- {
- PromptTemplate = """
+ public static string Explain = """
You are an experienced software developer, with strong experience in Azure and Microsoft technologies.
Extract the key features and capabilities of the code file below, with the intent to build an understanding of an entire code repository.
You can include references or documentation links in your explanation. Also where appropriate please output a list of keywords to describe the code or its capabilities.
@@ -61,20 +37,9 @@ public static class Developer {
Be short and concise.
If the code's purpose is not clear output an error:
Error: The model could not determine the purpose of the code.
- """,
- Name = nameof(Explain),
- SkillName = nameof(CodeExplainer),
- Description = "From a source file produce an explanation of what the code does",
- MaxTokens = 6500,
- Temperature = 0.0,
- TopP = 0.0,
- PPenalty = 0.0,
- FPenalty = 0.0
- };
+ """;
- public static SemanticFunctionConfig ConsolidateUnderstanding = new SemanticFunctionConfig
- {
- PromptTemplate = """
+ public static string ConsolidateUnderstanding = """
You are an experienced software developer, with strong experience in Azure and Microsoft technologies.
You are trying to build an understanding of the codebase from code files. This is the current understanding of the project:
===current-understanding===
@@ -87,16 +52,5 @@ public static class Developer {
Your job is to update your current understanding with the new information.
Only include the points in a bullet point format and DON'T add anything outside of the bulleted list.
Be short and concise.
- """,
- Name = nameof(Explain),
- SkillName = nameof(CodeExplainer),
- Description = "From a source file produce an explanation of what the code does",
- MaxTokens = 6500,
- Temperature = 0.0,
- TopP = 0.0,
- PPenalty = 0.0,
- FPenalty = 0.0
- };
-}
-
-
+ """;
+}
\ No newline at end of file
diff --git a/src/libs/Microsoft.AI.DevTeam.Skills/PM.cs b/src/libs/Microsoft.AI.DevTeam.Skills/PM.cs
index 998157a48..0ec71b782 100644
--- a/src/libs/Microsoft.AI.DevTeam.Skills/PM.cs
+++ b/src/libs/Microsoft.AI.DevTeam.Skills/PM.cs
@@ -1,48 +1,24 @@
namespace Microsoft.AI.DevTeam.Skills;
public static class PM
{
- public static SemanticFunctionConfig BootstrapProject = new SemanticFunctionConfig
- {
- PromptTemplate = """
+public static string BootstrapProject = """
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}}
{{$wafContext}}
- """,
- Name = nameof(BootstrapProject),
- SkillName = nameof(PM),
- Description = "Bootstrap a new project",
- MaxTokens = 6500,
- Temperature = 0.0,
- TopP = 0.0,
- PPenalty = 0.0,
- FPenalty = 0.0
- };
- public static SemanticFunctionConfig Readme = new SemanticFunctionConfig
- {
- PromptTemplate = """
+ """;
+ public static string Readme = """
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}}
{{$wafContext}}
- """,
- 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
- };
+ """;
- public static SemanticFunctionConfig Explain = new SemanticFunctionConfig
- {
- PromptTemplate = """
+ public static string Explain = """
You are a Product Manager.
Please explain the code that is in the input below. You can include references or documentation links in your explanation.
Also where appropriate please output a list of keywords to describe the code or its capabilities.
@@ -54,14 +30,5 @@ public static class PM
--
Input: {{$input}}
- """,
- Name = nameof(Explain),
- SkillName = nameof(CodeExplainer),
- 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
- };
+ """;
}
diff --git a/src/libs/Microsoft.AI.DevTeam.Skills/SemanticFunctionConfig.cs b/src/libs/Microsoft.AI.DevTeam.Skills/SemanticFunctionConfig.cs
deleted file mode 100644
index 17a7ec8c3..000000000
--- a/src/libs/Microsoft.AI.DevTeam.Skills/SemanticFunctionConfig.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using Microsoft.SemanticKernel;
-using Microsoft.SemanticKernel.SkillDefinition;
-
-namespace Microsoft.AI.DevTeam.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; }
- public static SemanticFunctionConfig ForSkillAndFunction(string skillName, string functionName) =>
- (skillName, functionName) switch
- {
- (nameof(Chat), nameof(Chat.ChatCompletion)) => Chat.ChatCompletion,
- (nameof(PM), nameof(PM.BootstrapProject)) => PM.BootstrapProject,
- (nameof(PM), nameof(PM.Readme)) => PM.Readme,
- (nameof(DevLead), nameof(DevLead.Plan)) => DevLead.Plan,
- (nameof(CodeExplainer), nameof(CodeExplainer.Explain)) => CodeExplainer.Explain,
- (nameof(Developer), nameof(Developer.Implement)) => Developer.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);
- }
-}
\ No newline at end of file
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/Architect/Architect.cs b/src/libs/Microsoft.AI.DevTeam/Actors/Architect/Architect.cs
index 9b91239cf..24a421e90 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/Architect/Architect.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/Architect/Architect.cs
@@ -4,7 +4,7 @@ namespace Microsoft.AI.DevTeam;
public class Architect : SemanticPersona, IArchitectSolutions
{
- public Architect( [PersistentState("state", "messages")]IPersistentState<ChatHistory> state) : base(state)
+ public Architect( [PersistentState("state", "messages")]IPersistentState<SemanticPersonaState> state) : base(state)
{
}
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/DeveloperLead.cs b/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/DeveloperLead.cs
index 40b5d7230..c77885e05 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/DeveloperLead.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/DeveloperLead.cs
@@ -1,5 +1,6 @@
using Microsoft.AI.DevTeam.Skills;
using Microsoft.SemanticKernel;
+using Microsoft.SemanticKernel.Connectors.AI.OpenAI;
using Microsoft.SemanticKernel.Orchestration;
using Orleans.Runtime;
using System.Text.Json;
@@ -22,7 +23,7 @@ public class DeveloperLead : SemanticPersona, ILeadDevelopment
// var review = architect.ReviewPlan(plan);
// return Task.FromResult(plan);
- var function = _kernel.LoadFunction(nameof(DevLead), nameof(DevLead.Plan));
+ var function = _kernel.CreateSemanticFunction(DevLead.Plan, new OpenAIRequestSettings { MaxTokens = 100, Temperature = 0.4, TopP = 1 });
var context = new ContextVariables();
context.Set("input", ask);
if (_state.State.History == null) _state.State.History = new List<ChatHistoryItem>();
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/Developer/Developer.cs b/src/libs/Microsoft.AI.DevTeam/Actors/Developer/Developer.cs
index 8fc26f338..83a488685 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/Developer/Developer.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/Developer/Developer.cs
@@ -1,5 +1,6 @@
using Microsoft.AI.DevTeam.Skills;
using Microsoft.SemanticKernel;
+using Microsoft.SemanticKernel.Connectors.AI.OpenAI;
using Microsoft.SemanticKernel.Orchestration;
using Orleans.Runtime;
@@ -17,7 +18,7 @@ public class Dev : SemanticPersona, IDevelopCode
public async Task<string> GenerateCode(string ask)
{
- var function = _kernel.LoadFunction(nameof(Developer), nameof(Developer.Implement));
+ var function = _kernel.CreateSemanticFunction(Developer.Implement, new OpenAIRequestSettings { MaxTokens = 100, Temperature = 0.4, TopP = 1 });
var context = new ContextVariables();
if (_state.State.History == null) _state.State.History = new List<ChatHistoryItem>();
_state.State.History.Add(new ChatHistoryItem
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/ProductManager/IManageProduct.cs b/src/libs/Microsoft.AI.DevTeam/Actors/ProductManager/IManageProduct.cs
index 71b7ce6a9..e9ca51f83 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/ProductManager/IManageProduct.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/ProductManager/IManageProduct.cs
@@ -1,6 +1,6 @@
namespace Microsoft.AI.DevTeam;
-public interface IManageProduct : IGrainWithIntegerCompoundKey, IChatHistory, IUnderstand
+public interface IManageProduct : IGrainWithIntegerCompoundKey, IChatHistory
{
Task<string> CreateReadme(string ask);
}
\ No newline at end of file
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/ProductManager/ProductManager.cs b/src/libs/Microsoft.AI.DevTeam/Actors/ProductManager/ProductManager.cs
index a217aed05..970fbc650 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/ProductManager/ProductManager.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/ProductManager/ProductManager.cs
@@ -1,5 +1,6 @@
using Microsoft.AI.DevTeam.Skills;
using Microsoft.SemanticKernel;
+using Microsoft.SemanticKernel.Connectors.AI.OpenAI;
using Microsoft.SemanticKernel.Orchestration;
using Orleans.Runtime;
@@ -15,7 +16,7 @@ public class ProductManager : SemanticPersona, IManageProduct
}
public async Task<string> CreateReadme(string ask)
{
- var function = _kernel.LoadFunction(nameof(PM), nameof(PM.Readme));
+ var function = _kernel.CreateSemanticFunction(PM.Readme, new OpenAIRequestSettings { MaxTokens = 100, Temperature = 0.4, TopP = 1 });
var context = new ContextVariables();
context.Set("input", ask);
if(_state.State.History == null) _state.State.History = new List<ChatHistoryItem>();
@@ -39,9 +40,4 @@ public class ProductManager : SemanticPersona, IManageProduct
await _state.WriteStateAsync();
return resultMessage;
}
-
- public Task<string> BuildUnderstanding(string content)
- {
- throw new NotImplementedException();
- }
}
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/Tester/Tester.cs b/src/libs/Microsoft.AI.DevTeam/Actors/Tester/Tester.cs
index e44abac9b..cb9fcad2a 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/Tester/Tester.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/Tester/Tester.cs
@@ -5,7 +5,7 @@ namespace Microsoft.AI.DevTeam;
public class Tester : SemanticPersona, ITestCode
{
public Tester(
- [PersistentState("state", "messages")]IPersistentState<ChatHistory> state) : base(state)
+ [PersistentState("state", "messages")]IPersistentState<SemanticPersonaState> state) : base(state)
{
}