Skip to content

A programming framework for agentic AI

first draft workflow for understandings

Kosta Petaneb490ed83275
diff --git a/src/apps/gh-flow/appsettings.template.json b/src/apps/gh-flow/appsettings.template.json
index 78d23c1f2..8877352b6 100644
--- a/src/apps/gh-flow/appsettings.template.json
+++ b/src/apps/gh-flow/appsettings.template.json
@@ -37,5 +37,8 @@
"QdrantOptions" : {
"Endpoint" : "http://qdrant:6333",
"VectorSize" : "1536"
+ },
+ "ServiceOptions" : {
+ "IngesterUrl" : "http://localhost:7071"
}
}
diff --git a/src/libs/Microsoft.AI.DevTeam.Skills/DevLead.cs b/src/libs/Microsoft.AI.DevTeam.Skills/DevLead.cs
index e325af3df..5c26d70d6 100644
--- a/src/libs/Microsoft.AI.DevTeam.Skills/DevLead.cs
+++ b/src/libs/Microsoft.AI.DevTeam.Skills/DevLead.cs
@@ -44,4 +44,29 @@ public static class DevLead {
PPenalty = 0.0,
FPenalty = 0.0
};
+
+ public static SemanticFunctionConfig Explain = new SemanticFunctionConfig
+ {
+ PromptTemplate = """
+ 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.
+ 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/Developer.cs b/src/libs/Microsoft.AI.DevTeam.Skills/Developer.cs
index 9a1db00d6..50ffc01da 100644
--- a/src/libs/Microsoft.AI.DevTeam.Skills/Developer.cs
+++ b/src/libs/Microsoft.AI.DevTeam.Skills/Developer.cs
@@ -44,4 +44,29 @@ public static class Developer {
PPenalty = 0.0,
FPenalty = 0.0
};
+
+ 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/PM.cs b/src/libs/Microsoft.AI.DevTeam.Skills/PM.cs
index dd4dcb247..998157a48 100644
--- a/src/libs/Microsoft.AI.DevTeam.Skills/PM.cs
+++ b/src/libs/Microsoft.AI.DevTeam.Skills/PM.cs
@@ -39,4 +39,29 @@ public static class PM
PPenalty = 0.0,
FPenalty = 0.0
};
+
+ public static SemanticFunctionConfig Explain = new SemanticFunctionConfig
+ {
+ PromptTemplate = """
+ 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.
+ 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/Actors/DevLead/DeveloperLead.cs b/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/DeveloperLead.cs
index d7755d791..40b5d7230 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/DeveloperLead.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/DeveloperLead.cs
@@ -10,7 +10,7 @@ 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)
+ public DeveloperLead(IKernel kernel, [PersistentState("state", "messages")] IPersistentState<SemanticPersonaState> state) : base(state)
{
_kernel = kernel;
}
@@ -54,6 +54,11 @@ public class DeveloperLead : SemanticPersona, ILeadDevelopment
var response = JsonSerializer.Deserialize<DevLeadPlanResponse>(plan);
return Task.FromResult(response);
}
+
+ public Task<string> BuildUnderstanding(string content)
+ {
+ throw new NotImplementedException();
+ }
}
[GenerateSerializer]
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/ILeadDevelopment.cs b/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/ILeadDevelopment.cs
index 6799956c0..8c479f7e0 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/ILeadDevelopment.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/DevLead/ILeadDevelopment.cs
@@ -1,6 +1,6 @@
namespace Microsoft.AI.DevTeam;
-public interface ILeadDevelopment: IGrainWithIntegerCompoundKey, IChatHistory
+public interface ILeadDevelopment: IGrainWithIntegerCompoundKey, IChatHistory, IUnderstand
{
Task<string> CreatePlan(string ask);
Task<DevLeadPlanResponse> GetLatestPlan();
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/Developer/Developer.cs b/src/libs/Microsoft.AI.DevTeam/Actors/Developer/Developer.cs
index 5991196c9..8fc26f338 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/Developer/Developer.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/Developer/Developer.cs
@@ -10,7 +10,7 @@ public class Dev : SemanticPersona, IDevelopCode
private readonly IKernel _kernel;
protected override string MemorySegment => "dev-memory";
- public Dev(IKernel kernel, [PersistentState("state", "messages")]IPersistentState<ChatHistory> state) : base(state)
+ public Dev(IKernel kernel, [PersistentState("state", "messages")]IPersistentState<SemanticPersonaState> state) : base(state)
{
_kernel = kernel;
}
@@ -48,4 +48,9 @@ public class Dev : SemanticPersona, IDevelopCode
{
throw new NotImplementedException();
}
+
+ public Task<string> BuildUnderstanding(string content)
+ {
+ throw new NotImplementedException();
+ }
}
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/Developer/IDevelopCode.cs b/src/libs/Microsoft.AI.DevTeam/Actors/Developer/IDevelopCode.cs
index 027fa0878..e35ad7146 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/Developer/IDevelopCode.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/Developer/IDevelopCode.cs
@@ -1,6 +1,6 @@
namespace Microsoft.AI.DevTeam;
-public interface IDevelopCode : IGrainWithIntegerCompoundKey, IChatHistory
+public interface IDevelopCode : IGrainWithIntegerCompoundKey, IChatHistory, IUnderstand
{
Task<string> GenerateCode(string ask);
Task<string> ReviewPlan(string plan);
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/Ingester/Ingester.cs b/src/libs/Microsoft.AI.DevTeam/Actors/Ingester/Ingester.cs
index 3952bbf33..40ab7103a 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/Ingester/Ingester.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/Ingester/Ingester.cs
@@ -10,7 +10,7 @@ public class Ingester : SemanticPersona, IIngestRepo
private readonly IManageGithub _ghService;
private readonly IKernel _kernel;
private readonly IAnalyzeCode _codeAnalyzer;
- public Ingester([PersistentState("state", "messages")] IPersistentState<ChatHistory> state, IManageGithub ghService, IKernel kernel, IAnalyzeCode codeAnalyzer) : base(state)
+ public Ingester([PersistentState("state", "messages")] IPersistentState<SemanticPersonaState> state, IManageGithub ghService, IKernel kernel, IAnalyzeCode codeAnalyzer) : base(state)
{
_ghService = ghService;
_kernel = kernel;
@@ -19,14 +19,24 @@ public class Ingester : SemanticPersona, IIngestRepo
public async Task IngestionFlow(string org, string repo, string branch)
{
+ var suffix = $"{org}-{repo}";
var language = await _ghService.GetMainLanguage(org, repo);
var files = await _ghService.GetFiles(org, repo, branch, Language.Filters[language]);
+
+ var pm = GrainFactory.GetGrain<IManageProduct>(0, suffix);
+ var dev = GrainFactory.GetGrain<IDevelopCode>(0, suffix);
+ var devLead = GrainFactory.GetGrain<ILeadDevelopment>(0, suffix);
+
foreach (var file in files)
{
var codeAnalysis = await _codeAnalyzer.Analyze(file.Content);
- codeAnalysis.ToList()
- .ForEach(async c =>
- await _kernel.Memory.SaveInformationAsync(MemorySegment, c.CodeBlock, Guid.NewGuid().ToString(), c.Meaning));
+ codeAnalysis.ToList().ForEach(async c =>
+ await _kernel.Memory.SaveInformationAsync(MemorySegment, c.CodeBlock, Guid.NewGuid().ToString(), c.Meaning));
+
+ Task.WaitAll(new[] {
+ pm.BuildUnderstanding(file.Content),
+ dev.BuildUnderstanding(file.Content),
+ devLead.BuildUnderstanding(file.Content)});
}
}
}
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/ProductManager/IManageProduct.cs b/src/libs/Microsoft.AI.DevTeam/Actors/ProductManager/IManageProduct.cs
index e9ca51f83..71b7ce6a9 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
+public interface IManageProduct : IGrainWithIntegerCompoundKey, IChatHistory, IUnderstand
{
Task<string> CreateReadme(string ask);
}
\ No newline at end of file
diff --git a/src/libs/Microsoft.AI.DevTeam/Actors/SemanticPersona.cs b/src/libs/Microsoft.AI.DevTeam/Actors/SemanticPersona.cs
index 1ae539ad8..9ed3313cb 100644
--- a/src/libs/Microsoft.AI.DevTeam/Actors/SemanticPersona.cs
+++ b/src/libs/Microsoft.AI.DevTeam/Actors/SemanticPersona.cs
@@ -7,13 +7,13 @@ namespace Microsoft.AI.DevTeam;
public abstract class SemanticPersona : Grain, IChatHistory
{
public SemanticPersona(
- [PersistentState("state", "messages")] IPersistentState<ChatHistory> state)
+ [PersistentState("state", "messages")] IPersistentState<SemanticPersonaState> state)
{
_state = state;
}
protected virtual string MemorySegment { get; set; }
protected List<ChatHistoryItem> History { get; set; }
- protected readonly IPersistentState<ChatHistory> _state;
+ protected readonly IPersistentState<SemanticPersonaState> _state;
public async Task<string> GetLastMessage()
{
@@ -38,6 +38,11 @@ public interface IChatHistory
Task<string> GetLastMessage();
}
+public interface IUnderstand
+{
+ Task<string> BuildUnderstanding(string content);
+}
+
[Serializable]
public class ChatHistoryItem
@@ -48,9 +53,10 @@ public class ChatHistoryItem
}
-public class ChatHistory
+public class SemanticPersonaState
{
public List<ChatHistoryItem> History { get; set; }
+ public string Understanding { get; set; }
}
public enum ChatUserType