.NET: Fix samples, improve readme language and add readme to sln. (#942)

* Fix samples, improve readme language and add readme to sln.

* Fix threading in openai samples too.
This commit is contained in:
westey
2025-09-27 06:48:26 +00:00
committed by GitHub
parent 28ad256931
commit 499838565e
6 changed files with 80 additions and 54 deletions
@@ -22,8 +22,9 @@ async Task SKAgentAsync()
{
Console.WriteLine("\n=== SK Agent ===\n");
OpenAIResponseAgent agent = new(new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName))
var responseClient = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
.GetOpenAIResponseClient(deploymentName);
OpenAIResponseAgent agent = new(responseClient)
{
Name = "Joker",
Instructions = "You are good at telling jokes.",
@@ -31,7 +32,7 @@ async Task SKAgentAsync()
var agentOptions = new OpenAIResponseAgentInvokeOptions() { ResponseCreationOptions = new() { MaxOutputTokenCount = 1000 } };
Microsoft.SemanticKernel.Agents.AgentThread? thread = null;
Microsoft.SemanticKernel.Agents.AgentThread? thread = new OpenAIResponseAgentThread(responseClient);
await foreach (var item in agent.InvokeAsync(userInput, thread, agentOptions))
{
Console.WriteLine(item.Message);