mirror of
https://github.com/microsoft/autogen.git
synced 2025-07-11 19:11:39 +00:00
86 lines
2.5 KiB
C#
86 lines
2.5 KiB
C#
![]() |
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
|
// BasicSampleTest.cs
|
|||
|
|
|||
|
using System;
|
|||
|
using System.IO;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using AutoGen.BasicSample;
|
|||
|
using Xunit.Abstractions;
|
|||
|
|
|||
|
namespace AutoGen.Tests
|
|||
|
{
|
|||
|
public class BasicSampleTest
|
|||
|
{
|
|||
|
private readonly ITestOutputHelper _output;
|
|||
|
|
|||
|
public BasicSampleTest(ITestOutputHelper output)
|
|||
|
{
|
|||
|
_output = output;
|
|||
|
Console.SetOut(new ConsoleWriter(_output));
|
|||
|
}
|
|||
|
|
|||
|
[ApiKeyFact("AZURE_OPENAI_API_KEY", "AZURE_OPENAI_ENDPOINT")]
|
|||
|
public async Task AssistantAgentTestAsync()
|
|||
|
{
|
|||
|
await Example01_AssistantAgent.RunAsync();
|
|||
|
}
|
|||
|
|
|||
|
[ApiKeyFact("AZURE_OPENAI_API_KEY", "AZURE_OPENAI_ENDPOINT")]
|
|||
|
public async Task TwoAgentMathClassTestAsync()
|
|||
|
{
|
|||
|
await Example02_TwoAgent_MathChat.RunAsync();
|
|||
|
}
|
|||
|
|
|||
|
[ApiKeyFact("AZURE_OPENAI_API_KEY", "AZURE_OPENAI_ENDPOINT")]
|
|||
|
public async Task AgentFunctionCallTestAsync()
|
|||
|
{
|
|||
|
await Example03_Agent_FunctionCall.RunAsync();
|
|||
|
}
|
|||
|
|
|||
|
[ApiKeyFact("AZURE_OPENAI_API_KEY", "AZURE_OPENAI_ENDPOINT")]
|
|||
|
public async Task OpenAIAgent_JsonMode()
|
|||
|
{
|
|||
|
await Example13_OpenAIAgent_JsonMode.RunAsync();
|
|||
|
}
|
|||
|
|
|||
|
[ApiKeyFact("MISTRAL_API_KEY")]
|
|||
|
public async Task MistralClientAgent_TokenCount()
|
|||
|
{
|
|||
|
await Example14_MistralClientAgent_TokenCount.RunAsync();
|
|||
|
}
|
|||
|
|
|||
|
[ApiKeyFact("OPENAI_API_KEY")]
|
|||
|
public async Task DynamicGroupChatGetMLNetPRTestAsync()
|
|||
|
{
|
|||
|
await Example04_Dynamic_GroupChat_Coding_Task.RunAsync();
|
|||
|
}
|
|||
|
|
|||
|
[ApiKeyFact("AZURE_OPENAI_API_KEY", "AZURE_OPENAI_ENDPOINT")]
|
|||
|
public async Task DynamicGroupChatCalculateFibonacciAsync()
|
|||
|
{
|
|||
|
await Example07_Dynamic_GroupChat_Calculate_Fibonacci.RunAsync();
|
|||
|
await Example07_Dynamic_GroupChat_Calculate_Fibonacci.RunWorkflowAsync();
|
|||
|
}
|
|||
|
|
|||
|
[ApiKeyFact("OPENAI_API_KEY")]
|
|||
|
public async Task DalleAndGPT4VTestAsync()
|
|||
|
{
|
|||
|
await Example05_Dalle_And_GPT4V.RunAsync();
|
|||
|
}
|
|||
|
|
|||
|
public class ConsoleWriter : StringWriter
|
|||
|
{
|
|||
|
private ITestOutputHelper output;
|
|||
|
public ConsoleWriter(ITestOutputHelper output)
|
|||
|
{
|
|||
|
this.output = output;
|
|||
|
}
|
|||
|
|
|||
|
public override void WriteLine(string? m)
|
|||
|
{
|
|||
|
output.WriteLine(m);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|