-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBenchmarkCatalog.cs
More file actions
67 lines (58 loc) · 2.51 KB
/
Copy pathBenchmarkCatalog.cs
File metadata and controls
67 lines (58 loc) · 2.51 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System.Globalization;
using ManagedCode.MCPGateway.Abstractions;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
namespace ManagedCode.MCPGateway.Benchmarks;
internal static class BenchmarkCatalog
{
public const int ToolCount = 120;
public const string WeatherQuery = "umbrella planning for region seven";
public const string PortfolioQuery = "brokerage holdings snapshot for acme";
public const string ArchiveQuery = "genealogy record archive lookup";
public static ServiceProvider CreateGraphServiceProvider()
{
var services = new ServiceCollection();
services.AddLogging();
services.AddMcpGateway(options =>
{
options.SearchStrategy = McpGatewaySearchStrategy.Graph;
ConfigureCatalog(options);
});
return services.BuildServiceProvider();
}
public static async Task<BenchmarkGatewayHost> CreateBuiltGraphGatewayAsync()
{
var serviceProvider = CreateGraphServiceProvider();
var gateway = serviceProvider.GetRequiredService<IMcpGateway>();
await gateway.BuildIndexAsync();
var toolSet = serviceProvider.GetRequiredService<McpGatewayToolSet>();
return new BenchmarkGatewayHost(serviceProvider, gateway, toolSet);
}
public static void ConfigureCatalog(McpGatewayOptions options)
{
for (var index = 1; index <= ToolCount; index++)
{
var toolIndex = index.ToString("D3", CultureInfo.InvariantCulture);
var name = $"archive_lookup_{toolIndex}";
var description = $"Handle archive lookup workflow number {toolIndex} for genealogy records.";
if (index == 81)
{
name = "weather_dispatch_specialist";
description =
"Get weather forecast, rain, wind, umbrella planning, and precipitation details for a city or region.";
}
else if (index == 82)
{
name = "portfolio_status_specialist";
description =
"Summarize brokerage holdings, market value, exposure, investment risk, and account snapshots.";
}
options.AddTool("local", CreateTool(name, description));
}
}
private static AITool CreateTool(string name, string description) =>
AIFunctionFactory.Create(
static (string query) => $"benchmark:{query}",
new AIFunctionFactoryOptions { Name = name, Description = description }
);
}