mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
0965a83dcd
* Updated * Update dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Agents/VisionAgentProvider.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Consistency --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
36 lines
1.2 KiB
C#
36 lines
1.2 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 VisionAgentProvider(IConfiguration configuration) : AgentProvider(configuration)
|
|
{
|
|
protected override async IAsyncEnumerable<AgentVersion> CreateAgentsAsync(Uri foundryEndpoint)
|
|
{
|
|
AIProjectClient aiProjectClient = new(foundryEndpoint, new AzureCliCredential());
|
|
|
|
yield return
|
|
await aiProjectClient.CreateAgentAsync(
|
|
agentName: "VisionAgent",
|
|
agentDefinition: this.DefineVisionAgent(),
|
|
agentDescription: "Use computer vision to describe an image or document.");
|
|
}
|
|
|
|
private PromptAgentDefinition DefineVisionAgent() =>
|
|
new(this.GetSetting(Settings.FoundryModelFull))
|
|
{
|
|
Instructions =
|
|
"""
|
|
Describe the image or document contained in the user request, if any;
|
|
otherwise, suggest that the user provide an image or document.
|
|
""",
|
|
};
|
|
}
|