Skip to content

A programming framework for agentic AI

add code explainer semantic function

Ryan Sweet5a3b47eef7ee
diff --git a/skills/CodeExplainer.cs b/skills/CodeExplainer.cs
new file mode 100644
index 000000000..d7e493c74
--- /dev/null
+++ b/skills/CodeExplainer.cs
@@ -0,0 +1,29 @@
+
+namespace Microsoft.SKDevTeam;
+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/skills/SemanticFunctionConfig.cs b/skills/SemanticFunctionConfig.cs
index 7badd440d..300ef3b59 100644
--- a/skills/SemanticFunctionConfig.cs
+++ b/skills/SemanticFunctionConfig.cs
@@ -18,6 +18,7 @@ public class SemanticFunctionConfig
(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}")