mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
33 lines
742 B
C#
33 lines
742 B
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using HelloHttpApi.ApiService;
|
|
using HelloHttpApi.ApiService.Utilities;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add service defaults & Aspire client integrations.
|
|
builder.AddServiceDefaults();
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddProblemDetails();
|
|
|
|
// Configure the chat model and our agent.
|
|
builder.AddKeyedChatClient("chat-model");
|
|
|
|
builder.AddAIAgent(
|
|
name: "pirate",
|
|
instructions: "You are a pirate. Speak like a pirate.",
|
|
chatClientKey: "chat-model");
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
app.UseExceptionHandler();
|
|
|
|
// Map the agents HTTP endpoints
|
|
app.MapAgents();
|
|
|
|
app.MapDefaultEndpoints();
|
|
|
|
app.Run();
|