mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET: Update Migration Samples for SK OpenAIResponsesAgent Step 1 & 2 (#1010)
* Addressing a SK bug where threads can't be reused + threads should be capture after the request, not created before * Using storedenabled to align with AF default behavior * Address copilot comment * Address Azure + OpenAI remaining sample improvements
This commit is contained in:
@@ -25,14 +25,16 @@ async Task SKAgentAsync()
|
||||
{
|
||||
Name = "Joker",
|
||||
Instructions = "You are good at telling jokes.",
|
||||
StoreEnabled = true
|
||||
};
|
||||
|
||||
var agentOptions = new OpenAIResponseAgentInvokeOptions() { ResponseCreationOptions = new() { MaxOutputTokenCount = 1000 } };
|
||||
|
||||
Microsoft.SemanticKernel.Agents.AgentThread? thread = new OpenAIResponseAgentThread(responseClient);
|
||||
Microsoft.SemanticKernel.Agents.AgentThread? thread = null;
|
||||
await foreach (var item in agent.InvokeAsync(userInput, thread, agentOptions))
|
||||
{
|
||||
Console.WriteLine(item.Message);
|
||||
thread = item.Thread;
|
||||
}
|
||||
|
||||
Console.WriteLine("---");
|
||||
|
||||
Reference in New Issue
Block a user