mirror of https://github.com/microsoft/autogen.git
Compare commits
32 Commits
32dec074ef
...
39d79b0064
Author | SHA1 | Date |
---|---|---|
Kosta Petan | 39d79b0064 | |
Hussein Mozannar | 10987685b9 | |
Hussein Mozannar | 8603317537 | |
Gerardo Moreno | eca8a95c61 | |
Reuben Bond | f40336fda1 | |
Eric Zhu | 16e64c4c10 | |
David Luong | f46e52e6ff | |
Xiaoyun Zhang | 5e0b677acc | |
Eric Zhu | 4e5f3ababe | |
Eric Zhu | 4fec22ddc5 | |
Reuben Bond | 7d1857dae6 | |
Eric Zhu | 27ea99a485 | |
Eric Zhu | ca7caa779d | |
Reuben Bond | e9c16fe22e | |
Reuben Bond | a4901f3ba8 | |
Eric Zhu | c3b2597e12 | |
Eric Zhu | 173acc6638 | |
Eric Zhu | 369ffb511b | |
Eric Zhu | cff7d842a6 | |
Mohammad Mazraeh | 4023454c58 | |
Rohan Thacker | 3c63f6f3ef | |
Xiaoyun Zhang | 6bea055b26 | |
Eric Zhu | 3d51ab76ae | |
Xiaoyun Zhang | e63fd17ed5 | |
Ryan Sweet | 51cd5b8d1f | |
Eric Zhu | 4a49844996 | |
Victor Dibia | 75b00e76e1 | |
Ryan Sweet | 0f4dd0cc6d | |
Anthony Uphof | 87bd1de396 | |
Eric Zhu | bd9c371605 | |
Gerardo Moreno | 93733dbd65 | |
Eric Zhu | eb4b1f856e |
|
@ -33,10 +33,8 @@
|
|||
*.tsx text
|
||||
*.xml text
|
||||
*.xhtml text diff=html
|
||||
|
||||
# Docker
|
||||
Dockerfile text eol=lf
|
||||
|
||||
# Documentation
|
||||
*.ipynb text
|
||||
*.markdown text diff=markdown eol=lf
|
||||
|
@ -62,7 +60,6 @@ NEWS text eol=lf
|
|||
readme text eol=lf
|
||||
*README* text eol=lf
|
||||
TODO text
|
||||
|
||||
# Configs
|
||||
*.cnf text eol=lf
|
||||
*.conf text eol=lf
|
||||
|
@ -84,8 +81,9 @@ yarn.lock text -diff
|
|||
browserslist text
|
||||
Makefile text eol=lf
|
||||
makefile text eol=lf
|
||||
|
||||
# Images
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
||||
python/packages/autogen-magentic-one/imgs/autogen-magentic-one-example.png filter=lfs diff=lfs merge=lfs -text
|
||||
python/packages/autogen-magentic-one/imgs/autogen-magentic-one-agents.png filter=lfs diff=lfs merge=lfs -text
|
||||
|
|
|
@ -35,6 +35,7 @@ jobs:
|
|||
{ ref: "v0.4.0.dev0", dest-dir: "0.4.0.dev0" },
|
||||
{ ref: "v0.4.0.dev1", dest-dir: "0.4.0.dev1" },
|
||||
{ ref: "v0.4.0.dev2", dest-dir: "0.4.0.dev2" },
|
||||
{ ref: "v0.4.0.dev3", dest-dir: "0.4.0.dev3" },
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
24
README.md
24
README.md
|
@ -101,7 +101,7 @@ We look forward to your contributions!
|
|||
First install the packages:
|
||||
|
||||
```bash
|
||||
pip install autogen-agentchat==0.4.0.dev2 autogen-ext==0.4.0.dev2
|
||||
pip install 'autogen-agentchat==0.4.0.dev3' 'autogen-ext[docker]==0.4.0.dev3'
|
||||
```
|
||||
|
||||
The following code uses code execution, you need to have [Docker installed](https://docs.docker.com/engine/install/)
|
||||
|
@ -109,17 +109,11 @@ and running on your machine.
|
|||
|
||||
```python
|
||||
import asyncio
|
||||
import logging
|
||||
from autogen_agentchat import EVENT_LOGGER_NAME
|
||||
from autogen_agentchat.agents import CodeExecutorAgent, CodingAssistantAgent
|
||||
from autogen_agentchat.logging import ConsoleLogHandler
|
||||
from autogen_agentchat.teams import RoundRobinGroupChat, StopMessageTermination
|
||||
from autogen_ext.code_executor.docker_executor import DockerCommandLineCodeExecutor
|
||||
from autogen_ext.models import OpenAIChatCompletionClient
|
||||
|
||||
logger = logging.getLogger(EVENT_LOGGER_NAME)
|
||||
logger.addHandler(ConsoleLogHandler())
|
||||
logger.setLevel(logging.INFO)
|
||||
from autogen_agentchat.agents import CodeExecutorAgent, CodingAssistantAgent
|
||||
from autogen_agentchat.teams import RoundRobinGroupChat
|
||||
from autogen_agentchat.task import TextMentionTermination
|
||||
|
||||
async def main() -> None:
|
||||
async with DockerCommandLineCodeExecutor(work_dir="coding") as code_executor:
|
||||
|
@ -127,11 +121,13 @@ async def main() -> None:
|
|||
coding_assistant_agent = CodingAssistantAgent(
|
||||
"coding_assistant", model_client=OpenAIChatCompletionClient(model="gpt-4o", api_key="YOUR_API_KEY")
|
||||
)
|
||||
group_chat = RoundRobinGroupChat([coding_assistant_agent, code_executor_agent])
|
||||
result = await group_chat.run(
|
||||
task="Create a plot of NVDIA and TSLA stock returns YTD from 2024-01-01 and save it to 'nvidia_tesla_2024_ytd.png'.",
|
||||
termination_condition=StopMessageTermination(),
|
||||
termination = TextMentionTermination("TERMINATE")
|
||||
group_chat = RoundRobinGroupChat([coding_assistant_agent, code_executor_agent], termination_condition=termination)
|
||||
stream = group_chat.run_stream(
|
||||
"Create a plot of NVDIA and TSLA stock returns YTD from 2024-01-01 and save it to 'nvidia_tesla_2024_ytd.png'."
|
||||
)
|
||||
async for message in stream:
|
||||
print(message)
|
||||
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
|
|
@ -21,7 +21,12 @@
|
|||
{
|
||||
"name": "0.4.0.dev2",
|
||||
"version": "0.4.0.dev2",
|
||||
"url": "/autogen/0.4.0.dev2/",
|
||||
"url": "/autogen/0.4.0.dev2/"
|
||||
},
|
||||
{
|
||||
"name": "0.4.0.dev3",
|
||||
"version": "0.4.0.dev3",
|
||||
"url": "/autogen/0.4.0.dev3/",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
|
|
|
@ -193,10 +193,6 @@ csharp_using_directive_placement = outside_namespace:error
|
|||
csharp_prefer_static_local_function = true:warning
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
|
||||
|
||||
# Header template
|
||||
file_header_template = Copyright (c) Microsoft Corporation. All rights reserved.\n{fileName}
|
||||
dotnet_diagnostic.IDE0073.severity = error
|
||||
|
||||
# enable format error
|
||||
dotnet_diagnostic.IDE0055.severity = error
|
||||
|
||||
|
@ -221,13 +217,14 @@ dotnet_diagnostic.IDE0161.severity = warning # Use file-scoped namespace
|
|||
|
||||
csharp_style_var_elsewhere = true:suggestion # Prefer 'var' everywhere
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
csharp_style_namespace_declarations = block_scoped:silent
|
||||
csharp_style_namespace_declarations = file_scoped:warning
|
||||
csharp_style_prefer_method_group_conversion = true:silent
|
||||
csharp_style_prefer_top_level_statements = true:silent
|
||||
csharp_style_prefer_primary_constructors = true:suggestion
|
||||
csharp_style_expression_bodied_lambdas = true:silent
|
||||
csharp_style_prefer_local_over_anonymous_function = true:suggestion
|
||||
dotnet_diagnostic.CA2016.severity = suggestion
|
||||
csharp_prefer_static_anonymous_function = true:suggestion
|
||||
|
||||
# disable check for generated code
|
||||
[*.generated.cs]
|
||||
|
@ -556,8 +553,8 @@ dotnet_diagnostic.IDE0060.severity = warning
|
|||
dotnet_diagnostic.IDE0062.severity = warning
|
||||
|
||||
# IDE0073: File header
|
||||
dotnet_diagnostic.IDE0073.severity = suggestion
|
||||
file_header_template = Copyright (c) Microsoft. All rights reserved.
|
||||
dotnet_diagnostic.IDE0073.severity = warning
|
||||
file_header_template = Copyright (c) Microsoft Corporation. All rights reserved.\n{fileName}
|
||||
|
||||
# IDE1006: Required naming style
|
||||
dotnet_diagnostic.IDE1006.severity = warning
|
||||
|
@ -697,6 +694,7 @@ dotnet_style_prefer_compound_assignment = true:suggestion
|
|||
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
|
||||
dotnet_style_namespace_match_folder = true:suggestion
|
||||
dotnet_style_qualification_for_method = false:silent
|
||||
|
||||
[**/*.g.cs]
|
||||
generated_code = true
|
||||
|
|
|
@ -37,9 +37,6 @@ bld/
|
|||
# vs code cache
|
||||
.vscode/
|
||||
|
||||
# Properties
|
||||
Properties/
|
||||
|
||||
artifacts/
|
||||
output/
|
||||
|
||||
|
@ -56,8 +53,6 @@ bld/
|
|||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
appsettings.json
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
|
|
|
@ -68,7 +68,13 @@ EndProject
|
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{243E768F-EA7D-4AF1-B625-0398440BB1AB}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
.gitattributes = .gitattributes
|
||||
.gitignore = .gitignore
|
||||
Directory.Build.props = Directory.Build.props
|
||||
Directory.Build.targets = Directory.Build.targets
|
||||
Directory.Packages.props = Directory.Packages.props
|
||||
global.json = global.json
|
||||
NuGet.config = NuGet.config
|
||||
spelling.dic = spelling.dic
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
@ -122,6 +128,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloAgent", "samples\Hello
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIModelClientHostingExtensions", "src\Microsoft.AutoGen\Extensions\AIModelClientHostingExtensions\AIModelClientHostingExtensions.csproj", "{97550E87-48C6-4EBF-85E1-413ABAE9DBFD}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AutoGen.Agents.Tests", "Microsoft.AutoGen.Agents.Tests\Microsoft.AutoGen.Agents.Tests.csproj", "{CF4C92BD-28AE-4B8F-B173-601004AEC9BF}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{686480D7-8FEC-4ED3-9C5D-CEBE1057A7ED}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloAgentState", "samples\Hello\HelloAgentState\HelloAgentState.csproj", "{64EF61E7-00A6-4E5E-9808-62E10993A0E5}"
|
||||
|
@ -348,6 +356,10 @@ Global
|
|||
{97550E87-48C6-4EBF-85E1-413ABAE9DBFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{97550E87-48C6-4EBF-85E1-413ABAE9DBFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{97550E87-48C6-4EBF-85E1-413ABAE9DBFD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CF4C92BD-28AE-4B8F-B173-601004AEC9BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CF4C92BD-28AE-4B8F-B173-601004AEC9BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CF4C92BD-28AE-4B8F-B173-601004AEC9BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CF4C92BD-28AE-4B8F-B173-601004AEC9BF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{64EF61E7-00A6-4E5E-9808-62E10993A0E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{64EF61E7-00A6-4E5E-9808-62E10993A0E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{64EF61E7-00A6-4E5E-9808-62E10993A0E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
@ -439,6 +451,7 @@ Global
|
|||
{A20B9894-F352-4338-872A-F215A241D43D} = {7EB336C2-7C0A-4BC8-80C6-A3173AB8DC45}
|
||||
{8F7560CF-EEBB-4333-A69F-838CA40FD85D} = {7EB336C2-7C0A-4BC8-80C6-A3173AB8DC45}
|
||||
{97550E87-48C6-4EBF-85E1-413ABAE9DBFD} = {18BF8DD7-0585-48BF-8F97-AD333080CE06}
|
||||
{CF4C92BD-28AE-4B8F-B173-601004AEC9BF} = {F823671B-3ECA-4AE6-86DA-25E920D3FE64}
|
||||
{64EF61E7-00A6-4E5E-9808-62E10993A0E5} = {7EB336C2-7C0A-4BC8-80C6-A3173AB8DC45}
|
||||
{ACC20E50-0E9A-47AE-B6B3-9F1AFE74E470} = {686480D7-8FEC-4ED3-9C5D-CEBE1057A7ED}
|
||||
{6C796ACE-9599-4D55-AA0D-F1615B2D8C42} = {ACC20E50-0E9A-47AE-B6B3-9F1AFE74E470}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<CSNoWarn>CS1998;CS1591;CS8002;</CSNoWarn>
|
||||
<SKEXPNoWarn>SKEXP0001;SKEXP0010;SKEXP0020</SKEXPNoWarn>
|
||||
<NoWarn>$(NoWarn);$(CSNoWarn);$(SKEXPNoWarn);NU5104</NoWarn>
|
||||
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<IsPackable>false</IsPackable>
|
||||
|
@ -32,10 +33,6 @@
|
|||
<NoWarn>$(NoWarn);CA1829</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Text.Json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
|
||||
<PackageReference Include="ApprovalTests" />
|
||||
<PackageReference Include="FluentAssertions" />
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<MicrosoftSemanticKernelVersion>1.22.0</MicrosoftSemanticKernelVersion>
|
||||
<MicrosoftSemanticKernelExperimentalVersion>1.22.0-alpha</MicrosoftSemanticKernelExperimentalVersion>
|
||||
<MicrosoftExtensionsAIVersion>9.0.0-preview.9.24507.7</MicrosoftExtensionsAIVersion>
|
||||
<MicrosoftExtensionsAIVersion>9.0.0-preview.9.24525.1</MicrosoftExtensionsAIVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Aspire.Hosting" Version="9.0.0-rc.1.24511.1" />
|
||||
|
@ -112,6 +112,5 @@
|
|||
<PackageVersion Include="Moq" Version="4.20.72" />
|
||||
<PackageVersion Include="Microsoft.PowerShell.SDK" Version="7.4.5" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.10" />
|
||||
<PackageVersion Include="System.Text.Json" Version="9.0.0-rc.2.24473.5" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// AgentBaseTests.cs
|
||||
|
||||
using FluentAssertions;
|
||||
using Google.Protobuf.Reflection;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AutoGen.Agents.Tests;
|
||||
|
||||
public class AgentBaseTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task ItInvokeRightHandlerTestAsync()
|
||||
{
|
||||
var mockContext = new Mock<IAgentContext>();
|
||||
var agent = new TestAgent(mockContext.Object, new EventTypes(TypeRegistry.Empty, [], []));
|
||||
|
||||
await agent.HandleObject("hello world");
|
||||
await agent.HandleObject(42);
|
||||
|
||||
agent.ReceivedItems.Should().HaveCount(2);
|
||||
agent.ReceivedItems[0].Should().Be("hello world");
|
||||
agent.ReceivedItems[1].Should().Be(42);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The test agent is a simple agent that is used for testing purposes.
|
||||
/// </summary>
|
||||
public class TestAgent : AgentBase, IHandle<string>, IHandle<int>
|
||||
{
|
||||
public TestAgent(IAgentContext context, EventTypes eventTypes) : base(context, eventTypes)
|
||||
{
|
||||
}
|
||||
|
||||
public Task Handle(string item)
|
||||
{
|
||||
ReceivedItems.Add(item);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task Handle(int item)
|
||||
{
|
||||
ReceivedItems.Add(item);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public List<object> ReceivedItems { get; private set; } = [];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>$(TestTargetFrameworks)</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsTestProject>True</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\src\Microsoft.AutoGen\Agents\Microsoft.AutoGen.Agents.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -15,5 +15,6 @@
|
|||
<ProjectReference Include="..\..\src\AutoGen\AutoGen.csproj" />
|
||||
<PackageReference Include="FluentAssertions" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel.Plugins.Web" />
|
||||
<PackageReference Include="Microsoft.Extensions.AI" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// AgentCodeSnippet.cs
|
||||
|
||||
using AutoGen.Core;
|
||||
|
||||
namespace AutoGen.BasicSample.CodeSnippet;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// UserProxyAgentCodeSnippet.cs
|
||||
|
||||
using AutoGen.Core;
|
||||
|
||||
namespace AutoGen.BasicSample.CodeSnippet;
|
||||
|
|
|
@ -6,6 +6,7 @@ using AutoGen.Core;
|
|||
using AutoGen.OpenAI;
|
||||
using AutoGen.OpenAI.Extension;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.AI;
|
||||
|
||||
/// <summary>
|
||||
/// This example shows how to add type-safe function call to an agent.
|
||||
|
@ -37,13 +38,20 @@ public partial class Example03_Agent_FunctionCall
|
|||
/// </summary>
|
||||
/// <param name="price">price, should be an integer</param>
|
||||
/// <param name="taxRate">tax rate, should be in range (0, 1)</param>
|
||||
[FunctionAttribute]
|
||||
[Function]
|
||||
public async Task<string> CalculateTax(int price, float taxRate)
|
||||
{
|
||||
return $"tax is {price * taxRate}";
|
||||
}
|
||||
|
||||
public static async Task RunAsync()
|
||||
/// <summary>
|
||||
/// This example shows how to add type-safe function call using AutoGen.SourceGenerator.
|
||||
/// The SourceGenerator will automatically generate FunctionDefinition and FunctionCallWrapper during compiling time.
|
||||
///
|
||||
/// For adding type-safe function call from M.E.A.I tools, please refer to <see cref="ToolCallWithMEAITools"/>.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static async Task ToolCallWithSourceGenerator()
|
||||
{
|
||||
var instance = new Example03_Agent_FunctionCall();
|
||||
var gpt4o = LLMConfiguration.GetOpenAIGPT4o_mini();
|
||||
|
@ -101,4 +109,60 @@ public partial class Example03_Agent_FunctionCall
|
|||
// send aggregate message back to llm to get the final result
|
||||
var finalResult = await agent.SendAsync(calculateTaxes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This example shows how to add type-safe function call from M.E.A.I tools.
|
||||
///
|
||||
/// For adding type-safe function call from source generator, please refer to <see cref="ToolCallWithSourceGenerator"/>.
|
||||
/// </summary>
|
||||
public static async Task ToolCallWithMEAITools()
|
||||
{
|
||||
var gpt4o = LLMConfiguration.GetOpenAIGPT4o_mini();
|
||||
var instance = new Example03_Agent_FunctionCall();
|
||||
|
||||
AIFunction[] tools = [
|
||||
AIFunctionFactory.Create(instance.UpperCase),
|
||||
AIFunctionFactory.Create(instance.ConcatString),
|
||||
AIFunctionFactory.Create(instance.CalculateTax),
|
||||
];
|
||||
|
||||
var toolCallMiddleware = new FunctionCallMiddleware(tools);
|
||||
|
||||
var agent = new OpenAIChatAgent(
|
||||
chatClient: gpt4o,
|
||||
name: "agent",
|
||||
systemMessage: "You are a helpful AI assistant")
|
||||
.RegisterMessageConnector()
|
||||
.RegisterStreamingMiddleware(toolCallMiddleware)
|
||||
.RegisterPrintMessage();
|
||||
|
||||
// talk to the assistant agent
|
||||
var upperCase = await agent.SendAsync("convert to upper case: hello world");
|
||||
upperCase.GetContent()?.Should().Be("HELLO WORLD");
|
||||
upperCase.Should().BeOfType<ToolCallAggregateMessage>();
|
||||
upperCase.GetToolCalls().Should().HaveCount(1);
|
||||
upperCase.GetToolCalls().First().FunctionName.Should().Be(nameof(UpperCase));
|
||||
|
||||
var concatString = await agent.SendAsync("concatenate strings: a, b, c, d, e");
|
||||
concatString.GetContent()?.Should().Be("a b c d e");
|
||||
concatString.Should().BeOfType<ToolCallAggregateMessage>();
|
||||
concatString.GetToolCalls().Should().HaveCount(1);
|
||||
concatString.GetToolCalls().First().FunctionName.Should().Be(nameof(ConcatString));
|
||||
|
||||
var calculateTax = await agent.SendAsync("calculate tax: 100, 0.1");
|
||||
calculateTax.GetContent().Should().Be("tax is 10");
|
||||
calculateTax.Should().BeOfType<ToolCallAggregateMessage>();
|
||||
calculateTax.GetToolCalls().Should().HaveCount(1);
|
||||
calculateTax.GetToolCalls().First().FunctionName.Should().Be(nameof(CalculateTax));
|
||||
|
||||
// parallel function calls
|
||||
var calculateTaxes = await agent.SendAsync("calculate tax: 100, 0.1; calculate tax: 200, 0.2");
|
||||
calculateTaxes.GetContent().Should().Be("tax is 10\ntax is 40"); // "tax is 10\n tax is 40
|
||||
calculateTaxes.Should().BeOfType<ToolCallAggregateMessage>();
|
||||
calculateTaxes.GetToolCalls().Should().HaveCount(2);
|
||||
calculateTaxes.GetToolCalls().First().FunctionName.Should().Be(nameof(CalculateTax));
|
||||
|
||||
// send aggregate message back to llm to get the final result
|
||||
var finalResult = await agent.SendAsync(calculateTaxes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Example06_UserProxyAgent.cs
|
||||
|
||||
using AutoGen.Core;
|
||||
using AutoGen.OpenAI;
|
||||
using AutoGen.OpenAI.Extension;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
//await Example07_Dynamic_GroupChat_Calculate_Fibonacci.RunAsync();
|
||||
|
||||
|
@ -10,7 +11,8 @@ var allSamples = new List<(string, Func<Task>)>
|
|||
// When a new sample is created please add them to the allSamples collection
|
||||
("Assistant Agent", Example01_AssistantAgent.RunAsync),
|
||||
("Two-agent Math Chat", Example02_TwoAgent_MathChat.RunAsync),
|
||||
("Agent Function Call", Example03_Agent_FunctionCall.RunAsync),
|
||||
("Agent Function Call With Source Generator", Example03_Agent_FunctionCall.ToolCallWithSourceGenerator),
|
||||
("Agent Function Call With M.E.A.I AI Functions", Example03_Agent_FunctionCall.ToolCallWithMEAITools),
|
||||
("Dynamic Group Chat Coding Task", Example04_Dynamic_GroupChat_Coding_Task.RunAsync),
|
||||
("DALL-E and GPT4v", Example05_Dalle_And_GPT4V.RunAsync),
|
||||
("User Proxy Agent", Example06_UserProxyAgent.RunAsync),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Connect_To_Azure_OpenAI.cs
|
||||
|
||||
#region using_statement
|
||||
using System.ClientModel;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"profiles": {
|
||||
"AutoGen.WebAPI.Sample": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:50675;http://localhost:50676"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,14 +1,16 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Runtime\Microsoft.AutoGen.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
</ItemGroup>
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Runtime\Microsoft.AutoGen.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
using Microsoft.Extensions.Hosting;
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
var app = await Microsoft.AutoGen.Runtime.Host.StartAsync(local: true);
|
||||
await app.WaitForShutdownAsync();
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"profiles": {
|
||||
"Backend": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:53071;http://localhost:53072"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
@ -10,12 +9,12 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aspire.Hosting.AppHost"/>
|
||||
<PackageReference Include="Aspire.Hosting"/>
|
||||
<PackageReference Include="Aspire.Hosting.AppHost" />
|
||||
<PackageReference Include="Aspire.Hosting" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Backend\Backend.csproj" />
|
||||
<ProjectReference Include="..\HelloAgent\HelloAgent.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
var builder = DistributedApplication.CreateBuilder(args);
|
||||
var backend = builder.AddProject<Projects.Backend>("backend");
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"profiles": {
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "https://localhost:15887;http://localhost:15888",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"DOTNET_ENVIRONMENT": "Development",
|
||||
//"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:16037",
|
||||
"DOTNET_DASHBOARD_OTLP_HTTP_ENDPOINT_URL": "https://localhost:16038",
|
||||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:17037",
|
||||
"DOTNET_ASPIRE_SHOW_DASHBOARD_RESOURCES": "true"
|
||||
}
|
||||
},
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:15888",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"DOTNET_ENVIRONMENT": "Development",
|
||||
//"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16031",
|
||||
"DOTNET_DASHBOARD_OTLP_HTTP_ENDPOINT_URL": "http://localhost:16032",
|
||||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:17031",
|
||||
"DOTNET_ASPIRE_SHOW_DASHBOARD_RESOURCES": "true",
|
||||
"ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true"
|
||||
}
|
||||
},
|
||||
"generate-manifest": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"commandLineArgs": "--publisher manifest --output-path aspire-manifest.json",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"DOTNET_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json"
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// HelloAIAgent.cs
|
||||
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
using Microsoft.Extensions.AI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Hello;
|
||||
[TopicSubscription("HelloAgents")]
|
||||
|
|
|
@ -1,16 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Abstractions\Microsoft.AutoGen.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Agents\Microsoft.AutoGen.Agents.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Runtime\Microsoft.AutoGen.Runtime.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Extensions\AIModelClientHostingExtensions\AIModelClientHostingExtensions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
</ItemGroup>
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
@ -18,4 +6,14 @@
|
|||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Abstractions\Microsoft.AutoGen.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Agents\Microsoft.AutoGen.Agents.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Runtime\Microsoft.AutoGen.Runtime.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Extensions\AIModelClientHostingExtensions\AIModelClientHostingExtensions.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
using Hello;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
// send a message to the agent
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"profiles": {
|
||||
"HelloAIAgents": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:53139;http://localhost:53140"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Abstractions\Microsoft.AutoGen.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Agents\Microsoft.AutoGen.Agents.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Runtime\Microsoft.AutoGen.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Aspire.Hosting.AppHost" />
|
||||
</ItemGroup>
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
@ -18,4 +6,14 @@
|
|||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Aspire.Hosting.AppHost" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Abstractions\Microsoft.AutoGen.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Agents\Microsoft.AutoGen.Agents.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Runtime\Microsoft.AutoGen.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
// send a message to the agent
|
||||
// step 1: create in-memory agent runtime
|
||||
|
||||
// step 2: register HelloAgent to that agent runtime
|
||||
|
||||
// step 3: start the agent runtime
|
||||
|
||||
// step 4: send a message to the agent
|
||||
|
||||
// step 5: wait for the agent runtime to shutdown
|
||||
var app = await AgentsApp.PublishMessageAsync("HelloAgents", new NewMessageReceived
|
||||
{
|
||||
Message = "World"
|
||||
|
@ -18,10 +25,12 @@ namespace Hello
|
|||
[TopicSubscription("HelloAgents")]
|
||||
public class HelloAgent(
|
||||
IAgentContext context,
|
||||
[FromKeyedServices("EventTypes")] EventTypes typeRegistry) : ConsoleAgent(
|
||||
[FromKeyedServices("EventTypes")] EventTypes typeRegistry,
|
||||
IHostApplicationLifetime hostApplicationLifetime) : AgentBase(
|
||||
context,
|
||||
typeRegistry),
|
||||
ISayHello,
|
||||
IHandleConsole,
|
||||
IHandle<NewMessageReceived>,
|
||||
IHandle<ConversationClosed>
|
||||
{
|
||||
|
@ -48,11 +57,11 @@ namespace Hello
|
|||
Message = goodbye
|
||||
}.ToCloudEvent(this.AgentId.Key);
|
||||
await PublishEvent(evt).ConfigureAwait(false);
|
||||
//sleep
|
||||
await Task.Delay(10000).ConfigureAwait(false);
|
||||
await AgentsApp.ShutdownAsync().ConfigureAwait(false);
|
||||
|
||||
// Signal shutdown.
|
||||
hostApplicationLifetime.StopApplication();
|
||||
}
|
||||
|
||||
public async Task<string> SayHello(string ask)
|
||||
{
|
||||
var response = $"\n\n\n\n***************Hello {ask}**********************\n\n\n\n";
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"profiles": {
|
||||
"HelloAgent": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:53113;http://localhost:53114"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -118,4 +118,4 @@ message ReadmeRequested {
|
|||
</ItemGroup>
|
||||
```
|
||||
|
||||
You can send messages using the [```Microsoft.AutoGen.Agents.AgentClient``` class](autogen/dotnet/src/Microsoft.AutoGen/Agents/AgentClient.cs). Messages are wrapped in [the CloudEvents specification](https://cloudevents.io) and sent to the event bus.
|
||||
You can send messages using the [```Microsoft.AutoGen.Agents.AgentWorker``` class](autogen/dotnet/src/Microsoft.AutoGen/Agents/AgentWorker.cs). Messages are wrapped in [the CloudEvents specification](https://cloudevents.io) and sent to the event bus.
|
||||
|
|
|
@ -1,16 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Abstractions\Microsoft.AutoGen.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Agents\Microsoft.AutoGen.Agents.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Runtime\Microsoft.AutoGen.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Aspire.Hosting.AppHost" />
|
||||
</ItemGroup>
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
@ -18,4 +6,14 @@
|
|||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Aspire.Hosting.AppHost" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Abstractions\Microsoft.AutoGen.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Agents\Microsoft.AutoGen.Agents.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Runtime\Microsoft.AutoGen.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
// send a message to the agent
|
||||
var app = await AgentsApp.PublishMessageAsync("HelloAgents", new NewMessageReceived
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"profiles": {
|
||||
"HelloAgentState": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:53136;http://localhost:53137"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -117,7 +117,7 @@ message ReadmeRequested {
|
|||
</ItemGroup>
|
||||
```
|
||||
|
||||
You can send messages using the [```Microsoft.AutoGen.Agents``` class](autogen/dotnet/src/Microsoft.AutoGen/Agents/AgentClient.cs). Messages are wrapped in [the CloudEvents specification](https://cloudevents.io) and sent to the event bus.
|
||||
You can send messages using the [```Microsoft.AutoGen.Agents.AgentWorker``` class](autogen/dotnet/src/Microsoft.AutoGen/Agents/AgentWorker.cs). Messages are wrapped in [the CloudEvents specification](https://cloudevents.io) and sent to the event bus.
|
||||
|
||||
### Managing State
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
using Microsoft.AutoGen.Runtime;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"profiles": {
|
||||
"DevTeam.AgentHost": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:50670;http://localhost:50673"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
|
||||
<ProjectReference Include="../../../src/Microsoft.AutoGen/Agents/Microsoft.AutoGen.Agents.csproj" />
|
||||
<ProjectReference Include="..\DevTeam.Shared\DevTeam.Shared.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AutoGen\Extensions\SemanticKernel\Microsoft.AutoGen.Extensions.SemanticKernel.csproj" />
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Developer.cs
|
||||
|
||||
using DevTeam.Shared;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// DeveloperPrompts.cs
|
||||
|
||||
namespace DevTeam.Agents;
|
||||
public static class DeveloperSkills
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// DeveloperLead.cs
|
||||
|
||||
using DevTeam.Shared;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// DeveloperLeadPrompts.cs
|
||||
|
||||
namespace DevTeam.Agents;
|
||||
public static class DevLeadSkills
|
||||
{
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// PMPrompts.cs
|
||||
|
||||
namespace DevTeam.Agents;
|
||||
public static class PMSkills
|
||||
{
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// ProductManager.cs
|
||||
|
||||
using DevTeam.Shared;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
using DevTeam.Agents;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
using Microsoft.AutoGen.Extensions.SemanticKernel;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"profiles": {
|
||||
"DevTeam.Agents": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:50669;http://localhost:50671"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
var builder = DistributedApplication.CreateBuilder(args);
|
||||
|
||||
builder.AddAzureProvisioning();
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"profiles": {
|
||||
"DevTeam.AppHost": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:17034;http://localhost:15043",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"DOTNET_ENVIRONMENT": "Development",
|
||||
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21249",
|
||||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22030"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// AzureGenie.cs
|
||||
|
||||
using DevTeam.Backend;
|
||||
using DevTeam.Shared;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Hubber.cs
|
||||
|
||||
using System.Text.Json;
|
||||
using DevTeam;
|
||||
using DevTeam.Backend;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// TODO: Reimplement using ACA Sessions
|
||||
// using DevTeam.Events;
|
||||
// using Microsoft.AutoGen.Abstractions;
|
||||
// using Microsoft.AutoGen.Agents;
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Sandbox.cs
|
||||
|
||||
// namespace DevTeam.Backend;
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
using Azure.Identity;
|
||||
using DevTeam.Backend;
|
||||
using DevTeam.Options;
|
||||
|
@ -23,7 +26,7 @@ builder.AddAgentWorker(builder.Configuration["AGENT_HOST"]!)
|
|||
//.AddAgent<Sandbox>(nameof(Sandbox))
|
||||
.AddAgent<Hubber>(nameof(Hubber));
|
||||
|
||||
builder.Services.AddSingleton<AgentClient>();
|
||||
builder.Services.AddSingleton<AgentWorker>();
|
||||
builder.Services.AddSingleton<WebhookEventProcessor, GithubWebHookProcessor>();
|
||||
builder.Services.AddSingleton<GithubAuthService>();
|
||||
builder.Services.AddSingleton<IManageAzure, AzureService>();
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"profiles": {
|
||||
"DevTeam.Backend": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:50672;http://localhost:50674"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// AzureService.cs
|
||||
|
||||
using System.Text;
|
||||
using Azure;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// GithubAuthService.cs
|
||||
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// GithubService.cs
|
||||
|
||||
using System.Text;
|
||||
using Azure.Storage.Files.Shares;
|
||||
using DevTeam.Options;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// GithubWebHookProcessor.cs
|
||||
|
||||
using System.Globalization;
|
||||
using DevTeam.Shared;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
|
@ -10,10 +13,10 @@ using Octokit.Webhooks.Models;
|
|||
|
||||
namespace DevTeam.Backend;
|
||||
|
||||
public sealed class GithubWebHookProcessor(ILogger<GithubWebHookProcessor> logger, AgentClient client) : WebhookEventProcessor
|
||||
public sealed class GithubWebHookProcessor(ILogger<GithubWebHookProcessor> logger, AgentWorker client) : WebhookEventProcessor
|
||||
{
|
||||
private readonly ILogger<GithubWebHookProcessor> _logger = logger;
|
||||
private readonly AgentClient _client = client;
|
||||
private readonly AgentWorker _client = client;
|
||||
|
||||
protected override async Task ProcessIssuesWebhookAsync(WebhookHeaders headers, IssuesEvent issuesEvent, IssuesAction action)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Extensions.cs
|
||||
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// EventExtensions.cs
|
||||
|
||||
using System.Globalization;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// DevPlan.cs
|
||||
|
||||
namespace DevTeam;
|
||||
public class DevLeadPlan
|
||||
{
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// AzureOptions.cs
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DevTeam.Options;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// GithubOptions.cs
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DevTeam.Options;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// ParseExtensions.cs
|
||||
|
||||
namespace DevTeam;
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
using Microsoft.AutoGen.Runtime;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:59666",
|
||||
"sslPort": 44374
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5136",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7069;http://localhost:5136",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Auditor.cs
|
||||
|
||||
using Marketing.Shared;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
namespace Marketing.Agents;
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// AuditorPrompts.cs
|
||||
|
||||
namespace Marketing.Agents;
|
||||
|
||||
public static class AuditorPrompts
|
||||
{
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// CommunityManager.cs
|
||||
|
||||
using Marketing.Shared;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// CommunityManagerPrompts.cs
|
||||
|
||||
namespace Marketing.Agents;
|
||||
|
||||
public static class CommunityManagerPrompts
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// GraphicDesigner.cs
|
||||
|
||||
using Marketing.Shared;
|
||||
using Microsoft.AutoGen.Abstractions;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
namespace Marketing.Agents;
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// GraphicDesignerPrompts.cs
|
||||
|
||||
namespace Marketing.Agents;
|
||||
|
||||
public static class GraphicDesignerPrompts
|
||||
{
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
using Marketing.Agents;
|
||||
using Marketing.Shared;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:2285",
|
||||
"sslPort": 44301
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5019",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7150;http://localhost:5019",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Writer.cs
|
||||
|
||||
using Google.Protobuf;
|
||||
using Marketing.Shared;
|
||||
using Microsoft.SemanticKernel.Memory;
|
||||
using Microsoft.SemanticKernel;
|
||||
|
@ -74,19 +74,19 @@ public class Writer(IAgentContext context, Kernel kernel, ISemanticTextMemory me
|
|||
await PublishEvent(auditTextEvent);
|
||||
}
|
||||
|
||||
protected override Task<RpcResponse> HandleRequest(RpcRequest request) => request.Method switch
|
||||
{
|
||||
"GetArticle" => Task.FromResult(new RpcResponse
|
||||
{
|
||||
Payload = new Payload
|
||||
{
|
||||
DataContentType = "text/plain",
|
||||
Data = ByteString.CopyFromUtf8(_state.Data.WrittenArticle),
|
||||
DataType = "text"
|
||||
}
|
||||
}),
|
||||
_ => Task.FromResult(new RpcResponse { Error = $"Unknown method, '{request.Method}'." }),
|
||||
};
|
||||
//protected override Task<RpcResponse> HandleRequest(RpcRequest request) => request.Method switch
|
||||
//{
|
||||
// "GetArticle" => Task.FromResult(new RpcResponse
|
||||
// {
|
||||
// Payload = new Payload
|
||||
// {
|
||||
// DataContentType = "text/plain",
|
||||
// Data = ByteString.CopyFromUtf8(_state.Data.WrittenArticle),
|
||||
// DataType = "text"
|
||||
// }
|
||||
// }),
|
||||
// _ => Task.FromResult(new RpcResponse { Error = $"Unknown method, '{request.Method}'." }),
|
||||
//};
|
||||
|
||||
public Task<string> GetArticle()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// WriterPrompts.cs
|
||||
|
||||
namespace Marketing.Agents;
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
var builder = DistributedApplication.CreateBuilder(args);
|
||||
|
||||
builder.AddAzureProvisioning();
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:17034;http://localhost:15043",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"DOTNET_ENVIRONMENT": "Development",
|
||||
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21249",
|
||||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22030"
|
||||
}
|
||||
},
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:15043",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"DOTNET_ENVIRONMENT": "Development",
|
||||
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19105",
|
||||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20096"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning",
|
||||
"Aspire.Hosting.Dcp": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SignalRAgent.cs
|
||||
|
||||
using Marketing.Shared;
|
||||
using Microsoft.SemanticKernel.Memory;
|
||||
using Microsoft.SemanticKernel;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// ArticlesController.cs
|
||||
|
||||
using Marketing.Shared;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AutoGen.Agents;
|
||||
|
@ -9,17 +12,17 @@ namespace Marketing.Backend.Controllers;
|
|||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class Articles(AgentClient client) : ControllerBase
|
||||
public class Articles(AgentWorker client) : ControllerBase
|
||||
{
|
||||
private readonly AgentClient _client = client;
|
||||
private readonly AgentWorker _client = client;
|
||||
|
||||
// GET api/<Post>/5
|
||||
[HttpGet("{id}")]
|
||||
public async Task<string> Get(string id)
|
||||
{
|
||||
var response = await _client.SendRequestAsync(new AgentId("writer", id), "GetArticle", []);
|
||||
return response.Payload.Data.ToStringUtf8();
|
||||
}
|
||||
//// GET api/<Post>/5
|
||||
//[HttpGet("{id}")]
|
||||
//public async Task<string> Get(string id)
|
||||
//{
|
||||
// var response = await _client.(new AgentId("writer", id), "GetArticle", []);
|
||||
// return response.Payload.Data.ToStringUtf8();
|
||||
//}
|
||||
|
||||
// PUT api/<Post>/5
|
||||
[HttpPut("{UserId}")]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// AgentTypes.cs
|
||||
|
||||
namespace Marketing.Backend.Hubs;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// ArticleHub.cs
|
||||
|
||||
using Marketing.Shared;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
@ -7,7 +8,7 @@ using Microsoft.AutoGen.Runtime;
|
|||
|
||||
namespace Marketing.Backend.Hubs;
|
||||
|
||||
public class ArticleHub(AgentClient client) : Hub<IArticleHub>
|
||||
public class ArticleHub(AgentWorker client) : Hub<IArticleHub>
|
||||
{
|
||||
public override async Task OnConnectedAsync()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// FrontEndMessage.cs
|
||||
|
||||
namespace Marketing.Backend.Hubs;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// IArticleHub.cs
|
||||
|
||||
namespace Marketing.Backend.Hubs;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// ISignalRService.cs
|
||||
|
||||
namespace Marketing.Backend.Hubs;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SignalRConnectionsDB.cs
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SignalRService.cs
|
||||
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Program.cs
|
||||
|
||||
using Marketing.Backend.Agents;
|
||||
using Marketing.Shared;
|
||||
using Marketing.Backend.Hubs;
|
||||
|
@ -14,7 +17,7 @@ builder.Services.AddSwaggerGen();
|
|||
builder.Services.AddSignalR();
|
||||
builder.AddAgentWorker(builder.Configuration["AGENT_HOST"]!)
|
||||
.AddAgent<SignalRAgent>("signalr-hub");
|
||||
builder.Services.AddSingleton<AgentClient>();
|
||||
builder.Services.AddSingleton<AgentWorker>();
|
||||
builder.Services.AddSingleton<ISignalRService, SignalRService>();
|
||||
|
||||
// Allow any CORS origin if in DEV
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:51446",
|
||||
"sslPort": 44363
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5020",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7224;http://localhost:5020",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Extensions.cs
|
||||
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
namespace Marketing.Shared.Options;
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Consts.cs
|
||||
|
||||
namespace Marketing.Shared.Options;
|
||||
|
||||
public static class Consts
|
||||
{
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// OpenAIOptions.cs
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marketing.Shared.Options;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SemanticKernelHostingExtensions.cs
|
||||
|
||||
using System.ClientModel;
|
||||
using System.Text.Json;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// ChatCompletionRequest.cs
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="JsonSchema.Net.Generation" />
|
||||
<PackageReference Include="System.Memory.Data" />
|
||||
<PackageReference Include="Microsoft.Extensions.AI.Abstractions" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue