From 11a200a0d576632f847d4d6c1578f64fafa3c4e5 Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Mon, 10 Jul 2023 15:58:35 -0700 Subject: [PATCH 01/22] add workflows app --- .../Activities/SemanticKernelSkillRequest.cs | 2 +- WorkflowsApp/NuGet.Config | 10 ++++ WorkflowsApp/Pages/Index.cshtml | 22 ++++++++ WorkflowsApp/Pages/_ViewImports.cshtml | 2 + WorkflowsApp/Program.cs | 49 ++++++++++++++++++ WorkflowsApp/Properties/launchSettings.json | 37 +++++++++++++ WorkflowsApp/WorkflowsApp.csproj | 23 ++++++++ WorkflowsApp/appsettings.Development.json | 8 +++ WorkflowsApp/elsa.sqlite.db | Bin 0 -> 110592 bytes 9 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 WorkflowsApp/NuGet.Config create mode 100644 WorkflowsApp/Pages/Index.cshtml create mode 100644 WorkflowsApp/Pages/_ViewImports.cshtml create mode 100644 WorkflowsApp/Program.cs create mode 100644 WorkflowsApp/Properties/launchSettings.json create mode 100644 WorkflowsApp/WorkflowsApp.csproj create mode 100644 WorkflowsApp/appsettings.Development.json create mode 100644 WorkflowsApp/elsa.sqlite.db diff --git a/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs b/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs index bb5a11fff..b31429658 100644 --- a/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs +++ b/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs @@ -110,7 +110,7 @@ public class SemanticKernelSkill : CodeActivity var context = new ContextVariables(); context.Set("input", prompt); - context.Set("wafContext", wafContext); + //context.Set("wafContext", wafContext); var answer = await kernel.RunAsync(context, function).ConfigureAwait(false); var result = typeof(T) != typeof(string) ? JsonSerializer.Deserialize(answer.ToString()) : (T)(object)answer.ToString(); diff --git a/WorkflowsApp/NuGet.Config b/WorkflowsApp/NuGet.Config new file mode 100644 index 000000000..a89a1e8b5 --- /dev/null +++ b/WorkflowsApp/NuGet.Config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/WorkflowsApp/Pages/Index.cshtml b/WorkflowsApp/Pages/Index.cshtml new file mode 100644 index 000000000..b889d560a --- /dev/null +++ b/WorkflowsApp/Pages/Index.cshtml @@ -0,0 +1,22 @@ +@page "/" +@{ + var serverUrl = $"{Request.Scheme}://{Request.Host}{Request.PathBase}{Request.Path}"; + var apiUrl = serverUrl + "elsa/api"; +} + + + + + + Elsa Workflows 3.0 + + + + + + + + + + + \ No newline at end of file diff --git a/WorkflowsApp/Pages/_ViewImports.cshtml b/WorkflowsApp/Pages/_ViewImports.cshtml new file mode 100644 index 000000000..251d63908 --- /dev/null +++ b/WorkflowsApp/Pages/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@namespace WorkflowsApp.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers \ No newline at end of file diff --git a/WorkflowsApp/Program.cs b/WorkflowsApp/Program.cs new file mode 100644 index 000000000..221c2ff10 --- /dev/null +++ b/WorkflowsApp/Program.cs @@ -0,0 +1,49 @@ +using Elsa.EntityFrameworkCore.Extensions; +using Elsa.EntityFrameworkCore.Modules.Management; +using Elsa.Extensions; +using Elsa.Identity.Features; +using Elsa.SemanticKernel; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +builder.Services.AddElsa(elsa => +{ + // Configure management feature to use EF Core. + elsa.UseWorkflowManagement(management => management.UseEntityFrameworkCore(ef => ef.UseSqlite())); + + // Expose API endpoints. + elsa.UseWorkflowsApi(); + + // Add services for HTTP activities and workflow middleware. + elsa.UseHttp(); + + // Configure identity so that we can create a default admin user. + elsa.UseIdentity(identity => + { + identity.UseAdminUserProvider(); + identity.TokenOptions = options => options.SigningKey = "secret-token-signing-key"; + }); + + // Use default authentication (JWT + API Key). + elsa.UseDefaultAuthentication(auth => auth.UseAdminApiKey()); + + // Add Semantic Kernel skill. + elsa.AddActivity(); + +}); + +// Add Razor pages. +builder.Services.AddRazorPages(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +app.UseHttpsRedirection(); +app.UseStaticFiles(); +app.UseAuthentication(); +app.UseAuthorization(); +app.UseWorkflowsApi(); +app.UseWorkflows(); +app.MapRazorPages(); +app.Run(); diff --git a/WorkflowsApp/Properties/launchSettings.json b/WorkflowsApp/Properties/launchSettings.json new file mode 100644 index 000000000..aacf9bea6 --- /dev/null +++ b/WorkflowsApp/Properties/launchSettings.json @@ -0,0 +1,37 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:10492", + "sslPort": 44312 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5181", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7077;http://localhost:5181", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/WorkflowsApp/WorkflowsApp.csproj b/WorkflowsApp/WorkflowsApp.csproj new file mode 100644 index 000000000..ad83cc625 --- /dev/null +++ b/WorkflowsApp/WorkflowsApp.csproj @@ -0,0 +1,23 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + + + + + diff --git a/WorkflowsApp/appsettings.Development.json b/WorkflowsApp/appsettings.Development.json new file mode 100644 index 000000000..ff66ba6b2 --- /dev/null +++ b/WorkflowsApp/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/WorkflowsApp/elsa.sqlite.db b/WorkflowsApp/elsa.sqlite.db new file mode 100644 index 0000000000000000000000000000000000000000..4eec189fb07ba414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~Rj1(Si}h zoS9yUQJ+x`PoLSvOM)_&03V!qKXDvQ^aOI2OExA)X=0*qo{7m7Zk}>ecLtWgjdSCRcpw?-R7ByoQb4%-a|8tc%M-QGh#1->*iddT=Ul$4T{D@r+qBDO%dNw&g<&tXCrjTpJ6@R0GIn*xOQdJr zvT=r5tr{=U-ZZQ2*D_DN6;T%*72?TUG-{j%hnmA%`=~1GQc0}qwdU{M9xSCjMZ^B1%u#}7trr|;uF5}Wr1^K_ilmiQ`Pg_BbI_SRzd^H+ zDvMS5V@Y*ZHxCJ)Qp+_(mri`TZC6)i<*=iN%m$WZMO05)>z39xmzu|$xo%H04(yzk zE9>$@SwH3N@ox_%|7HV5XwU&AXx3!f<%o06?{+HFCZ5a>N7=iXpuy+pR(tq47LGLb z!VH_uhCdOS1F%%euWrbPYV*89dso)tBDd69 zrC!$C%&yrqo)m_n?EP#v9^b8$(!Pr$bkRO)T)2s=&cC3^D51{s-}I?OYV!ac6-L9w|!|r*Jbv33!O<RLpeTRQF9o~*CDK-RwEB^&Zf z4Eu-K@F(f+jva4`yAV1re%lOeA5r^hxYuqp>$~4R@AP(F7dNg>F}MNXz1`s&p#9vf za8 Date: Mon, 10 Jul 2023 18:34:46 -0700 Subject: [PATCH 02/22] Semantic Kernel Activity roudtrips when executing workflow but I cant get it to set the result in the workflow context. --- .../Activities/SemanticKernelSkillRequest.cs | 24 ++++++++++-------- Elsa.SemanticKernel/Config/PromptDefaults.cs | 7 +++++ WorkflowsApp/.env | 7 +++++ WorkflowsApp/elsa.sqlite.db | Bin 110592 -> 4096 bytes WorkflowsApp/elsa.sqlite.db-shm | Bin 0 -> 32768 bytes WorkflowsApp/elsa.sqlite.db-wal | Bin 0 -> 251352 bytes skills/Chat.cs | 21 +++++++++++++++ skills/SemanticFunctionConfig.cs | 1 + 8 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 Elsa.SemanticKernel/Config/PromptDefaults.cs create mode 100644 WorkflowsApp/.env create mode 100644 WorkflowsApp/elsa.sqlite.db-shm create mode 100644 WorkflowsApp/elsa.sqlite.db-wal create mode 100644 skills/Chat.cs diff --git a/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs b/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs index b31429658..c8027c7d2 100644 --- a/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs +++ b/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs @@ -19,20 +19,20 @@ using skills; /// /// Invoke a Semantic Kernel skill. /// -[Activity("Elsa", "SemanticKernelSkill", "Invoke a Semantic Kernel skill. ", DisplayName = "Semantic Kernel Skill", Kind = ActivityKind.Task)] +[Activity("Elsa", "AI Chat", "Invoke a Semantic Kernel skill. ", DisplayName = "Semantic Kernel Skill", Kind = ActivityKind.Task)] [PublicAPI] public class SemanticKernelSkill : CodeActivity { [Input( - Description = "System Prompt.", - UIHint = InputUIHints.MultiText, - DefaultValue = new string[0])] - public Input SystemPrompt { get; set; } = default!; + Description = "System Prompt", + UIHint = InputUIHints.MultiLine, + DefaultValue = PromptDefaults.SystemPrompt)] + public Input SysPrompt { get; set; } = default!; [Input( - Description = "User Input Prompt.", - UIHint = InputUIHints.MultiText, - DefaultValue = new string[0])] + Description = "User Input Prompt", + UIHint = InputUIHints.MultiLine, + DefaultValue = PromptDefaults.UserPrompt)] public Input Prompt { get; set; } [Input( @@ -44,13 +44,13 @@ public class SemanticKernelSkill : CodeActivity [Input( Description = "The skill to invoke from the semantic kernel", UIHint = InputUIHints.SingleLine, - DefaultValue = "PM")] + DefaultValue = "Chat")] public Input SkillName { get; set; } [Input( Description = "The function to invoke from the skill", UIHint = InputUIHints.SingleLine, - DefaultValue = "README")] + DefaultValue = "ChatCompletion")] public Input FunctionName { get; set; } /// @@ -58,7 +58,7 @@ public class SemanticKernelSkill : CodeActivity { var skillName = SkillName.Get(context); var functionName = FunctionName.Get(context); - var systemPrompt = SystemPrompt.Get(context); + var systemPrompt = SysPrompt.Get(context); var prompt = Prompt.Get(context); var maxRetries = MaxRetries.Get(context); var result = await ChatCompletion(skillName, functionName, prompt, maxRetries); @@ -114,6 +114,8 @@ public class SemanticKernelSkill : CodeActivity var answer = await kernel.RunAsync(context, function).ConfigureAwait(false); var result = typeof(T) != typeof(string) ? JsonSerializer.Deserialize(answer.ToString()) : (T)(object)answer.ToString(); + //debug output to console + Console.WriteLine($"Skill: {skillName} Function: {functionName} Prompt: {prompt} Answer: {result}"); return result; } } \ No newline at end of file diff --git a/Elsa.SemanticKernel/Config/PromptDefaults.cs b/Elsa.SemanticKernel/Config/PromptDefaults.cs new file mode 100644 index 000000000..6f5a16c75 --- /dev/null +++ b/Elsa.SemanticKernel/Config/PromptDefaults.cs @@ -0,0 +1,7 @@ +internal static class PromptDefaults { + public const string SystemPrompt = @"You are fulfilling roles on a software development team. + Provide a response to the following prompt, do not provide any additional output."; + + public const string UserPrompt = @"Let's build a ToDoList Application!"; + + } \ No newline at end of file diff --git a/WorkflowsApp/.env b/WorkflowsApp/.env new file mode 100644 index 000000000..059289bb5 --- /dev/null +++ b/WorkflowsApp/.env @@ -0,0 +1,7 @@ +export EMBEDDINGDEPLOYMENTORMODELID=text-embedding-ada-002 +export SERVICEID=gpt-4 +export SERVICETYPE=AzureOpenAI +export ENDPOINT=https://lightspeed-team-shared-openai-eastus.openai.azure.com/ +export DEPLOYMENTORMODELID=gpt-4 +export APIKEY=3a6944607e2048668f61125aff47ba3f + diff --git a/WorkflowsApp/elsa.sqlite.db b/WorkflowsApp/elsa.sqlite.db index 4eec189fb07ba414ba29493fa7050b909a4136b3..ca2e1dcd41b5e054a089494f52adf9e106e36be2 100644 GIT binary patch delta 26 gcmZp8z}BEJL7J73fq{W>;zD~MLob;6FMIn8VdcE<3gd(5dB=CAL}tiPll~u=)Ymd^KMUv zLNn#?h*3E4gHh(?#19jn$DWT(#!{nSGCwhoqR*mhBVUhP9sXiC5|M_U4Sf*)Dje(9 z-2ZTS7hj`y_0b8qskjquYP-`*mhY+SpSbxb{^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PM), nameof(PM.BootstrapProject)) => PM.BootstrapProject, (nameof(PM), nameof(PM.Readme)) => PM.Readme, (nameof(DevLead), nameof(DevLead.Plan)) => DevLead.Plan, From 9f6dfbed3709aa088d29017405536cb7d242a5e2 Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Mon, 10 Jul 2023 20:45:08 -0700 Subject: [PATCH 03/22] remove db from checkin --- .gitignore | 4 ++++ WorkflowsApp/elsa.sqlite.db | Bin 4096 -> 0 bytes WorkflowsApp/elsa.sqlite.db-shm | Bin 32768 -> 0 bytes WorkflowsApp/elsa.sqlite.db-wal | Bin 251352 -> 0 bytes 4 files changed, 4 insertions(+) delete mode 100644 WorkflowsApp/elsa.sqlite.db delete mode 100644 WorkflowsApp/elsa.sqlite.db-shm delete mode 100644 WorkflowsApp/elsa.sqlite.db-wal diff --git a/.gitignore b/.gitignore index 0da63ea87..56f13a011 100644 --- a/.gitignore +++ b/.gitignore @@ -482,3 +482,7 @@ $RECYCLE.BIN/ # Vim temporary swap files *.swp + +# SQLite workflows DB +elsa.sqlite.db +elsa.dqlite.db* diff --git a/WorkflowsApp/elsa.sqlite.db b/WorkflowsApp/elsa.sqlite.db deleted file mode 100644 index ca2e1dcd41b5e054a089494f52adf9e106e36be2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmWFz^vNtqRY=P(%1ta$FlG>7U}9o$P*7lCU|@t|AVoG{WY9}yyHon-%452*3Umz+wV2jTC1P2-r8Vov}UYXYtGtaZML>pTdi%@c58>V z)7oY2w&txp)?TaM^L_uX_VvI0<@dHdK>z^+5I_I{1Q0*~0R#|0009ILKmY**5I_I{ z1Q0*~0R#|0009ILKmY**5I_I{1Q0*~0R#|0009ILKmY**5I_I{1Q0*~0R#|00D*rh z;O`rdBmz~X_aBn1WKE?A_{$z7i9o9KvPzPbtf>?Mf76B}5lENb6iTv^HI*XJUnvJI z`#I}0q)E+bS({})3kUcefq~!ICcrNB8V+#FSXUg3b=@D_*56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LAL zI2#)~Bdth7e!p*^*XIijg!)5+K7W6YB--!?`hC5=z`lXtU@#EsUlR|Jh9Y96rZDnS ztep`l19B+^a-CM67WoJkl_f<@^^T2?BsInC(orQASF;^6Ba$yDZ%TW;{{40<<&@In z&L(0Q6Yrzc>bNG-JDg5xw-~KSYksdku-6;f>+`w2z9IjG+KKzlJwAYS)^S<2m0^}puz_Fex2q1s}0tg_000IagfB*sroDTvU%11Ex z?W^AQnea6~=01Y+p$mxt0R#|0009ILKmY**5I_Kd-=0AJJ_2J1pm4pwpR9F$=fE3& z@2iXp{Px^w836 Date: Mon, 10 Jul 2023 21:28:28 -0700 Subject: [PATCH 04/22] fix gitignore --- .gitignore | 3 +-- WorkflowsApp/.env | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 56f13a011..dbf27f9b0 100644 --- a/.gitignore +++ b/.gitignore @@ -484,5 +484,4 @@ $RECYCLE.BIN/ *.swp # SQLite workflows DB -elsa.sqlite.db -elsa.dqlite.db* +elsa.sqlite.* diff --git a/WorkflowsApp/.env b/WorkflowsApp/.env index 059289bb5..8fb8d6ba6 100644 --- a/WorkflowsApp/.env +++ b/WorkflowsApp/.env @@ -3,5 +3,4 @@ export SERVICEID=gpt-4 export SERVICETYPE=AzureOpenAI export ENDPOINT=https://lightspeed-team-shared-openai-eastus.openai.azure.com/ export DEPLOYMENTORMODELID=gpt-4 -export APIKEY=3a6944607e2048668f61125aff47ba3f - +export APIKEY=YOURKEYHERE From dd56d6346f7fe6cc9a41d0697353a64dd39d5458 Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Mon, 10 Jul 2023 21:38:30 -0700 Subject: [PATCH 05/22] fixup .env --- WorkflowsApp/.env | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/WorkflowsApp/.env b/WorkflowsApp/.env index 8fb8d6ba6..a1e31eff3 100644 --- a/WorkflowsApp/.env +++ b/WorkflowsApp/.env @@ -1,6 +1,8 @@ -export EMBEDDINGDEPLOYMENTORMODELID=text-embedding-ada-002 -export SERVICEID=gpt-4 + +# Replace with your own values export SERVICETYPE=AzureOpenAI -export ENDPOINT=https://lightspeed-team-shared-openai-eastus.openai.azure.com/ +export SERVICEID=gpt-4 export DEPLOYMENTORMODELID=gpt-4 -export APIKEY=YOURKEYHERE +export EMBEDDINGDEPLOYMENTORMODELID=text-embedding-ada-002 +#export ENDPOINT=YOURENDPOINTHERE +#export APIKEY=YOURKEYHERE:wq From e16bbfc570e9760a86991e3586cec6907bfe4f08 Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Mon, 10 Jul 2023 21:42:25 -0700 Subject: [PATCH 06/22] more .env cleanup --- .gitignore | 3 +++ WorkflowsApp/{.env => .env_example} | 0 2 files changed, 3 insertions(+) rename WorkflowsApp/{.env => .env_example} (100%) diff --git a/.gitignore b/.gitignore index dbf27f9b0..06aed8e79 100644 --- a/.gitignore +++ b/.gitignore @@ -485,3 +485,6 @@ $RECYCLE.BIN/ # SQLite workflows DB elsa.sqlite.* + +# env files +#.env \ No newline at end of file diff --git a/WorkflowsApp/.env b/WorkflowsApp/.env_example similarity index 100% rename from WorkflowsApp/.env rename to WorkflowsApp/.env_example From 5f119910484cab080de243a7f7f7b400c9fae078 Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Mon, 10 Jul 2023 21:43:05 -0700 Subject: [PATCH 07/22] gitignore .env --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 06aed8e79..eef1881b8 100644 --- a/.gitignore +++ b/.gitignore @@ -487,4 +487,4 @@ $RECYCLE.BIN/ elsa.sqlite.* # env files -#.env \ No newline at end of file +.env \ No newline at end of file From 868a38075378ad73f18e11d70323a1c0f1eff56f Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Mon, 10 Jul 2023 22:52:23 -0700 Subject: [PATCH 08/22] fix type when setting result, rename file --- ...ernelSkillRequest.cs => SemanticKernel.cs} | 24 +++++++------------ WorkflowsApp/WorkflowsApp.csproj | 20 ++++++++-------- 2 files changed, 19 insertions(+), 25 deletions(-) rename Elsa.SemanticKernel/Activities/{SemanticKernelSkillRequest.cs => SemanticKernel.cs} (85%) diff --git a/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs b/Elsa.SemanticKernel/Activities/SemanticKernel.cs similarity index 85% rename from Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs rename to Elsa.SemanticKernel/Activities/SemanticKernel.cs index c8027c7d2..3cb7fcdd3 100644 --- a/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs +++ b/Elsa.SemanticKernel/Activities/SemanticKernel.cs @@ -54,19 +54,14 @@ public class SemanticKernelSkill : CodeActivity public Input FunctionName { get; set; } /// - protected override async ValueTask ExecuteAsync(ActivityExecutionContext context) - { - var skillName = SkillName.Get(context); - var functionName = FunctionName.Get(context); - var systemPrompt = SysPrompt.Get(context); - var prompt = Prompt.Get(context); - var maxRetries = MaxRetries.Get(context); - var result = await ChatCompletion(skillName, functionName, prompt, maxRetries); - context.SetResult(result); - } - - private async Task ChatCompletion(string skillName, string functionName, string prompt, int maxRetries) + protected override async ValueTask ExecuteAsync(ActivityExecutionContext workflowContext) { + var test = SkillName.Get(workflowContext); + var skillName = SkillName.Get(workflowContext); + var functionName = FunctionName.Get(workflowContext); + var systemPrompt = SysPrompt.Get(workflowContext); + var maxRetries = MaxRetries.Get(workflowContext); + var prompt = Prompt.Get(workflowContext); var kernelSettings = KernelSettings.LoadSettings(); var kernelConfig = new KernelConfig(); @@ -113,9 +108,8 @@ public class SemanticKernelSkill : CodeActivity //context.Set("wafContext", wafContext); var answer = await kernel.RunAsync(context, function).ConfigureAwait(false); - var result = typeof(T) != typeof(string) ? JsonSerializer.Deserialize(answer.ToString()) : (T)(object)answer.ToString(); //debug output to console - Console.WriteLine($"Skill: {skillName} Function: {functionName} Prompt: {prompt} Answer: {result}"); - return result; + Console.WriteLine($"Skill: {skillName} Function: {functionName} Prompt: {prompt} Answer: {answer}"); + workflowContext.SetResult(answer); } } \ No newline at end of file diff --git a/WorkflowsApp/WorkflowsApp.csproj b/WorkflowsApp/WorkflowsApp.csproj index ad83cc625..e11e47aa5 100644 --- a/WorkflowsApp/WorkflowsApp.csproj +++ b/WorkflowsApp/WorkflowsApp.csproj @@ -6,18 +6,18 @@ enable - - - - - - - - + + + + + + + + - - + + From b4b190ca43f878f91e4ded25e7f96f6ef4e42f00 Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Tue, 11 Jul 2023 17:19:01 -0700 Subject: [PATCH 09/22] update to use Elsa prerelease ahead of rc1 --- Elsa.SemanticKernel/Elsa.SemanticKernel.csproj | 2 +- Elsa.SemanticKernel/NuGet.Config | 2 +- WorkflowsApp/NuGet.Config | 2 +- WorkflowsApp/Program.cs | 1 + WorkflowsApp/WorkflowsApp.csproj | 10 ++++++++-- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Elsa.SemanticKernel/Elsa.SemanticKernel.csproj b/Elsa.SemanticKernel/Elsa.SemanticKernel.csproj index 8b4fb761f..c6f15a6e7 100644 --- a/Elsa.SemanticKernel/Elsa.SemanticKernel.csproj +++ b/Elsa.SemanticKernel/Elsa.SemanticKernel.csproj @@ -9,7 +9,7 @@ - + diff --git a/Elsa.SemanticKernel/NuGet.Config b/Elsa.SemanticKernel/NuGet.Config index a89a1e8b5..5d2144320 100644 --- a/Elsa.SemanticKernel/NuGet.Config +++ b/Elsa.SemanticKernel/NuGet.Config @@ -3,7 +3,7 @@ - + diff --git a/WorkflowsApp/NuGet.Config b/WorkflowsApp/NuGet.Config index a89a1e8b5..5d2144320 100644 --- a/WorkflowsApp/NuGet.Config +++ b/WorkflowsApp/NuGet.Config @@ -3,7 +3,7 @@ - + diff --git a/WorkflowsApp/Program.cs b/WorkflowsApp/Program.cs index 221c2ff10..1e83d307e 100644 --- a/WorkflowsApp/Program.cs +++ b/WorkflowsApp/Program.cs @@ -1,6 +1,7 @@ using Elsa.EntityFrameworkCore.Extensions; using Elsa.EntityFrameworkCore.Modules.Management; using Elsa.Extensions; +using Elsa.Workflows.Core.Models; using Elsa.Identity.Features; using Elsa.SemanticKernel; diff --git a/WorkflowsApp/WorkflowsApp.csproj b/WorkflowsApp/WorkflowsApp.csproj index e11e47aa5..d5e4e63e7 100644 --- a/WorkflowsApp/WorkflowsApp.csproj +++ b/WorkflowsApp/WorkflowsApp.csproj @@ -7,13 +7,19 @@ - + + + + + + + From 814b9b92ca98afc1795bd01084a48d2e8a0eddb2 Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Wed, 12 Jul 2023 09:48:51 -0700 Subject: [PATCH 10/22] cleaning up workflowContext --- Elsa.SemanticKernel/Activities/SemanticKernel.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Elsa.SemanticKernel/Activities/SemanticKernel.cs b/Elsa.SemanticKernel/Activities/SemanticKernel.cs index 3cb7fcdd3..d4f65f62a 100644 --- a/Elsa.SemanticKernel/Activities/SemanticKernel.cs +++ b/Elsa.SemanticKernel/Activities/SemanticKernel.cs @@ -107,9 +107,11 @@ public class SemanticKernelSkill : CodeActivity context.Set("input", prompt); //context.Set("wafContext", wafContext); - var answer = await kernel.RunAsync(context, function).ConfigureAwait(false); + SKContext answer = await kernel.RunAsync(context, function).ConfigureAwait(false); + string result = answer.Result; + //debug output to console - Console.WriteLine($"Skill: {skillName} Function: {functionName} Prompt: {prompt} Answer: {answer}"); - workflowContext.SetResult(answer); + Console.WriteLine($"Skill: {skillName}\nFunction: {functionName}\nPrompt: {prompt}Answer: {result}"); + workflowContext.SetResult(result); } } \ No newline at end of file From 7a901fab44defc7f7ba1bc78d2294a641f88a954 Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Wed, 12 Jul 2023 20:39:01 -0700 Subject: [PATCH 11/22] updating to see if we can use foreach activity --- Elsa.SemanticKernel/Config/KernelSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Elsa.SemanticKernel/Config/KernelSettings.cs b/Elsa.SemanticKernel/Config/KernelSettings.cs index 613c2c92e..b514af768 100644 --- a/Elsa.SemanticKernel/Config/KernelSettings.cs +++ b/Elsa.SemanticKernel/Config/KernelSettings.cs @@ -46,7 +46,7 @@ internal class KernelSettings return FromFile(DefaultConfigFile); } - Console.WriteLine($"Semantic kernel settings '{DefaultConfigFile}' not found, attempting to load configuration from user secrets."); + Console.Debug.WriteLine($"Semantic kernel settings '{DefaultConfigFile}' not found, attempting to load configuration from user secrets."); return FromUserSecrets(); } From 6b2c2af03aaa6c504c7274183dcef4634ddf64ea Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Wed, 12 Jul 2023 20:39:21 -0700 Subject: [PATCH 12/22] try using foreach activity --- .../Activities/SemanticKernel.cs | 104 ++++++++++-------- skills/DevLead.cs | 37 ++++++- 2 files changed, 97 insertions(+), 44 deletions(-) diff --git a/Elsa.SemanticKernel/Activities/SemanticKernel.cs b/Elsa.SemanticKernel/Activities/SemanticKernel.cs index d4f65f62a..72f08c15a 100644 --- a/Elsa.SemanticKernel/Activities/SemanticKernel.cs +++ b/Elsa.SemanticKernel/Activities/SemanticKernel.cs @@ -53,6 +53,12 @@ public class SemanticKernelSkill : CodeActivity DefaultValue = "ChatCompletion")] public Input FunctionName { get; set; } +/* [Input( + Description = "Mockup - don't actually call the AI, just output the prompts", + UIHint = InputUIHints.Checkbox, + DefaultValue = false)] + public Input Mockup { get; set; } */ + /// protected override async ValueTask ExecuteAsync(ActivityExecutionContext workflowContext) { @@ -62,56 +68,68 @@ public class SemanticKernelSkill : CodeActivity var systemPrompt = SysPrompt.Get(workflowContext); var maxRetries = MaxRetries.Get(workflowContext); var prompt = Prompt.Get(workflowContext); - var kernelSettings = KernelSettings.LoadSettings(); - var kernelConfig = new KernelConfig(); + //var mockup = Mockup.Get(workflowContext); + var mockup = false; - using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => + string info = ($"#################\nSkill: {skillName}\nFunction: {functionName}\nPrompt: {prompt}\n#################\n\n"); + + if (mockup) { - builder - .SetMinimumLevel(kernelSettings.LogLevel ?? LogLevel.Warning); - }); - /* var memoryStore = new QdrantMemoryStore(new QdrantVectorDbClient("http://qdrant", 1536, port: 6333)); - var embedingGeneration = new AzureTextEmbeddingGeneration(kernelSettings.EmbeddingDeploymentOrModelId, kernelSettings.Endpoint, kernelSettings.ApiKey); - var semanticTextMemory = new SemanticTextMemory(memoryStore, embedingGeneration); - */ - var kernel = new KernelBuilder() - .WithLogger(loggerFactory.CreateLogger()) - .WithAzureChatCompletionService(kernelSettings.DeploymentOrModelId, kernelSettings.Endpoint, kernelSettings.ApiKey, true, kernelSettings.ServiceId, true) - //.WithMemory(semanticTextMemory) - .WithConfiguration(kernelConfig) - .Configure(c => c.SetDefaultHttpRetryConfig(new HttpRetryConfig + workflowContext.SetResult(info); + } + else { - MaxRetryCount = maxRetries, - UseExponentialBackoff = true, - // MinRetryDelay = TimeSpan.FromSeconds(2), - // MaxRetryDelay = TimeSpan.FromSeconds(8), - MaxTotalRetryTime = TimeSpan.FromSeconds(300), - // RetryableStatusCodes = new[] { HttpStatusCode.TooManyRequests, HttpStatusCode.RequestTimeout }, - // RetryableExceptions = new[] { typeof(HttpRequestException) } - })) - .Build(); + var kernelSettings = KernelSettings.LoadSettings(); + var kernelConfig = new KernelConfig(); -/* var interestingMemories = kernel.Memory.SearchAsync("ImportedMemories", prompt, 2); - var wafContext = "Consider the following contextual snippets:"; - await foreach (var memory in interestingMemories) - { - wafContext += $"\n {memory.Metadata.Text}"; - } */ + using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => + { + builder + .SetMinimumLevel(kernelSettings.LogLevel ?? LogLevel.Warning); + }); + /* var memoryStore = new QdrantMemoryStore(new QdrantVectorDbClient("http://qdrant", 1536, port: 6333)); + var embedingGeneration = new AzureTextEmbeddingGeneration(kernelSettings.EmbeddingDeploymentOrModelId, kernelSettings.Endpoint, kernelSettings.ApiKey); + var semanticTextMemory = new SemanticTextMemory(memoryStore, embedingGeneration); + */ + var kernel = new KernelBuilder() + .WithLogger(loggerFactory.CreateLogger()) + .WithAzureChatCompletionService(kernelSettings.DeploymentOrModelId, kernelSettings.Endpoint, kernelSettings.ApiKey, true, kernelSettings.ServiceId, true) + //.WithMemory(semanticTextMemory) + .WithConfiguration(kernelConfig) + .Configure(c => c.SetDefaultHttpRetryConfig(new HttpRetryConfig + { + MaxRetryCount = maxRetries, + UseExponentialBackoff = true, + // MinRetryDelay = TimeSpan.FromSeconds(2), + // MaxRetryDelay = TimeSpan.FromSeconds(8), + MaxTotalRetryTime = TimeSpan.FromSeconds(300), + // RetryableStatusCodes = new[] { HttpStatusCode.TooManyRequests, HttpStatusCode.RequestTimeout }, + // RetryableExceptions = new[] { typeof(HttpRequestException) } + })) + .Build(); - 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 interestingMemories = kernel.Memory.SearchAsync("ImportedMemories", prompt, 2); + var wafContext = "Consider the following contextual snippets:"; + await foreach (var memory in interestingMemories) + { + wafContext += $"\n {memory.Metadata.Text}"; + } */ - var context = new ContextVariables(); - context.Set("input", prompt); - //context.Set("wafContext", wafContext); + 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); - SKContext answer = await kernel.RunAsync(context, function).ConfigureAwait(false); - string result = answer.Result; + var context = new ContextVariables(); + context.Set("input", prompt); + //context.Set("wafContext", wafContext); - //debug output to console - Console.WriteLine($"Skill: {skillName}\nFunction: {functionName}\nPrompt: {prompt}Answer: {result}"); - workflowContext.SetResult(result); + SKContext answer = await kernel.RunAsync(context, function).ConfigureAwait(false); + string result = answer.Result; + + Console.WriteLine(info); + + workflowContext.SetResult(result); + } } } \ No newline at end of file diff --git a/skills/DevLead.cs b/skills/DevLead.cs index 9ef4b92a4..583e024b7 100644 --- a/skills/DevLead.cs +++ b/skills/DevLead.cs @@ -9,7 +9,42 @@ public static class DevLead { For each step or module then break down the steps or subtasks required to complete that step or module. For each subtask write an LLM prompt that would be used to tell a model to write the coee that will accomplish that subtask. If the subtask involves taking action/running commands tell the model to write the script that will run those commands. In each LLM prompt restrict the model from outputting other text that is not in the form of code or code comments. - Please output a JSON data structure with a list of steps and a description of each step, and the steps or subtasks that each requires, and the LLM prompts for each subtask. + Please output a JSON array data structure with a list of steps and a description of each step, and the steps or subtasks that each requires, and the LLM prompts for each subtask. + Example: + [ + { + "step": "Step 1", + "description": "This is the first step", + "subtasks": [ + { + "subtask": "Subtask 1", + "description": "This is the first subtask", + "prompt": "Write the code to do the first subtask" + }, + { + "subtask": "Subtask 2", + "description": "This is the second subtask", + "prompt": "Write the code to do the second subtask" + } + ] + }, + { + "step": "Step 2", + "description": "This is the second step", + "subtasks": [ + { + "subtask": "Subtask 1", + "description": "This is the first subtask", + "prompt": "Write the code to do the first subtask" + }, + { + "subtask": "Subtask 2", + "description": "This is the second subtask", + "prompt": "Write the code to do the second subtask" + } + ] + } + ] Do not output any other text. Input: {{$input}} {{$wafContext}} From 4aac9ef61a66aa66d9d89e47eb6a86c35f246818 Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Fri, 14 Jul 2023 13:52:35 -0700 Subject: [PATCH 13/22] iterating toward the dynamic generation of the elsa activities from the skills. --- Elsa.SemanticKernel/Config/KernelSettings.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Elsa.SemanticKernel/Config/KernelSettings.cs b/Elsa.SemanticKernel/Config/KernelSettings.cs index b514af768..6db087552 100644 --- a/Elsa.SemanticKernel/Config/KernelSettings.cs +++ b/Elsa.SemanticKernel/Config/KernelSettings.cs @@ -4,7 +4,6 @@ using Microsoft.Extensions.Logging; using System.IO; using System; - internal class KernelSettings { public const string DefaultConfigFile = "config/appsettings.json"; @@ -46,7 +45,7 @@ internal class KernelSettings return FromFile(DefaultConfigFile); } - Console.Debug.WriteLine($"Semantic kernel settings '{DefaultConfigFile}' not found, attempting to load configuration from user secrets."); + Console.WriteLine($"Semantic kernel settings '{DefaultConfigFile}' not found, attempting to load configuration from user secrets."); return FromUserSecrets(); } From 23d2e7ab91c1a2a0abeb878ceef340dbf6634b2f Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Fri, 14 Jul 2023 13:57:07 -0700 Subject: [PATCH 14/22] iterating toward dynmamic activities from skills --- .gitignore | 5 +- .../SemanticKernelSkillActivityProvider.cs | 90 +++++++++++++ .../Activities/SemanticKernel.cs | 119 +++++++++++++++--- .../Elsa.SemanticKernel.csproj | 8 +- WorkflowsApp/WorkflowsApp.csproj | 14 +-- cli/Program.cs | 26 ++-- skills/Chat.cs | 2 +- skills/DevLead.cs | 2 +- skills/Developer.cs | 2 +- skills/PM.cs | 2 +- skills/SemanticFunctionConfig.cs | 2 +- skills/skills.csproj | 1 - 12 files changed, 229 insertions(+), 44 deletions(-) create mode 100644 Elsa.SemanticKernel/Activities/ActivityProviders/SemanticKernelSkillActivityProvider.cs diff --git a/.gitignore b/.gitignore index eef1881b8..85fa5e4e2 100644 --- a/.gitignore +++ b/.gitignore @@ -487,4 +487,7 @@ $RECYCLE.BIN/ elsa.sqlite.* # env files -.env \ No newline at end of file +.env + +# ignore local elsa-core src +elsa-core/ \ No newline at end of file diff --git a/Elsa.SemanticKernel/Activities/ActivityProviders/SemanticKernelSkillActivityProvider.cs b/Elsa.SemanticKernel/Activities/ActivityProviders/SemanticKernelSkillActivityProvider.cs new file mode 100644 index 000000000..b84bbd49c --- /dev/null +++ b/Elsa.SemanticKernel/Activities/ActivityProviders/SemanticKernelSkillActivityProvider.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using Elsa; +using Elsa.Expressions.Models; +using Elsa.Extensions; +using Elsa.Workflows.Core; +using Elsa.Workflows.Core.Contracts; +using Elsa.Workflows.Core.Models; +using Elsa.Workflows.Management.Extensions; +using Elsa.Workflows.Core.Attributes; +using Elsa.Workflows.Core.Models; +using Elsa.Expressions.Models; +using Elsa.Extensions; +using Elsa.Http; +using Microsoft.Extensions.Logging; +using Microsoft.SemanticKernel; +using Microsoft.SemanticKernel.Connectors.Memory.Qdrant; +using Microsoft.SemanticKernel.Connectors.AI.OpenAI.TextEmbedding; +using Microsoft.SemanticKernel.Memory; +using Microsoft.SemanticKernel.Orchestration; +using Microsoft.SemanticKernel.Reliability; +using Microsoft.SKDevTeam; + +namespace Elsa.SemanticKernel; + +//

+// Loads the Semantic Kernel skills and then generates activites for each skill +// +public class SemanticKernelActivityProvider : IActivityProvider +{ + private readonly IActivityFactory _activityFactory; + private readonly IActivityDescriber _activityDescriber; + + public SemanticKernelActivityProvider(IActivityFactory activityFactory, IActivityDescriber activityDescriber) + { + _activityFactory = activityFactory; + _activityDescriber = activityDescriber; + } + public async ValueTask> GetDescriptorsAsync(CancellationToken cancellationToken = default) + { + //get a list of skills in the assembly + var skills = await LoadSkillsFromAssemblyAsync("skills"); + var descriptors = new List(); + foreach (var skill in skills) + { + //var descriptor = await CreateActivityDescriptors(skill, cancellationToken); + // descriptors.Add(descriptor); + } + return descriptors; + } + + /// + /// Gets a list of the skills in the assembly + /// + private async Task> LoadSkillsFromAssemblyAsync(string assemblyName) + { + var skills = new List(); + var assembly = Assembly.Load(assemblyName); + //IEnumerable skillTypes = GetTypesInNamespace(assembly, "skills"); + Type[] skillTypes = assembly.GetTypes().ToArray(); + foreach(Type skillType in skillTypes) + { + Console.WriteLine($"Found type: {assembly.FullName}.{skillType.Namespace}.{skillType.Name}"); + if(skillType.Namespace.Equals("Microsoft.SKDevTeam")) + { + skills.Add(skillType.Name); + + Console.WriteLine($"Added skill: {skillType.Name}"); + } + + } + return skills; + } + + + + private IEnumerable GetTypesInNamespace(Assembly assembly, string nameSpace) + { + return + assembly.GetTypes() + .Where(t => String.Equals(t.Namespace, nameSpace, StringComparison.Ordinal)); + } +} + diff --git a/Elsa.SemanticKernel/Activities/SemanticKernel.cs b/Elsa.SemanticKernel/Activities/SemanticKernel.cs index 72f08c15a..3883ffe90 100644 --- a/Elsa.SemanticKernel/Activities/SemanticKernel.cs +++ b/Elsa.SemanticKernel/Activities/SemanticKernel.cs @@ -10,11 +10,21 @@ using Microsoft.SemanticKernel.Connectors.AI.OpenAI.TextEmbedding; using Microsoft.SemanticKernel.Memory; using Microsoft.SemanticKernel.Orchestration; using Microsoft.SemanticKernel.Reliability; -namespace Elsa.SemanticKernel; +using Microsoft.SemanticKernel.SkillDefinition; +using Microsoft.SKDevTeam; + using System; -using System.Text.Json; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Reflection; +using System.Threading; using System.Threading.Tasks; -using skills; + + +namespace Elsa.SemanticKernel; /// /// Invoke a Semantic Kernel skill. @@ -53,11 +63,11 @@ public class SemanticKernelSkill : CodeActivity DefaultValue = "ChatCompletion")] public Input FunctionName { get; set; } -/* [Input( - Description = "Mockup - don't actually call the AI, just output the prompts", - UIHint = InputUIHints.Checkbox, - DefaultValue = false)] - public Input Mockup { get; set; } */ + /* [Input( + Description = "Mockup - don't actually call the AI, just output the prompts", + UIHint = InputUIHints.Checkbox, + DefaultValue = false)] + public Input Mockup { get; set; } */ /// protected override async ValueTask ExecuteAsync(ActivityExecutionContext workflowContext) @@ -116,20 +126,95 @@ public class SemanticKernelSkill : CodeActivity } */ 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 context = new ContextVariables(); - context.Set("input", prompt); + + /* var function = kernel.CreateSemanticFunction(skillConfig.PromptTemplate, skillConfig.Name, skillConfig.SkillName, + skillConfig.Description, skillConfig.MaxTokens, skillConfig.Temperature, + skillConfig.TopP, skillConfig.PPenalty, skillConfig.FPenalty); */ + + var contextVars = new ContextVariables(); + contextVars.Set("input", prompt); + SKContext context = kernel.CreateNewContext(); + + var theSkills = LoadSkillsFromAssemblyAsync("skills", kernel); + var functionsAvailable = context.Skills.GetFunctionsView(); + + var list = new StringBuilder(); + foreach (KeyValuePair> skill in functionsAvailable.SemanticFunctions) + { + Console.WriteLine($"Skill: {skill.Key}"); + foreach (FunctionView func in skill.Value) + { + // Function description + if (func.Description != null) + { + list.AppendLine($"// {func.Description}"); + } + else + { + Console.WriteLine("{0}.{1} is missing a description", func.SkillName, func.Name); + list.AppendLine($"// Function {func.SkillName}.{func.Name}."); + } + + // Function name + list.AppendLine($"{func.SkillName}.{func.Name}"); + + // Function parameters + foreach (var p in func.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()}"); + //context.Set("wafContext", wafContext); - SKContext answer = await kernel.RunAsync(context, function).ConfigureAwait(false); + SKContext answer = await kernel.RunAsync(contextVars, function).ConfigureAwait(false); string result = answer.Result; - - Console.WriteLine(info); - + workflowContext.SetResult(result); } } + /// + /// Gets a list of the skills in the assembly + /// + private IEnumerable LoadSkillsFromAssemblyAsync(string assemblyName, IKernel kernel) + { + var skills = new List(); + var assembly = Assembly.Load(assemblyName); + Type[] skillTypes = assembly.GetTypes().ToArray(); + foreach (Type skillType in skillTypes) + { + if (skillType.Namespace.Equals("Microsoft.SKDevTeam")) + { + skills.Add(skillType.Name); + var functions = skillType.GetFields(); + foreach (var function in functions) + { + string field = function.FieldType.ToString(); + if (field.Equals("Microsoft.SKDevTeam.SemanticFunctionConfig")) + { + var skillConfig = SemanticFunctionConfig.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); + + Console.WriteLine($"SK Added function: {skfunc.SkillName}.{skfunc.Name}"); + } + } + } + } + return skills; + } } \ No newline at end of file diff --git a/Elsa.SemanticKernel/Elsa.SemanticKernel.csproj b/Elsa.SemanticKernel/Elsa.SemanticKernel.csproj index c6f15a6e7..9f6e6c2ee 100644 --- a/Elsa.SemanticKernel/Elsa.SemanticKernel.csproj +++ b/Elsa.SemanticKernel/Elsa.SemanticKernel.csproj @@ -5,11 +5,15 @@ Activities for calling Semantic Kernel SDK - elsa module semantic kerne activities + elsa module semantic kernel activities - + + + + + diff --git a/WorkflowsApp/WorkflowsApp.csproj b/WorkflowsApp/WorkflowsApp.csproj index d5e4e63e7..240d57ef4 100644 --- a/WorkflowsApp/WorkflowsApp.csproj +++ b/WorkflowsApp/WorkflowsApp.csproj @@ -7,13 +7,13 @@ - - - - - - -