mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
Orleans improvements (#6)
* namespace fixes + remove skills definitios from Actors project * add waf context to actors * deploy to Azure WIP * add bicep for gh-flow and cosmos * azure deploy fixes * azure deploy WIP
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
using System.CommandLine;
|
||||
using System.Text.Json;
|
||||
using Microsoft.AI.DevTeam.Skills;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SemanticKernel;
|
||||
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 Microsoft.SKDevTeam;
|
||||
|
||||
|
||||
class Program
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Testcontainers" Version="3.2.0" />
|
||||
<ProjectReference Include="..\..\libs\skills\skills.csproj" />
|
||||
<ProjectReference Include="..\..\libs\Microsoft.AI.DevTeam.Skills\Microsoft.AI.DevTeam.Skills.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.AI.DevTeam.Skills;
|
||||
using Microsoft.Azure.Functions.Worker;
|
||||
using Microsoft.DurableTask;
|
||||
using Microsoft.SKDevTeam;
|
||||
|
||||
namespace SK.DevTeam
|
||||
{
|
||||
@@ -128,7 +128,7 @@ namespace SK.DevTeam
|
||||
|
||||
if (request.RunInSandbox)
|
||||
{
|
||||
var newRequest = new RunInSandboxRequest
|
||||
var newRequest = new RunInSandboxRequest
|
||||
{
|
||||
PrRequest = request,
|
||||
SanboxOrchestrationId = context.InstanceId
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Net.Http.Json;
|
||||
using System.Text;
|
||||
using Microsoft.AI.DevTeam.Skills;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Orchestration;
|
||||
@@ -9,7 +10,6 @@ using Octokit.Webhooks.Events;
|
||||
using Octokit.Webhooks.Events.IssueComment;
|
||||
using Octokit.Webhooks.Events.Issues;
|
||||
using Octokit.Webhooks.Models;
|
||||
using Microsoft.SKDevTeam;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2007: Do not directly await a Task", Justification = "Durable functions")]
|
||||
public class SKWebHookEventProcessor : WebhookEventProcessor
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.16.0-beta.1" />
|
||||
<PackageReference Include="Azure.Data.Tables" Version="12.8.1" />
|
||||
<PackageReference Include="Azure.Identity" Version="1.10.0-beta.1" />
|
||||
<ProjectReference Include="..\..\libs\skills\skills.csproj" />
|
||||
<ProjectReference Include="..\..\libs\Microsoft.AI.DevTeam.Skills\Microsoft.AI.DevTeam.Skills.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
23
src/apps/gh-flow/Dockerfile
Normal file
23
src/apps/gh-flow/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 5274
|
||||
EXPOSE 11111
|
||||
EXPOSE 30000
|
||||
|
||||
ENV ASPNETCORE_URLS=http://+:5274
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||
ARG configuration=Release
|
||||
COPY . .
|
||||
RUN dotnet restore "src/apps/gh-flow/gh-flow.csproj"
|
||||
WORKDIR "/src/apps/gh-flow"
|
||||
RUN dotnet build "gh-flow.csproj" -c $configuration -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
ARG configuration=Release
|
||||
RUN dotnet publish "gh-flow.csproj" -c $configuration -o /app/publish
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "gh-flow.dll"]
|
||||
@@ -1,12 +1,13 @@
|
||||
using System.Text.Json;
|
||||
using Microsoft.AI.DevTeam;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Connectors.AI.OpenAI.TextEmbedding;
|
||||
using Microsoft.SemanticKernel.Connectors.Memory.Qdrant;
|
||||
using Microsoft.SemanticKernel.Memory;
|
||||
using MS.AI.DevTeam;
|
||||
using Octokit.Webhooks;
|
||||
using Octokit.Webhooks.AspNetCore;
|
||||
using Orleans.Configuration;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddSingleton<WebhookEventProcessor, GithubWebHookProcessor>();
|
||||
@@ -49,29 +50,73 @@ builder.Services.AddSingleton<IManageGithub, GithubService>();
|
||||
|
||||
builder.Host.UseOrleans(siloBuilder =>
|
||||
{
|
||||
var connectionString = builder.Configuration.GetValue<string>("AzureOptions:CosmosConnectionString");
|
||||
siloBuilder.UseCosmosReminderService( o =>
|
||||
|
||||
if (builder.Environment.IsDevelopment())
|
||||
{
|
||||
o.ConfigureCosmosClient(connectionString);
|
||||
o.ContainerName = "devteam";
|
||||
o.DatabaseName = "reminders";
|
||||
o.IsResourceCreationEnabled = true;
|
||||
});
|
||||
siloBuilder.AddCosmosGrainStorage(
|
||||
name: "messages",
|
||||
configureOptions: o =>
|
||||
var connectionString = builder.Configuration.GetValue<string>("AzureOptions:CosmosConnectionString");
|
||||
siloBuilder.UseCosmosReminderService( o =>
|
||||
{
|
||||
o.ConfigureCosmosClient(connectionString);
|
||||
o.ContainerName = "devteam";
|
||||
o.DatabaseName = "persistence";
|
||||
o.IsResourceCreationEnabled = true;
|
||||
o.ConfigureCosmosClient(connectionString);
|
||||
o.ContainerName = "reminders";
|
||||
o.DatabaseName = "devteam";
|
||||
o.IsResourceCreationEnabled = true;
|
||||
});
|
||||
siloBuilder.UseLocalhostClustering();
|
||||
siloBuilder.AddCosmosGrainStorage(
|
||||
name: "messages",
|
||||
configureOptions: o =>
|
||||
{
|
||||
o.ConfigureCosmosClient(connectionString);
|
||||
o.ContainerName = "persistence";
|
||||
o.DatabaseName = "devteam";
|
||||
o.IsResourceCreationEnabled = true;
|
||||
});
|
||||
siloBuilder.UseLocalhostClustering();
|
||||
}
|
||||
else
|
||||
{
|
||||
var cosmosDbconnectionString = builder.Configuration.GetValue<string>("AzureOptions:CosmosConnectionString");
|
||||
siloBuilder.Configure<ClusterOptions>(options =>
|
||||
{
|
||||
options.ClusterId = "ai-dev-cluster";
|
||||
options.ServiceId = "ai-dev-cluster";
|
||||
});
|
||||
siloBuilder.Configure<SiloMessagingOptions>(options =>
|
||||
{
|
||||
options.ResponseTimeout = TimeSpan.FromMinutes(3);
|
||||
options.SystemResponseTimeout = TimeSpan.FromMinutes(3);
|
||||
});
|
||||
siloBuilder.Configure<ClientMessagingOptions>(options =>
|
||||
{
|
||||
options.ResponseTimeout = TimeSpan.FromMinutes(3);
|
||||
});
|
||||
siloBuilder.UseCosmosClustering( o =>
|
||||
{
|
||||
o.ConfigureCosmosClient(cosmosDbconnectionString);
|
||||
o.ContainerName = "devteam";
|
||||
o.DatabaseName = "clustering";
|
||||
o.IsResourceCreationEnabled = true;
|
||||
});
|
||||
|
||||
siloBuilder.UseCosmosReminderService( o =>
|
||||
{
|
||||
o.ConfigureCosmosClient(cosmosDbconnectionString);
|
||||
o.ContainerName = "devteam";
|
||||
o.DatabaseName = "reminders";
|
||||
o.IsResourceCreationEnabled = true;
|
||||
});
|
||||
siloBuilder.AddCosmosGrainStorage(
|
||||
name: "messages",
|
||||
configureOptions: o =>
|
||||
{
|
||||
o.ConfigureCosmosClient(cosmosDbconnectionString);
|
||||
o.ContainerName = "devteam";
|
||||
o.DatabaseName = "persistence";
|
||||
o.IsResourceCreationEnabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
builder.Services.Configure<JsonSerializerOptions>(options =>
|
||||
{
|
||||
options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MS.AI.DevTeam;
|
||||
using Microsoft.AI.DevTeam;
|
||||
using Microsoft.AI.DevTeam.Skills;
|
||||
using Octokit.Webhooks;
|
||||
using Octokit.Webhooks.Events;
|
||||
using Octokit.Webhooks.Events.IssueComment;
|
||||
@@ -71,7 +72,7 @@ public sealed class GithubWebHookProcessor : WebhookEventProcessor
|
||||
{
|
||||
await HandleClosingDevPlan(issueNumber, suffix, org, repo);
|
||||
}
|
||||
else if (skillName == nameof(Dev) && functionName == nameof(Dev.Implement))
|
||||
else if (skillName == nameof(Developer) && functionName == nameof(Developer.Implement))
|
||||
{
|
||||
await HandleClosingDevImplement(issueNumber, suffix, org, repo);
|
||||
}
|
||||
@@ -206,7 +207,7 @@ public sealed class GithubWebHookProcessor : WebhookEventProcessor
|
||||
Content = plan
|
||||
});
|
||||
}
|
||||
else if (skillName == nameof(Dev) && functionName == nameof(Dev.Implement))
|
||||
else if (skillName == nameof(Developer) && functionName == nameof(Developer.Implement))
|
||||
{
|
||||
var dev = _grains.GetGrain<IDevelopCode>(issueNumber, suffix);
|
||||
var code = await dev.GenerateCode(input);
|
||||
|
||||
41
src/apps/gh-flow/appsettings.template.json
Normal file
41
src/apps/gh-flow/appsettings.template.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"ApplicationInsights": {
|
||||
"ConnectionString": ""
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"SANDBOX_IMAGE" : "mcr.microsoft.com/dotnet/sdk:7.0",
|
||||
"GithubOptions" : {
|
||||
"AppKey": "",
|
||||
"AppId": "",
|
||||
"InstallationId": ""
|
||||
},
|
||||
"AzureOptions" : {
|
||||
"SubscriptionId":"",
|
||||
"Location":"",
|
||||
"ContainerInstancesResourceGroup":"",
|
||||
"FilesShareName":"",
|
||||
"FilesAccountName":"",
|
||||
"FilesAccountKey":"",
|
||||
"CosmosConnectionString":"",
|
||||
"SandboxImage" : "mcr.microsoft.com/dotnet/sdk:7.0",
|
||||
"ManagedIdentity": ""
|
||||
},
|
||||
"OpenAIOptions" : {
|
||||
"ServiceType":"AzureOpenAI",
|
||||
"ServiceId":"",
|
||||
"DeploymentOrModelId":"",
|
||||
"EmbeddingDeploymentOrModelId":"",
|
||||
"Endpoint":"",
|
||||
"ApiKey":""
|
||||
},
|
||||
"QdrantOptions" : {
|
||||
"Endpoint" : "http://qdrant:6333",
|
||||
"VectorSize" : "1536"
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\libs\MS.AI.DevTeam\MS.AI.DevTeam.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Octokit.Webhooks.AspNetCore" Version="2.0.3" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Microsoft.Orleans.Server" Version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.Orleans.Persistence.Cosmos" Version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
|
||||
<PackageReference Include="Microsoft.Orleans.Reminders.Cosmos" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\libs\Microsoft.AI.DevTeam\Microsoft.AI.DevTeam.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
|
||||
<UserSecretsId>c073c86e-8483-4956-942f-331fd09172d4</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Octokit.Webhooks.AspNetCore" Version="2.0.3" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Microsoft.Orleans.Server" Version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.Orleans.Persistence.Cosmos" Version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.Orleans.Clustering.Cosmos" Version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
|
||||
<PackageReference Include="Microsoft.Orleans.Reminders.Cosmos" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,32 +1,18 @@
|
||||
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.AI.DevTeam.Skills;
|
||||
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.SemanticKernel.SkillDefinition;
|
||||
using Microsoft.SKDevTeam;
|
||||
|
||||
namespace Elsa.SemanticKernel;
|
||||
|
||||
|
||||
@@ -5,23 +5,16 @@ using Elsa.Workflows.Core.Models;
|
||||
using JetBrains.Annotations;
|
||||
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.SemanticKernel.SkillDefinition;
|
||||
using Microsoft.SKDevTeam;
|
||||
|
||||
using System;
|
||||
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 Microsoft.AI.DevTeam.Skills;
|
||||
|
||||
|
||||
namespace Elsa.SemanticKernel;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<PackageReference Include="AspNetCore.Authentication.ApiKey" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="0.24.230918.1-preview" />
|
||||
<ProjectReference Include="..\skills\skills.csproj" />
|
||||
<ProjectReference Include="..\Microsoft.AI.DevTeam.Skills\Microsoft.AI.DevTeam.Skills.csproj" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public static class DevLead {
|
||||
public static SemanticFunctionConfig Plan = new SemanticFunctionConfig
|
||||
{
|
||||
PromptTemplate = """
|
||||
You are a Dev Lead for an application team, building the application described below.
|
||||
Please break down the steps and modules required to develop the complete application, describe each step in detail.
|
||||
Make prescriptive architecture, language, and frameowrk choices, do not provide a range of choices.
|
||||
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 array data structure, in the precise schema shown below, 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:
|
||||
{
|
||||
"steps": [
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Do not output any other text.
|
||||
Input: {{$input}}
|
||||
""",
|
||||
Name = nameof(Plan),
|
||||
SkillName = nameof(DevLead),
|
||||
Description = "From a simple description of an application output a development plan for building the application.",
|
||||
MaxTokens = 6500,
|
||||
Temperature = 0.0,
|
||||
TopP = 0.0,
|
||||
PPenalty = 0.0,
|
||||
FPenalty = 0.0
|
||||
};
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public static class Dev {
|
||||
public static SemanticFunctionConfig Implement = new SemanticFunctionConfig
|
||||
{
|
||||
PromptTemplate = """
|
||||
You are a Developer for an application.
|
||||
Please output the code required to accomplish the task assigned to you below and wrap it in a bash script that creates the 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}}
|
||||
""",
|
||||
Name = nameof(Implement),
|
||||
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
|
||||
};
|
||||
|
||||
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}}
|
||||
""",
|
||||
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
|
||||
};
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
|
||||
public static class PM
|
||||
{
|
||||
public static SemanticFunctionConfig Readme = new SemanticFunctionConfig
|
||||
{
|
||||
PromptTemplate = """
|
||||
You are a program manager on a software development team. You are working on an app described below.
|
||||
Based on the input below, and any dialog or other context, please output a raw README.MD markdown file documenting the main features of the app and the architecture or code organization.
|
||||
Do not describe how to create the application.
|
||||
Write the README as if it were documenting the features and architecture of the application. You may include instructions for how to run the application.
|
||||
Input: {{$input}}
|
||||
""",
|
||||
Name = nameof(Readme),
|
||||
SkillName = nameof(PM),
|
||||
Description = "From a simple description output a README.md file for a GitHub repository.",
|
||||
MaxTokens = 6500,
|
||||
Temperature = 0.0,
|
||||
TopP = 0.0,
|
||||
PPenalty = 0.0,
|
||||
FPenalty = 0.0
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Microsoft.SKDevTeam;
|
||||
namespace Microsoft.AI.DevTeam.Skills;
|
||||
public static class Chat
|
||||
{
|
||||
public static SemanticFunctionConfig ChatCompletion = new SemanticFunctionConfig
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
namespace Microsoft.SKDevTeam;
|
||||
namespace Microsoft.AI.DevTeam.Skills;
|
||||
public static class CodeExplainer {
|
||||
public static SemanticFunctionConfig Explain = new SemanticFunctionConfig
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Microsoft.SKDevTeam;
|
||||
namespace Microsoft.AI.DevTeam.Skills;
|
||||
public static class DevLead {
|
||||
public static SemanticFunctionConfig Plan = new SemanticFunctionConfig
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
namespace Microsoft.SKDevTeam;
|
||||
namespace Microsoft.AI.DevTeam.Skills;
|
||||
public static class Developer {
|
||||
public static SemanticFunctionConfig Implement = new SemanticFunctionConfig
|
||||
{
|
||||
@@ -7,6 +7,6 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.18.230725.3-preview" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Microsoft.SKDevTeam;
|
||||
namespace Microsoft.AI.DevTeam.Skills;
|
||||
public static class PM
|
||||
{
|
||||
public static SemanticFunctionConfig BootstrapProject = new SemanticFunctionConfig
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.SkillDefinition;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam.Skills;
|
||||
|
||||
public class SemanticFunctionConfig
|
||||
{
|
||||
@@ -17,11 +17,13 @@ public class SemanticFunctionConfig
|
||||
public static SemanticFunctionConfig ForSkillAndFunction(string skillName, string functionName) =>
|
||||
(skillName, functionName) switch
|
||||
{
|
||||
(nameof(Chat), nameof(Chat.ChatCompletion)) => Chat.ChatCompletion,
|
||||
(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(Dev), nameof(Dev.Implement)) => Dev.Implement,
|
||||
// (nameof(Developer), nameof(Developer.Improve)) => Developer.Improve,
|
||||
(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}")
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public class Architect : SemanticPersona, IArchitectSolutions
|
||||
{
|
||||
@@ -1,7 +1,8 @@
|
||||
using Microsoft.AI.DevTeam.Skills;
|
||||
using Orleans.Concurrency;
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public class Conductor : Grain, IOrchestrateWorkflows
|
||||
{
|
||||
@@ -66,7 +67,7 @@ public class Conductor : Grain, IOrchestrateWorkflows
|
||||
{
|
||||
var issue = await _ghService.CreateIssue(new CreateIssueRequest
|
||||
{
|
||||
Label = $"{nameof(Dev)}.{nameof(Dev.Implement)}",
|
||||
Label = $"{nameof(Developer)}.{nameof(Developer.Implement)}",
|
||||
Org = org,
|
||||
Repo = repo,
|
||||
Input = prompt,
|
||||
@@ -1,6 +1,6 @@
|
||||
using Orleans.Concurrency;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public interface IOrchestrateWorkflows : IGrainWithIntegerCompoundKey
|
||||
{
|
||||
@@ -1,9 +1,10 @@
|
||||
using Microsoft.AI.DevTeam.Skills;
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Orchestration;
|
||||
using Orleans.Runtime;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
public class DeveloperLead : SemanticPersona, ILeadDevelopment
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
@@ -31,6 +32,7 @@ public class DeveloperLead : SemanticPersona, ILeadDevelopment
|
||||
Order = _state.State.History.Count + 1,
|
||||
UserType = ChatUserType.User
|
||||
});
|
||||
await AddWafContext(_kernel, ask, context);
|
||||
context.Set("input", ask);
|
||||
|
||||
var result = await _kernel.RunAsync(context, function);
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public interface ILeadDevelopment: IGrainWithIntegerCompoundKey, IChatHistory
|
||||
{
|
||||
@@ -1,43 +1,49 @@
|
||||
using Microsoft.AI.DevTeam.Skills;
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Orchestration;
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public class Developer : SemanticPersona, IDevelopCode
|
||||
public class Dev : SemanticPersona, IDevelopCode
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
protected override string MemorySegment => "dev-memory";
|
||||
|
||||
public Developer(IKernel kernel, [PersistentState("state", "messages")]IPersistentState<ChatHistory> state) : base(state)
|
||||
public Dev(IKernel kernel, [PersistentState("state", "messages")]IPersistentState<ChatHistory> state) : base(state)
|
||||
{
|
||||
_kernel = kernel;
|
||||
}
|
||||
|
||||
public async Task<string> GenerateCode(string ask)
|
||||
{
|
||||
var function = _kernel.LoadFunction(nameof(Dev), nameof(Dev.Implement));
|
||||
var function = _kernel.LoadFunction(nameof(Developer), nameof(Developer.Implement));
|
||||
var context = new ContextVariables();
|
||||
if (_state.State.History == null) _state.State.History = new List<ChatHistoryItem>();
|
||||
_state.State.History.Add(new ChatHistoryItem{
|
||||
_state.State.History.Add(new ChatHistoryItem
|
||||
{
|
||||
Message = ask,
|
||||
Order = _state.State.History.Count+1,
|
||||
Order = _state.State.History.Count + 1,
|
||||
UserType = ChatUserType.User
|
||||
});
|
||||
await AddWafContext(_kernel, ask, context);
|
||||
context.Set("input", ask);
|
||||
|
||||
var result = await _kernel.RunAsync(context, function);
|
||||
var resultMessage = result.ToString();
|
||||
_state.State.History.Add(new ChatHistoryItem{
|
||||
_state.State.History.Add(new ChatHistoryItem
|
||||
{
|
||||
Message = resultMessage,
|
||||
Order = _state.State.History.Count+1,
|
||||
Order = _state.State.History.Count + 1,
|
||||
UserType = ChatUserType.Agent
|
||||
});
|
||||
await _state.WriteStateAsync();
|
||||
|
||||
|
||||
return resultMessage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Task<string> ReviewPlan(string plan)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public interface IDevelopCode : IGrainWithIntegerCompoundKey, IChatHistory
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public interface ILookupMetadata : IGrainWithStringKey
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public class Lookup : Grain, ILookupMetadata
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public interface IManageProduct : IGrainWithIntegerCompoundKey, IChatHistory
|
||||
{
|
||||
@@ -1,8 +1,9 @@
|
||||
using Microsoft.AI.DevTeam.Skills;
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Orchestration;
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
public class ProductManager : SemanticPersona, IManageProduct
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
@@ -24,6 +25,7 @@ public class ProductManager : SemanticPersona, IManageProduct
|
||||
Order = _state.State.History.Count + 1,
|
||||
UserType = ChatUserType.User
|
||||
});
|
||||
await AddWafContext(_kernel, ask, context);
|
||||
context.Set("input", ask);
|
||||
|
||||
var result = await _kernel.RunAsync(context, function);
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public interface IManageSandbox : IGrainWithIntegerCompoundKey
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace MS.AI.DevTeam;
|
||||
using Orleans.Runtime;
|
||||
using Orleans.Runtime;
|
||||
using Orleans.Timers;
|
||||
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
public class Sandbox : Grain, IManageSandbox, IRemindable
|
||||
{
|
||||
private const string ReminderName = "SandboxRunReminder";
|
||||
@@ -1,5 +1,9 @@
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Orchestration;
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public abstract class SemanticPersona : Grain, IChatHistory
|
||||
{
|
||||
public SemanticPersona(
|
||||
@@ -15,6 +19,18 @@ public abstract class SemanticPersona : Grain, IChatHistory
|
||||
{
|
||||
return _state.State.History.Last().Message;
|
||||
}
|
||||
|
||||
protected async Task AddWafContext(IKernel kernel, string ask, ContextVariables context)
|
||||
{
|
||||
var interestingMemories = kernel.Memory.SearchAsync("waf-pages", ask, 2);
|
||||
var wafContext = "Consider the following architectural guidelines:";
|
||||
await foreach (var memory in interestingMemories)
|
||||
{
|
||||
wafContext += $"\n {memory.Metadata.Text}";
|
||||
}
|
||||
|
||||
context.Set("wafContext", wafContext);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IChatHistory
|
||||
@@ -1,5 +1,7 @@
|
||||
using Orleans.Runtime;
|
||||
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public class Tester : SemanticPersona, ITestCode
|
||||
{
|
||||
public Tester(
|
||||
@@ -19,4 +19,8 @@
|
||||
<PackageReference Include="Azure.Identity" Version="1.10.0-beta.1" />
|
||||
<PackageReference Include="Microsoft.Orleans.Reminders" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\libs\Microsoft.AI.DevTeam.Skills\Microsoft.AI.DevTeam.Skills.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -8,4 +8,5 @@ public class AzureOptions
|
||||
public string FilesAccountKey { get; set; }
|
||||
public string CosmosConnectionString { get; set; }
|
||||
public string SandboxImage { get; set; }
|
||||
public string ManagedIdentity { get; set; }
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using Azure.Storage.Files.Shares;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public class AzureService : IManageAzure
|
||||
{
|
||||
@@ -46,7 +46,10 @@ public class AzureService : IManageAzure
|
||||
|
||||
public async Task RunInSandbox(SandboxRequest request)
|
||||
{
|
||||
var client = new ArmClient(new DefaultAzureCredential());
|
||||
var client = string.IsNullOrEmpty(_azSettings.ManagedIdentity) ?
|
||||
new ArmClient(new AzureCliCredential())
|
||||
: new ArmClient(new ManagedIdentityCredential(_azSettings.ManagedIdentity));
|
||||
|
||||
var runId = $"sk-sandbox-{request.Org}-{request.Repo}-{request.ParentIssueNumber}-{request.IssueNumber}";
|
||||
var resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(_azSettings.SubscriptionId, _azSettings.ContainerInstancesResourceGroup);
|
||||
var resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using Octokit;
|
||||
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
public class GithubAuthService
|
||||
{
|
||||
private readonly GithubOptions _githubSettings;
|
||||
@@ -6,7 +6,7 @@ using Octokit;
|
||||
using Octokit.Helpers;
|
||||
|
||||
|
||||
namespace MS.AI.DevTeam;
|
||||
namespace Microsoft.AI.DevTeam;
|
||||
|
||||
public class GithubService : IManageGithub
|
||||
{
|
||||
@@ -1,26 +0,0 @@
|
||||
namespace Microsoft.SKDevTeam;
|
||||
|
||||
public class SemanticFunctionConfig
|
||||
{
|
||||
public string PromptTemplate { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string SkillName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public int MaxTokens { get; set; }
|
||||
public double Temperature { get; set; }
|
||||
public double TopP { get; set; }
|
||||
public double PPenalty { get; set; }
|
||||
public double FPenalty { get; set; }
|
||||
public static SemanticFunctionConfig ForSkillAndFunction(string skillName, string functionName) =>
|
||||
(skillName, functionName) switch
|
||||
{
|
||||
(nameof(Chat), nameof(Chat.ChatCompletion)) => Chat.ChatCompletion,
|
||||
(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}")
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user