mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Remove FoundryResponsesRepl and empty FoundryResponsesHosting directory
This commit is contained in:
@@ -261,7 +261,6 @@
|
||||
<Project Path="samples/03-workflows/_StartHere/07_WriterCriticWorkflow/07_WriterCriticWorkflow.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/Samples/04-hosting/">
|
||||
<Project Path="samples/04-hosting/FoundryResponsesRepl/FoundryResponsesRepl.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/Samples/04-hosting/FoundryHostedAgents/" />
|
||||
<Folder Name="/Samples/04-hosting/FoundryHostedAgents/invocations/" />
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"profiles": {
|
||||
"FoundryResponsesHosting": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:54747;http://localhost:54748"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net10.0</TargetFrameworks>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
|
||||
<NoWarn>$(NoWarn);NU1903;NU1605</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Azure.Core" />
|
||||
<PackageReference Include="OpenAI" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.Agents.AI.OpenAI\Microsoft.Agents.AI.OpenAI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,106 +0,0 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
// Foundry Responses Client REPL
|
||||
//
|
||||
// Connects to a Foundry Responses agent running on a given endpoint
|
||||
// and provides an interactive multi-turn chat REPL.
|
||||
//
|
||||
// Usage:
|
||||
// dotnet run (connects to http://localhost:8088)
|
||||
// dotnet run -- --endpoint http://localhost:9090
|
||||
// dotnet run -- --endpoint https://my-foundry-project.services.ai.azure.com
|
||||
//
|
||||
// The endpoint should be running a Foundry Responses server (POST /responses).
|
||||
|
||||
using System.ClientModel;
|
||||
using Microsoft.Agents.AI;
|
||||
using OpenAI;
|
||||
using OpenAI.Responses;
|
||||
|
||||
// ── Parse args ────────────────────────────────────────────────────────────────
|
||||
|
||||
string endpointUrl = "http://localhost:8088";
|
||||
for (int i = 0; i < args.Length - 1; i++)
|
||||
{
|
||||
if (args[i] is "--endpoint" or "-e")
|
||||
{
|
||||
endpointUrl = args[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
// ── Create an agent-framework agent backed by the remote Responses endpoint ──
|
||||
|
||||
// The OpenAI SDK's ResponsesClient can target any OpenAI-compatible endpoint.
|
||||
// We use a dummy API key since our local server doesn't require auth.
|
||||
var credential = new ApiKeyCredential(
|
||||
Environment.GetEnvironmentVariable("RESPONSES_API_KEY") ?? "no-key-needed");
|
||||
|
||||
var openAiClient = new OpenAIClient(
|
||||
credential,
|
||||
new OpenAIClientOptions { Endpoint = new Uri(endpointUrl) });
|
||||
|
||||
ResponsesClient responsesClient = openAiClient.GetResponsesClient();
|
||||
|
||||
// Wrap as an agent-framework AIAgent via the OpenAI extensions.
|
||||
// We pass an empty model since hosted agents use their own model configuration.
|
||||
AIAgent agent = responsesClient.AsAIAgent(
|
||||
model: "",
|
||||
name: "remote-agent");
|
||||
|
||||
// Create a session so multi-turn context is preserved via previous_response_id
|
||||
AgentSession session = await agent.CreateSessionAsync();
|
||||
|
||||
// ── REPL ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
Console.WriteLine("╔══════════════════════════════════════════════════════════╗");
|
||||
Console.WriteLine("║ Foundry Responses Client REPL ║");
|
||||
Console.WriteLine($"║ Connected to: {endpointUrl,-41}║");
|
||||
Console.WriteLine("║ Type a message or 'quit' to exit ║");
|
||||
Console.WriteLine("╚══════════════════════════════════════════════════════════╝");
|
||||
Console.ResetColor();
|
||||
Console.WriteLine();
|
||||
|
||||
while (true)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.Write("You> ");
|
||||
Console.ResetColor();
|
||||
|
||||
string? input = Console.ReadLine();
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (input.Equals("quit", StringComparison.OrdinalIgnoreCase) ||
|
||||
input.Equals("exit", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.Write("Agent> ");
|
||||
Console.ResetColor();
|
||||
|
||||
// Stream the response token-by-token
|
||||
await foreach (var update in agent.RunStreamingAsync(input, session))
|
||||
{
|
||||
Console.Write(update);
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine($"Error: {ex.Message}");
|
||||
Console.ResetColor();
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
Console.WriteLine("Goodbye!");
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"profiles": {
|
||||
"FoundryResponsesRepl": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:61980;http://localhost:61981"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user