mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
6dc65dbaa1
* Increase credential timeout for Integration Tests * Fix format error. * Update further tests * Fix comment * Rename credentials file and class. * Fix broken reference.
45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Azure.AI.Projects;
|
|
using Azure.AI.Projects.OpenAI;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Shared.Foundry;
|
|
using Shared.IntegrationTests;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.Agents;
|
|
|
|
internal sealed class PoemAgentProvider(IConfiguration configuration) : AgentProvider(configuration)
|
|
{
|
|
protected override async IAsyncEnumerable<AgentVersion> CreateAgentsAsync(Uri foundryEndpoint)
|
|
{
|
|
AIProjectClient aiProjectClient = new(foundryEndpoint, TestAzureCliCredentials.CreateAzureCliCredential());
|
|
|
|
yield return
|
|
await aiProjectClient.CreateAgentAsync(
|
|
agentName: "PoemAgent",
|
|
agentDefinition: this.DefinePoemAgent(),
|
|
agentDescription: "Authors original poems");
|
|
}
|
|
|
|
private PromptAgentDefinition DefinePoemAgent() =>
|
|
new(this.GetSetting(TestSettings.AzureAIModelDeploymentName))
|
|
{
|
|
Instructions =
|
|
"""
|
|
Write a one verse poem on the requested topic in the style of: {{style}}.
|
|
""",
|
|
StructuredInputs =
|
|
{
|
|
["style"] =
|
|
new StructuredInputDefinition
|
|
{
|
|
IsRequired = false,
|
|
DefaultValue = BinaryData.FromString(@"""haiku"""),
|
|
Description = "The style of poem to write",
|
|
}
|
|
}
|
|
};
|
|
}
|