Merge pull request #8 from microsoft/tuning-skills

Feed README into Dev Lead when chaining
This commit is contained in:
Ryan Sweet
2023-06-16 19:39:06 -07:00
committed by GitHub
4 changed files with 40 additions and 5 deletions

View File

@@ -6,6 +6,7 @@ using Microsoft.SemanticKernel.Connectors.AI.OpenAI.TextEmbedding;
using Microsoft.SemanticKernel.Connectors.Memory.Qdrant;
using Microsoft.SemanticKernel.Memory;
using Microsoft.SemanticKernel.Orchestration;
using Microsoft.SemanticKernel.Reliability;
using skills;
class Program
@@ -91,22 +92,24 @@ class Program
var outputPath = Directory.CreateDirectory("output");
var readme = await CallWithFile<string>(nameof(PM), PM.Readme , file, kernel);
await SaveToFile(Path.Combine(outputPath.FullName, "README.md"), readme);
string readmeFile = Path.Combine(outputPath.FullName, "README.md");
await SaveToFile(readmeFile, readme);
var script = await CallWithFile<string>(nameof(PM), PM.BootstrapProject, file, kernel);
await sandboxSkill.RunInDotnetAlpineAsync(script);
await SaveToFile(Path.Combine(outputPath.FullName, "bootstrap.sh"), script);
var plan = await CallWithFile<DevLeadPlanResponse>(nameof(DevLead), DevLead.Plan, file, kernel);
var plan = await CallWithFile<DevLeadPlanResponse>(nameof(DevLead), DevLead.Plan, readmeFile, kernel);
await SaveToFile(Path.Combine(outputPath.FullName, "plan.json"), JsonSerializer.Serialize(plan));
var implementationTasks = plan.steps.SelectMany(
(step) => step.subtasks.Select(
async (subtask) => {
var implementationResult = await CallFunction<string>(nameof(Developer), Developer.Implement, subtask.LLM_prompt, kernel);
var improvementResult = await CallFunction<string>(nameof(Developer), Developer.Improve, subtask.LLM_prompt, kernel);
await sandboxSkill.RunInDotnetAlpineAsync(implementationResult);
await SaveToFile(Path.Combine(outputPath.FullName, $"{step.step}-{subtask.subtask}.sh"), implementationResult);
return implementationResult; }));
await SaveToFile(Path.Combine(outputPath.FullName, $"{step.step}-{subtask.subtask}.sh"), improvementResult);
return improvementResult; }));
await Task.WhenAll(implementationTasks);
}
@@ -150,4 +153,4 @@ class Program
public static class PM { public static string Readme = "Readme"; public static string BootstrapProject = "BootstrapProject"; }
public static class DevLead { public static string Plan="Plan"; }
public static class Developer { public static string Implement="Implement"; }
public static class Developer { public static string Implement="Implement"; public static string Improve="Improve";}

View File

@@ -0,0 +1,8 @@
I'd like to build a typical Chat Message Applicaton: a simple chat app in React Native that allows the user to manage multiple chat threads.
Each thred is a different conversation. The app can look very similar to Apple iMessage.
Key features of the Chat Message application include the ability to create a new chat thread, view the messages in each thread, and to edite and send a new message.
The frontend for the app will be in typescript and React Native, the backend will be in C# as an Azure Function.
The backend will use a mock function to generate random responses. The backend will store the chats in an Azure CosmosDB.
The application will have a setup for local testing and development that allows testing without deployment to Azure.
Use bicep scripts to create the Azure resources.
The front end should be able to run entirely in the browser.

View File

@@ -21,4 +21,27 @@ public static class Developer {
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}}
{{$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
};
}

View File

@@ -18,6 +18,7 @@ public class SemanticFunctionConfig
(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}")
};
}