Skip to content

.Net Agents - Assistant V2 Migration #7126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 152 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
2abaec8
Checkpoint
crickman Jul 3, 2024
24fbddc
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Jul 3, 2024
260b12f
Resolve merge from parent
crickman Jul 3, 2024
08a426e
Fix merge from parent
crickman Jul 3, 2024
d7a31eb
Fix tool setup
crickman Jul 3, 2024
efed79b
Agent concepts and integration tests
crickman Jul 3, 2024
348cc9b
Checkpoint
crickman Jul 5, 2024
9da6154
Checkpoint
crickman Jul 5, 2024
9b506cb
Integration test update
crickman Jul 5, 2024
f240d27
Check point w/ more samples
crickman Jul 5, 2024
b417af0
Checkpoint
crickman Jul 6, 2024
5a3bb30
Unit-test fix
crickman Jul 6, 2024
366d342
Settings update
crickman Jul 7, 2024
0cdb397
Intermediate cleanup
crickman Jul 7, 2024
192d599
More file support
crickman Jul 7, 2024
7425874
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Jul 7, 2024
43e3579
File-service clean-up
crickman Jul 7, 2024
417f2b4
Refine content generation
crickman Jul 7, 2024
b108429
Improve sample
crickman Jul 7, 2024
ec18260
Improve thread creation
crickman Jul 7, 2024
9e9f364
Typo
crickman Jul 7, 2024
6fd7c7f
Exclude V1 sample
crickman Jul 8, 2024
ec0aa8c
Project clean-up
crickman Jul 8, 2024
59d632b
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Jul 8, 2024
b2c1726
Dependency clean-up: IntegrationTests
crickman Jul 8, 2024
7e4cd39
Fix path case for unbuntu
crickman Jul 8, 2024
e0a33c0
Comments and orgid clean-up
crickman Jul 8, 2024
a042a85
Comments
crickman Jul 8, 2024
3081083
More clean-up
crickman Jul 8, 2024
d3b5528
Coverage
crickman Jul 8, 2024
0ae6739
Typo
crickman Jul 8, 2024
18f6ad2
More test coverage
crickman Jul 8, 2024
2f459f0
More coverage
crickman Jul 8, 2024
4d2914b
Partial arc optimization
crickman Jul 8, 2024
ec7129f
Resolve merge from main
crickman Jul 12, 2024
5eba985
Resolve merge from parent
crickman Jul 12, 2024
9e46068
Resolve merge from main
crickman Jul 12, 2024
696652d
Resolve breaking changes (first pass)
crickman Jul 12, 2024
bb98e44
Remove ConceptsV2 shim
crickman Jul 12, 2024
4992cd3
Namespace
crickman Jul 12, 2024
daed2f8
Whitespace
crickman Jul 12, 2024
6bd518c
Resolve OpenAIV2 dependency
crickman Jul 12, 2024
51f80c5
Remove file-service usage
crickman Jul 12, 2024
9e7e2dc
Fix concepts resources
crickman Jul 12, 2024
37363fd
Fix sample migration
crickman Jul 12, 2024
1c986cf
Restore skipped samples
crickman Jul 12, 2024
448af97
/sigh
crickman Jul 12, 2024
6f7b89b
Resolve merge from parent
crickman Jul 17, 2024
c92f87f
Fix merge
crickman Jul 17, 2024
1a918f8
Resolve merge from parent
crickman Jul 17, 2024
9205cec
Fix build
crickman Jul 17, 2024
712c826
Fix merge
crickman Jul 17, 2024
362e187
Resolve merge from parent
crickman Jul 18, 2024
58d01e7
Definition property update
crickman Jul 22, 2024
22946a8
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Jul 22, 2024
080d21e
UT update
crickman Jul 22, 2024
31e3051
More UT
crickman Jul 22, 2024
a33dc5e
Rename
crickman Jul 22, 2024
84c0a1f
Rename and UT stubs
crickman Jul 22, 2024
e09013b
Namespace
crickman Jul 22, 2024
a48aa12
Checkpoint
crickman Jul 22, 2024
991dd59
Blank line
crickman Jul 22, 2024
6bb0613
Checkpoint
crickman Jul 22, 2024
1709575
Checkpoint
crickman Jul 23, 2024
f6e8c7b
More testing
crickman Jul 23, 2024
117066c
Clean-up
crickman Jul 23, 2024
05b48b6
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Jul 23, 2024
10c4afb
Sync with bug-fix
crickman Jul 23, 2024
3396076
Checkpoint
crickman Jul 24, 2024
499fbbd
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Jul 24, 2024
511e6ca
Test Complete
crickman Jul 24, 2024
8ca0a9d
More tests + typo fix
crickman Jul 25, 2024
bd56cd9
Blank line
crickman Jul 25, 2024
51ffe3a
Typo
crickman Jul 25, 2024
d0509b3
Resolve merge from parent
crickman Jul 25, 2024
ef92c71
Update based on merge and PR input
crickman Jul 25, 2024
a4567b7
Resolve merge from parent
crickman Jul 25, 2024
afda061
Migrate new samples
crickman Jul 25, 2024
ea1fa92
Legacy fix
crickman Jul 25, 2024
259b769
Exception message
crickman Jul 25, 2024
91d5142
Resolve merge from parent
crickman Jul 25, 2024
20c7057
Clean-up
crickman Jul 25, 2024
799cf63
Resolve merge from parent
crickman Jul 26, 2024
f83751a
Resolve merge from parent
crickman Jul 29, 2024
13a88e9
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Jul 30, 2024
da75903
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Jul 31, 2024
f419ac2
Clean-up
crickman Jul 31, 2024
cd24a45
Legacy clean-up
crickman Jul 31, 2024
b4dfd7a
Type fix
crickman Jul 31, 2024
e2d3408
Remove friend relationship to concepts
crickman Jul 31, 2024
d68b567
Update CharMaker sample to download and view images
crickman Jul 31, 2024
475a9f6
Namespace
crickman Jul 31, 2024
844cef9
Param comment
crickman Jul 31, 2024
d5ab830
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Aug 1, 2024
dac78fd
PR comments
crickman Aug 1, 2024
03f2456
Simplify
crickman Aug 1, 2024
197a7e3
Update dotnet/src/Agents/UnitTests/OpenAI/Internal/AssistantMessageFa…
crickman Aug 2, 2024
a184818
Update dotnet/src/Agents/OpenAI/Extensions/OpenAIServiceConfiguration…
crickman Aug 2, 2024
042ab64
Cosmetic: Maximize single line code complexity and eliminate potentia…
crickman Aug 2, 2024
2a4baec
Namespace
crickman Aug 2, 2024
ae47cbf
Remove silent failure
crickman Aug 2, 2024
bd55f03
Braces
crickman Aug 2, 2024
f3c8af1
Fix logic level
crickman Aug 2, 2024
b78806a
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Aug 5, 2024
0c11eb3
Port update
crickman Aug 5, 2024
db0e752
Resolve merge from parent
crickman Aug 5, 2024
8faccc8
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Aug 6, 2024
9d573b5
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Aug 6, 2024
406c3d9
Checkpoint
crickman Aug 6, 2024
9fd6b92
Unit-tests
crickman Aug 6, 2024
5b54de4
Serialization tests and attributes
crickman Aug 7, 2024
d029bd4
Image DataUrl support
crickman Aug 7, 2024
a7cdba5
Remove duplicate sample
crickman Aug 7, 2024
13f1986
Update concept samples
crickman Aug 7, 2024
7dc67fd
Whitespace
crickman Aug 7, 2024
e74aa19
Namespace
crickman Aug 7, 2024
41482ba
"Breaking Glass" Checkpoint
crickman Aug 7, 2024
a372a67
Comments
crickman Aug 7, 2024
2a6227e
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Aug 7, 2024
bdaa4b6
One more comment
crickman Aug 7, 2024
2b138e5
Include agent-base-test in solution
crickman Aug 7, 2024
6855dbb
Re-link samples/internalutilities to .sln
crickman Aug 7, 2024
f4d2113
Re-add demo project to sln (merge weirdness?)
crickman Aug 7, 2024
4fe9a1f
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Aug 7, 2024
64c4932
Update package versions
crickman Aug 8, 2024
85d803e
Merge branch 'feature-connectors-openai' into feature_agents_openai
crickman Aug 8, 2024
0d082e1
Fix channel-keys generation
crickman Aug 8, 2024
b8f1d02
Allocate key-enumeration
crickman Aug 8, 2024
a1d3e4f
Merge to all recent agent updates
crickman Aug 8, 2024
fe3b835
Final fixes
crickman Aug 8, 2024
7cdfba6
Test enhancement
crickman Aug 8, 2024
5c62656
Up test coverage
crickman Aug 8, 2024
5077465
Typo
crickman Aug 8, 2024
bf3825e
Namespace + core coverage
crickman Aug 8, 2024
590fbf3
Service-selection coverage
crickman Aug 8, 2024
e46a93c
Even deeper coverage
crickman Aug 8, 2024
9c19d59
Update dotnet/src/Agents/OpenAI/OpenAIAssistantAgent.cs
crickman Aug 9, 2024
176f372
Update dotnet/src/Agents/OpenAI/OpenAIAssistantExecutionOptions.cs
crickman Aug 9, 2024
71bd060
Update dotnet/src/Agents/OpenAI/OpenAIAssistantExecutionOptions.cs
crickman Aug 9, 2024
a24d151
Update dotnet/src/Agents/UnitTests/OpenAI/Internal/AssistantMessageFa…
crickman Aug 9, 2024
fd0d81e
Update dotnet/src/Agents/UnitTests/OpenAI/Internal/AssistantMessageFa…
crickman Aug 9, 2024
7162e34
Update dotnet/src/Agents/OpenAI/OpenAIAssistantAgent.cs
crickman Aug 9, 2024
96c3ac0
Update dotnet/src/Agents/OpenAI/Internal/AssistantThreadActions.cs
crickman Aug 9, 2024
58ce240
Update dotnet/src/Agents/OpenAI/Internal/AssistantThreadActions.cs
crickman Aug 9, 2024
56f0fea
Indenting
crickman Aug 9, 2024
f80ec5d
Merge branch 'feature_agents_openai' of https://github.com/microsoft/…
crickman Aug 9, 2024
c45c1c8
Update dotnet/src/Agents/OpenAI/Internal/AssistantThreadActions.cs
crickman Aug 9, 2024
b0b35e7
Updated based on comments
crickman Aug 9, 2024
ff40c20
Merge branch 'feature_agents_openai' of https://github.com/microsoft/…
crickman Aug 9, 2024
631eded
Update unit-test comments
crickman Aug 9, 2024
5463d1b
Summary reducer optimization
crickman Aug 9, 2024
88cbd50
readme
crickman Aug 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<PackageVersion Include="System.ClientModel" Version="1.1.0-beta.4" />
<PackageVersion Include="Azure.AI.ContentSafety" Version="1.0.0" />
<PackageVersion Include="Azure.AI.OpenAI" Version="2.0.0-beta.2" />
<PackageVersion Include="Azure.AI.OpenAI.Assistants" Version="1.0.0-beta.4" />
<PackageVersion Include="Azure.Identity" Version="1.12.0" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0" />
<PackageVersion Include="Azure.Search.Documents" Version="11.6.0" />
Expand Down
50 changes: 33 additions & 17 deletions dotnet/SK-dotnet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GettingStartedWithAgents",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{77E141BA-AF5E-4C01-A970-6C07AC3CD55A}"
ProjectSection(SolutionItems) = preProject
src\InternalUtilities\samples\ConfigurationNotFoundException.cs = src\InternalUtilities\samples\ConfigurationNotFoundException.cs
src\InternalUtilities\samples\EnumerableExtensions.cs = src\InternalUtilities\samples\EnumerableExtensions.cs
src\InternalUtilities\samples\Env.cs = src\InternalUtilities\samples\Env.cs
src\InternalUtilities\samples\ObjectExtensions.cs = src\InternalUtilities\samples\ObjectExtensions.cs
src\InternalUtilities\samples\PlanExtensions.cs = src\InternalUtilities\samples\PlanExtensions.cs
src\InternalUtilities\samples\RepoFiles.cs = src\InternalUtilities\samples\RepoFiles.cs
src\InternalUtilities\samples\SamplesInternalUtilities.props = src\InternalUtilities\samples\SamplesInternalUtilities.props
src\InternalUtilities\samples\TextOutputHelperExtensions.cs = src\InternalUtilities\samples\TextOutputHelperExtensions.cs
src\InternalUtilities\samples\XunitLogger.cs = src\InternalUtilities\samples\XunitLogger.cs
src\InternalUtilities\samples\YourAppException.cs = src\InternalUtilities\samples\YourAppException.cs
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Functions.Prompty", "src\Functions\Functions.Prompty\Functions.Prompty.csproj", "{12B06019-740B-466D-A9E0-F05BC123A47D}"
Expand Down Expand Up @@ -340,9 +331,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connectors.Qdrant.UnitTests
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connectors.Redis.UnitTests", "src\Connectors\Connectors.Redis.UnitTests\Connectors.Redis.UnitTests.csproj", "{ACD8C464-AEC9-45F6-A458-50A84F353DB7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StepwisePlannerMigration", "samples\Demos\StepwisePlannerMigration\StepwisePlannerMigration.csproj", "{38374C62-0263-4FE8-A18C-70FC8132912B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIModelRouter", "samples\Demos\AIModelRouter\AIModelRouter.csproj", "{E06818E3-00A5-41AC-97ED-9491070CDEA1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIModelRouter", "samples\Demos\AIModelRouter\AIModelRouter.csproj", "{E06818E3-00A5-41AC-97ED-9491070CDEA1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CreateChatGptPlugin", "CreateChatGptPlugin", "{F8B82F6B-B16A-4F8C-9C41-E9CD8D79A098}"
EndProject
Expand All @@ -352,6 +341,29 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MathPlugin", "MathPlugin",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "kernel-functions-generator", "samples\Demos\CreateChatGptPlugin\MathPlugin\kernel-functions-generator\kernel-functions-generator.csproj", "{4326A974-F027-4ABD-A220-382CC6BB0801}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{EE454832-085F-4D37-B19B-F94F7FC6984A}"
ProjectSection(SolutionItems) = preProject
src\InternalUtilities\samples\InternalUtilities\BaseTest.cs = src\InternalUtilities\samples\InternalUtilities\BaseTest.cs
src\InternalUtilities\samples\InternalUtilities\ConfigurationNotFoundException.cs = src\InternalUtilities\samples\InternalUtilities\ConfigurationNotFoundException.cs
src\InternalUtilities\samples\InternalUtilities\EmbeddedResource.cs = src\InternalUtilities\samples\InternalUtilities\EmbeddedResource.cs
src\InternalUtilities\samples\InternalUtilities\EnumerableExtensions.cs = src\InternalUtilities\samples\InternalUtilities\EnumerableExtensions.cs
src\InternalUtilities\samples\InternalUtilities\Env.cs = src\InternalUtilities\samples\InternalUtilities\Env.cs
src\InternalUtilities\samples\InternalUtilities\JsonResultTranslator.cs = src\InternalUtilities\samples\InternalUtilities\JsonResultTranslator.cs
src\InternalUtilities\samples\InternalUtilities\ObjectExtensions.cs = src\InternalUtilities\samples\InternalUtilities\ObjectExtensions.cs
src\InternalUtilities\samples\InternalUtilities\RepoFiles.cs = src\InternalUtilities\samples\InternalUtilities\RepoFiles.cs
src\InternalUtilities\samples\InternalUtilities\TestConfiguration.cs = src\InternalUtilities\samples\InternalUtilities\TestConfiguration.cs
src\InternalUtilities\samples\InternalUtilities\TextOutputHelperExtensions.cs = src\InternalUtilities\samples\InternalUtilities\TextOutputHelperExtensions.cs
src\InternalUtilities\samples\InternalUtilities\XunitLogger.cs = src\InternalUtilities\samples\InternalUtilities\XunitLogger.cs
src\InternalUtilities\samples\InternalUtilities\YourAppException.cs = src\InternalUtilities\samples\InternalUtilities\YourAppException.cs
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Agents", "Agents", "{5C6C30E0-7AC1-47F4-8244-57B066B43FD8}"
ProjectSection(SolutionItems) = preProject
src\InternalUtilities\samples\AgentUtilities\BaseAgentsTest.cs = src\InternalUtilities\samples\AgentUtilities\BaseAgentsTest.cs
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StepwisePlannerMigration", "samples\Demos\StepwisePlannerMigration\StepwisePlannerMigration.csproj", "{2A6B056D-B35A-4CCE-80EE-0307EA9C3A57}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -839,10 +851,6 @@ Global
{ACD8C464-AEC9-45F6-A458-50A84F353DB7}.Publish|Any CPU.Build.0 = Debug|Any CPU
{ACD8C464-AEC9-45F6-A458-50A84F353DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACD8C464-AEC9-45F6-A458-50A84F353DB7}.Release|Any CPU.Build.0 = Release|Any CPU
{38374C62-0263-4FE8-A18C-70FC8132912B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38374C62-0263-4FE8-A18C-70FC8132912B}.Publish|Any CPU.ActiveCfg = Debug|Any CPU
{38374C62-0263-4FE8-A18C-70FC8132912B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{38374C62-0263-4FE8-A18C-70FC8132912B}.Release|Any CPU.Build.0 = Release|Any CPU
{E06818E3-00A5-41AC-97ED-9491070CDEA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E06818E3-00A5-41AC-97ED-9491070CDEA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E06818E3-00A5-41AC-97ED-9491070CDEA1}.Publish|Any CPU.ActiveCfg = Debug|Any CPU
Expand All @@ -861,6 +869,12 @@ Global
{4326A974-F027-4ABD-A220-382CC6BB0801}.Publish|Any CPU.Build.0 = Debug|Any CPU
{4326A974-F027-4ABD-A220-382CC6BB0801}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4326A974-F027-4ABD-A220-382CC6BB0801}.Release|Any CPU.Build.0 = Release|Any CPU
{2A6B056D-B35A-4CCE-80EE-0307EA9C3A57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A6B056D-B35A-4CCE-80EE-0307EA9C3A57}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A6B056D-B35A-4CCE-80EE-0307EA9C3A57}.Publish|Any CPU.ActiveCfg = Debug|Any CPU
{2A6B056D-B35A-4CCE-80EE-0307EA9C3A57}.Publish|Any CPU.Build.0 = Debug|Any CPU
{2A6B056D-B35A-4CCE-80EE-0307EA9C3A57}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A6B056D-B35A-4CCE-80EE-0307EA9C3A57}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -975,12 +989,14 @@ Global
{738DCDB1-EFA8-4913-AD4C-6FC3F09B0A0C} = {2E79AD99-632F-411F-B3A5-1BAF3F5F89AB}
{8642A03F-D840-4B2E-B092-478300000F83} = {0247C2C9-86C3-45BA-8873-28B0948EDC0C}
{ACD8C464-AEC9-45F6-A458-50A84F353DB7} = {0247C2C9-86C3-45BA-8873-28B0948EDC0C}
{38374C62-0263-4FE8-A18C-70FC8132912B} = {5D4C0700-BBB5-418F-A7B2-F392B9A18263}
{E06818E3-00A5-41AC-97ED-9491070CDEA1} = {5D4C0700-BBB5-418F-A7B2-F392B9A18263}
{F8B82F6B-B16A-4F8C-9C41-E9CD8D79A098} = {5D4C0700-BBB5-418F-A7B2-F392B9A18263}
{6B268108-2AB5-4607-B246-06AD8410E60E} = {4BB70FB3-1EC0-4F4A-863B-273D6C6D4D9A}
{4BB70FB3-1EC0-4F4A-863B-273D6C6D4D9A} = {F8B82F6B-B16A-4F8C-9C41-E9CD8D79A098}
{4326A974-F027-4ABD-A220-382CC6BB0801} = {4BB70FB3-1EC0-4F4A-863B-273D6C6D4D9A}
{EE454832-085F-4D37-B19B-F94F7FC6984A} = {77E141BA-AF5E-4C01-A970-6C07AC3CD55A}
{5C6C30E0-7AC1-47F4-8244-57B066B43FD8} = {77E141BA-AF5E-4C01-A970-6C07AC3CD55A}
{2A6B056D-B35A-4CCE-80EE-0307EA9C3A57} = {5D4C0700-BBB5-418F-A7B2-F392B9A18263}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FBDC56A3-86AD-4323-AA0F-201E59123B83}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Agents;
/// Demonstrate usage of <see cref="IAutoFunctionInvocationFilter"/> for both direction invocation
/// of <see cref="ChatCompletionAgent"/> and via <see cref="AgentChat"/>.
/// </summary>
public class ChatCompletion_FunctionTermination(ITestOutputHelper output) : BaseTest(output)
public class ChatCompletion_FunctionTermination(ITestOutputHelper output) : BaseAgentsTest(output)
{
[Fact]
public async Task UseAutoFunctionInvocationFilterWithAgentInvocationAsync()
Expand Down Expand Up @@ -44,25 +44,25 @@ public async Task UseAutoFunctionInvocationFilterWithAgentInvocationAsync()
Console.WriteLine("================================");
foreach (ChatMessageContent message in chat)
{
this.WriteContent(message);
this.WriteAgentChatMessage(message);
}

// Local function to invoke agent and display the conversation messages.
async Task InvokeAgentAsync(string input)
{
ChatMessageContent userContent = new(AuthorRole.User, input);
chat.Add(userContent);
this.WriteContent(userContent);
ChatMessageContent message = new(AuthorRole.User, input);
chat.Add(message);
this.WriteAgentChatMessage(message);

await foreach (ChatMessageContent content in agent.InvokeAsync(chat))
await foreach (ChatMessageContent response in agent.InvokeAsync(chat))
{
// Do not add a message implicitly added to the history.
if (!content.Items.Any(i => i is FunctionCallContent || i is FunctionResultContent))
if (!response.Items.Any(i => i is FunctionCallContent || i is FunctionResultContent))
{
chat.Add(content);
chat.Add(response);
}

this.WriteContent(content);
this.WriteAgentChatMessage(response);
}
}
}
Expand Down Expand Up @@ -98,28 +98,23 @@ public async Task UseAutoFunctionInvocationFilterWithAgentChatAsync()
ChatMessageContent[] history = await chat.GetChatMessagesAsync().ToArrayAsync();
for (int index = history.Length; index > 0; --index)
{
this.WriteContent(history[index - 1]);
this.WriteAgentChatMessage(history[index - 1]);
}

// Local function to invoke agent and display the conversation messages.
async Task InvokeAgentAsync(string input)
{
ChatMessageContent userContent = new(AuthorRole.User, input);
chat.AddChatMessage(userContent);
this.WriteContent(userContent);
ChatMessageContent message = new(AuthorRole.User, input);
chat.AddChatMessage(message);
this.WriteAgentChatMessage(message);

await foreach (ChatMessageContent content in chat.InvokeAsync(agent))
await foreach (ChatMessageContent response in chat.InvokeAsync(agent))
{
this.WriteContent(content);
this.WriteAgentChatMessage(response);
}
}
}

private void WriteContent(ChatMessageContent content)
{
Console.WriteLine($"[{content.Items.LastOrDefault()?.GetType().Name ?? "(empty)"}] {content.Role} : '{content.Content}'");
}

private Kernel CreateKernelWithFilter()
{
IKernelBuilder builder = Kernel.CreateBuilder();
Expand Down
23 changes: 12 additions & 11 deletions dotnet/samples/Concepts/Agents/ChatCompletion_Streaming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Agents;
/// Demonstrate creation of <see cref="ChatCompletionAgent"/> and
/// eliciting its response to three explicit user messages.
/// </summary>
public class ChatCompletion_Streaming(ITestOutputHelper output) : BaseTest(output)
public class ChatCompletion_Streaming(ITestOutputHelper output) : BaseAgentsTest(output)
{
private const string ParrotName = "Parrot";
private const string ParrotInstructions = "Repeat the user message in the voice of a pirate and then end with a parrot sound.";
Expand Down Expand Up @@ -66,32 +66,33 @@ public async Task UseStreamingChatCompletionAgentWithPluginAsync()
// Local function to invoke agent and display the conversation messages.
private async Task InvokeAgentAsync(ChatCompletionAgent agent, ChatHistory chat, string input)
{
chat.Add(new ChatMessageContent(AuthorRole.User, input));

Console.WriteLine($"# {AuthorRole.User}: '{input}'");
ChatMessageContent message = new(AuthorRole.User, input);
chat.Add(message);
this.WriteAgentChatMessage(message);

StringBuilder builder = new();
await foreach (StreamingChatMessageContent message in agent.InvokeStreamingAsync(chat))
await foreach (StreamingChatMessageContent response in agent.InvokeStreamingAsync(chat))
{
if (string.IsNullOrEmpty(message.Content))
if (string.IsNullOrEmpty(response.Content))
{
continue;
}

if (builder.Length == 0)
{
Console.WriteLine($"# {message.Role} - {message.AuthorName ?? "*"}:");
Console.WriteLine($"# {response.Role} - {response.AuthorName ?? "*"}:");
}

Console.WriteLine($"\t > streamed: '{message.Content}'");
builder.Append(message.Content);
Console.WriteLine($"\t > streamed: '{response.Content}'");
builder.Append(response.Content);
}

if (builder.Length > 0)
{
// Display full response and capture in chat history
Console.WriteLine($"\t > complete: '{builder}'");
chat.Add(new ChatMessageContent(AuthorRole.Assistant, builder.ToString()) { AuthorName = agent.Name });
ChatMessageContent response = new(AuthorRole.Assistant, builder.ToString()) { AuthorName = agent.Name };
chat.Add(response);
this.WriteAgentChatMessage(response);
}
}

Expand Down
18 changes: 8 additions & 10 deletions dotnet/samples/Concepts/Agents/ComplexChat_NestedShopper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ namespace Agents;
/// Demonstrate usage of <see cref="KernelFunctionTerminationStrategy"/> and <see cref="KernelFunctionSelectionStrategy"/>
/// to manage <see cref="AgentGroupChat"/> execution.
/// </summary>
public class ComplexChat_NestedShopper(ITestOutputHelper output) : BaseTest(output)
public class ComplexChat_NestedShopper(ITestOutputHelper output) : BaseAgentsTest(output)
{
protected override bool ForceOpenAI => true;

private const string InternalLeaderName = "InternalLeader";
private const string InternalLeaderInstructions =
"""
Expand Down Expand Up @@ -154,20 +152,20 @@ public async Task NestedChatWithAggregatorAgentAsync()
Console.WriteLine(">>>> AGGREGATED CHAT");
Console.WriteLine(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");

await foreach (ChatMessageContent content in chat.GetChatMessagesAsync(personalShopperAgent).Reverse())
await foreach (ChatMessageContent message in chat.GetChatMessagesAsync(personalShopperAgent).Reverse())
{
Console.WriteLine($">>>> {content.Role} - {content.AuthorName ?? "*"}: '{content.Content}'");
this.WriteAgentChatMessage(message);
}

async Task InvokeChatAsync(string input)
{
chat.AddChatMessage(new ChatMessageContent(AuthorRole.User, input));

Console.WriteLine($"# {AuthorRole.User}: '{input}'");
ChatMessageContent message = new(AuthorRole.User, input);
chat.AddChatMessage(message);
this.WriteAgentChatMessage(message);

await foreach (ChatMessageContent content in chat.InvokeAsync(personalShopperAgent))
await foreach (ChatMessageContent response in chat.InvokeAsync(personalShopperAgent))
{
Console.WriteLine($"# {content.Role} - {content.AuthorName ?? "*"}: '{content.Content}'");
this.WriteAgentChatMessage(response);
}

Console.WriteLine($"\n# IS COMPLETE: {chat.IsComplete}");
Expand Down
12 changes: 3 additions & 9 deletions dotnet/samples/Concepts/Agents/Legacy_AgentAuthoring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ namespace Agents;
/// </summary>
public class Legacy_AgentAuthoring(ITestOutputHelper output) : BaseTest(output)
{
/// <summary>
/// Specific model is required that supports agents and parallel function calling.
/// Currently this is limited to Open AI hosted services.
/// </summary>
private const string OpenAIFunctionEnabledModel = "gpt-4-1106-preview";

// Track agents for clean-up
private static readonly List<IAgent> s_agents = [];

Expand Down Expand Up @@ -72,7 +66,7 @@ private static async Task<IAgent> CreateArticleGeneratorAsync()
return
Track(
await new AgentBuilder()
.WithOpenAIChatCompletion(OpenAIFunctionEnabledModel, TestConfiguration.OpenAI.ApiKey)
.WithOpenAIChatCompletion(TestConfiguration.OpenAI.ChatModelId, TestConfiguration.OpenAI.ApiKey)
.WithInstructions("You write concise opinionated articles that are published online. Use an outline to generate an article with one section of prose for each top-level outline element. Each section is based on research with a maximum of 120 words.")
.WithName("Article Author")
.WithDescription("Author an article on a given topic.")
Expand All @@ -87,7 +81,7 @@ private static async Task<IAgent> CreateOutlineGeneratorAsync()
return
Track(
await new AgentBuilder()
.WithOpenAIChatCompletion(OpenAIFunctionEnabledModel, TestConfiguration.OpenAI.ApiKey)
.WithOpenAIChatCompletion(TestConfiguration.OpenAI.ChatModelId, TestConfiguration.OpenAI.ApiKey)
.WithInstructions("Produce an single-level outline (no child elements) based on the given topic with at most 3 sections.")
.WithName("Outline Generator")
.WithDescription("Generate an outline.")
Expand All @@ -100,7 +94,7 @@ private static async Task<IAgent> CreateResearchGeneratorAsync()
return
Track(
await new AgentBuilder()
.WithOpenAIChatCompletion(OpenAIFunctionEnabledModel, TestConfiguration.OpenAI.ApiKey)
.WithOpenAIChatCompletion(TestConfiguration.OpenAI.ChatModelId, TestConfiguration.OpenAI.ApiKey)
.WithInstructions("Provide insightful research that supports the given topic based on your knowledge of the outline topic.")
.WithName("Researcher")
.WithDescription("Author research summary.")
Expand Down
Loading
Loading