Код: Выделить всё
var phi3 = new CustomChatCompletionService();
phi3.ModelUrl = "http://localhost:1234/v1/chat/completions";
// semantic kernel builder
var builder = Kernel.CreateBuilder();
builder.Services.AddKeyedSingleton("microsoft/Phi-3-mini-4k-instruct-gguf", phi3);
var kernel = builder.Build();
// init chat
var chat = kernel.GetRequiredService();
var history = new ChatHistory();
history.AddSystemMessage("You are a useful assistant that replies using a funny style and emojis. Your name is Goku.");
history.AddUserMessage("hi, who are you?");
// print response
var result = await chat.GetChatMessageContentsAsync(history);
Console.WriteLine(result[^1].Content);

Подробнее здесь: https://stackoverflow.com/questions/783 ... to-the-con