Files
agent-framework/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Agents/PoemAgentProvider.cs
T
Roger Barreto 0746d7751a .NET: Feature foundry agent/update breaking v2.0 to v1.2 (#2212)
* Migration WIP Checkpoint 1

* Build + UT + Workflow passing

* Address latest commits after break

* Revert rename in unrelated files

* Address PR comments

* Class renames
2025-11-14 12:20:56 +00:00

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 Azure.Identity;
using Microsoft.Extensions.Configuration;
using Shared.Foundry;
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, new AzureCliCredential());
yield return
await aiProjectClient.CreateAgentAsync(
agentName: "PoemAgent",
agentDefinition: this.DefinePoemAgent(),
agentDescription: "Authors original poems");
}
private PromptAgentDefinition DefinePoemAgent() =>
new(this.GetSetting(Settings.FoundryModelMini))
{
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",
}
}
};
}