Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
48 lines (43 loc) · 2.29 KB

File metadata and controls

48 lines (43 loc) · 2.29 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using Azure.AI.OpenAI;
using Azure.Identity;
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
using Microsoft.Agents.AI.Hosting.AzureFunctions;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
class Program
{
public static async Task Main(string[] args)
{
var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set.");
var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME") ?? "gpt-4.1-mini";
AzureOpenAIClient client = new AzureOpenAIClient(new Uri(endpoint), new DefaultAzureCredential());
// Put following mcp.json file in the root of your function app to enable MCP server. The url should be your function app url plus "/runtime/webhooks/mcp/sse".
// {
// "servers": {
// "mine-mcp-server-local": {
// "type": "sse",
// "url": "https://your-appservice-name.azurewebsites.net/runtime/webhooks/mcp/sse"
// }
// }
// }
AIAgent agent = client.GetChatClient(deploymentName).AsIChatClient().AsAIAgent(
instructions: @"In this Normalian project, to facilitate management, class names must follow naming conventions based on business categories.
Class names according to business categories are provided by the `GenerateClassNamingConvention` tool.
Please define classes using the names provided here. Do not define classes with any other names.
If you are unsure about the business category from the class name, use the `DetermineBusinessCategory` tool to obtain the business category.",
name: "NormalianMyProjectAdvisor",
description: "This tool describes naming rule overview of the Normalian project.");
using IHost app = FunctionsApplication
.CreateBuilder(args)
.ConfigureFunctionsWebApplication()
.ConfigureDurableAgents(options =>
{
options.AddAIAgent(agent, enableHttpTrigger: false, enableMcpToolTrigger: true);
})
.Build();
app.Run();
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.