Skip to content

A programming framework for agentic AI

parse output from skills

Kosta Petan0b920fcdfd42
diff --git a/cli/Models/DevLeadPlanResponse.cs b/cli/Models/DevLeadPlanResponse.cs
new file mode 100644
index 000000000..52fcc6a73
--- /dev/null
+++ b/cli/Models/DevLeadPlanResponse.cs
@@ -0,0 +1,25 @@
+using System.Text.Json.Serialization;
+
+public class Subtask
+{
+ [JsonPropertyName("subtask")]
+ public string Name { get; set; }
+ [JsonPropertyName("LLM_prompt")]
+ public string LLMPrompt { get; set; }
+}
+
+public class Step
+{
+ [JsonPropertyName("step")]
+ public string Name { get; set; }
+ [JsonPropertyName("description")]
+ public string Description { get; set; }
+ [JsonPropertyName("subtasks")]
+ public List<Subtask> Subtasks { get; set; }
+}
+
+public class DevLeadPlanResponse
+{
+ [JsonPropertyName("steps")]
+ public List<Step> Steps { get; set; }
+}
\ No newline at end of file
diff --git a/cli/Models/SkillsResponse.cs b/cli/Models/SkillsResponse.cs
new file mode 100644
index 000000000..06d2316d8
--- /dev/null
+++ b/cli/Models/SkillsResponse.cs
@@ -0,0 +1,7 @@
+using System.Text.Json.Serialization;
+
+public class SkillsResponse
+{
+ [JsonPropertyName("response")]
+ public string? Response { get; set; }
+}
\ No newline at end of file
diff --git a/cli/Program.cs b/cli/Program.cs
index 014f5e3a9..7d8b89e1c 100644
--- a/cli/Program.cs
+++ b/cli/Program.cs
@@ -18,22 +18,22 @@ class Program
var pmCommand = new Command("pm", "Commands for the PM team");
var pmReadmeCommand = new Command("readme", "Produce a Readme for a given input");
- pmReadmeCommand.SetHandler(async (file) => await CallFunction(nameof(PM), PM.Readme , file.FullName), fileOption);
+ pmReadmeCommand.SetHandler(async (file) => await CallFunction<string>(nameof(PM), PM.Readme , file.FullName), fileOption);
var pmBootstrapCommand = new Command("bootstrap", "Bootstrap a project for a given input");
- pmBootstrapCommand.SetHandler(async (file) => await CallFunction(nameof(PM), PM.BootstrapProject, file.FullName), fileOption);
+ pmBootstrapCommand.SetHandler(async (file) => await CallFunction<string>(nameof(PM), PM.BootstrapProject, file.FullName), fileOption);
pmCommand.AddCommand(pmReadmeCommand);
pmCommand.AddCommand(pmBootstrapCommand);
var devleadCommand = new Command("devlead", "Commands for the Dev Lead team");
var devleadPlanCommand = new Command("plan", "Plan the work for a given input");
- devleadPlanCommand.SetHandler(async (file) => await CallFunction(nameof(DevLead), DevLead.Plan, file.FullName), fileOption);
+ devleadPlanCommand.SetHandler(async (file) => await CallFunction<DevLeadPlanResponse>(nameof(DevLead), DevLead.Plan, file.FullName), fileOption);
devleadCommand.AddCommand(devleadPlanCommand);
var devCommand = new Command("dev", "Commands for the Dev team");
var devPlanCommand = new Command("plan", "Implement the module for a given input");
- devPlanCommand.SetHandler(async (file) => await CallFunction(nameof(Developer), Developer.Implement, file.FullName), fileOption);
+ devPlanCommand.SetHandler(async (file) => await CallFunction<string>(nameof(Developer), Developer.Implement, file.FullName), fileOption);
devCommand.AddCommand(devPlanCommand);
rootCommand.AddCommand(pmCommand);
@@ -43,12 +43,12 @@ class Program
await rootCommand.InvokeAsync(args);
}
- public static async Task CallFunction(string skillName, string functionName, string file)
+ public static async Task<T> CallFunction<T>(string skillName, string functionName, string file)
{
if (!File.Exists(file))
{
Console.WriteLine($"File not found: {file}");
- return;
+ return default;
}
var variables = new[]
@@ -69,22 +69,16 @@ class Program
if (!response.IsSuccessStatusCode)
{
Console.WriteLine($"Error: {response.StatusCode} - {response.ReasonPhrase}");
- return;
+ return default;
}
var responseJson = await response.Content.ReadAsStringAsync();
- //if we have a successful response, we can deserialize the response body and write it to console
- var responseBody = JsonSerializer.Deserialize<object>(responseJson);
- // response body is a dictionary of key/value pairs and responseBody.response is not null, write it to console
- if (responseBody is not null && responseBody is JsonElement jsonElement && jsonElement.TryGetProperty("response", out var responseValue))
- {
- Console.WriteLine(responseValue);
- }
- else
- {
- Console.WriteLine(responseJson);
- }
- return;
+
+ var skillResponse = JsonSerializer.Deserialize<SkillsResponse>(responseJson);
+ var result = typeof(T) != typeof(string) ? JsonSerializer.Deserialize<T>(skillResponse.Response) : (T)(object)skillResponse.Response;
+
+ Console.WriteLine(responseJson);
+ return result;
}
}
diff --git a/sk-azfunc-server/skills/PM/BootstrapProject/config.json b/sk-azfunc-server/skills/PM/BootstrapProject/config.json
index a19a7d319..54819924a 100644
--- a/sk-azfunc-server/skills/PM/BootstrapProject/config.json
+++ b/sk-azfunc-server/skills/PM/BootstrapProject/config.json
@@ -3,7 +3,7 @@
"description": "Output a script that will help bootstrap a new code project in .NET",
"type": "completion",
"completion": {
- "max_tokens": 8192,
+ "max_tokens": 7000,
"temperature": 0.0,
"top_p": 0.0,
"presence_penalty": 0.0,
diff --git a/sk-azfunc-server/skills/PM/BootstrapProject/skprompt.txt b/sk-azfunc-server/skills/PM/BootstrapProject/skprompt.txt
index 1aba1568f..de1547e5d 100644
--- a/sk-azfunc-server/skills/PM/BootstrapProject/skprompt.txt
+++ b/sk-azfunc-server/skills/PM/BootstrapProject/skprompt.txt
@@ -1,4 +1,5 @@
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 file