2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2026-03-31 18:38:22 +00:00
Files
esiur-dotnet/Tests/Annotations/Program.cs
2026-03-20 00:56:24 +03:00

81 lines
2.1 KiB
C#

// The endpoint for LM Studio's local server
using Esiur.Resource;
using Esiur.Stores;
using Esiur.Tests.Annotations;
using OpenAI;
using OpenAI.Chat;
using System.ClientModel;
using System.Data;
var endpoint = "http://localhost:1234/v1";
var credential = new ApiKeyCredential("lm-studio");
////var client = new OpenAIClient(credential, new OpenAIClientOptions() { Endpoint = new Uri(endpoint) });
////var chat = client.GetChatClient("microsoft/phi-4");
//var llmRunner = new LlmRunner();
//await llmRunner.RunAsync(
// node,
// endpoint,
// credential,
// "microsoft/phi-4"
//);
var runner = new LlmRunner();
var models = new List<ModelConfig>
{
new()
{
Name = "Phi-4",
Endpoint = "http://localhost:1234/v1",
ApiKey = new ApiKeyCredential("lm-studio"),
ModelName = "microsoft/phi-4"
},
new()
{
Name = "Qwen2.5-7B",
Endpoint = "http://localhost:1234/v1",
ApiKey = new ApiKeyCredential("lm-studio"),
ModelName = "qwen2.5-7b-instruct"
},
new()
{
Name = "gpt-oss",
Endpoint = "http://localhost:1234/v1",
ApiKey = new ApiKeyCredential("lm-studio"),
ModelName = "openai/gpt-oss-20b"
},
new()
{
Name = "qwen2.5-1.5b-instruct",
Endpoint = "http://localhost:1234/v1",
ApiKey = new ApiKeyCredential("lm-studio"),
ModelName = "qwen2.5-1.5b-instruct"
},
new()
{
Name = "ministral-3-3b",
Endpoint = "http://localhost:1234/v1",
ApiKey = new ApiKeyCredential("lm-studio"),
ModelName = "mistralai/ministral-3-3b"
},
new()
{
Name = "deepseek-r1-0528-qwen3-8b",
Endpoint = "http://localhost:1234/v1",
ApiKey = new ApiKeyCredential("lm-studio"),
ModelName = "deepseek/deepseek-r1-0528-qwen3-8b"
}
};
var (results, summary) = await runner.RunAsync( models.Skip(5).Take(1).ToArray(),
250);
foreach (var item in summary)
{
Console.WriteLine($"{item.Model}: Correct={item.CorrectRate:F1}% Repair={item.RepairRate:F1}% Mean={item.MeanLatencyMs:F1} ms P95={item.P95LatencyMs:F1} ms");
}