Skip to content

Commit 74184e5

Browse files
Update to latest Agent pattern
1 parent a712b62 commit 74184e5

File tree

1 file changed

+3
-10
lines changed
  • dotnet/samples/Demos/ModelContextProtocolPlugin

1 file changed

+3
-10
lines changed

dotnet/samples/Demos/ModelContextProtocolPlugin/Program.cs

+3-10
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,14 @@
7373
Console.WriteLine($"\n\n{prompt}\n{result}");
7474

7575
// Define the agent
76-
ChatCompletionAgent agent =
77-
new()
76+
ChatCompletionAgent agent = new()
7877
{
7978
Instructions = "Answer questions about GitGub repositories.",
8079
Name = "GitHubAgent",
8180
Kernel = kernel,
8281
Arguments = new KernelArguments(new PromptExecutionSettings() { FunctionChoiceBehavior = FunctionChoiceBehavior.Auto() }),
8382
};
8483

85-
/// Create the chat history thread to capture the agent interaction.
86-
AgentThread thread = new ChatHistoryAgentThread();
87-
8884
// Respond to user input, invoking functions where appropriate.
89-
Console.WriteLine("\n\nResponse from GitHubAgent:");
90-
await foreach (ChatMessageContent response in agent.InvokeAsync("Summarize the last four commits to the microsoft/semantic-kernel repository?", thread))
91-
{
92-
Console.WriteLine(response.Content);
93-
}
85+
ChatMessageContent response = await agent.InvokeAsync("Summarize the last four commits to the microsoft/semantic-kernel repository?").FirstAsync();
86+
Console.WriteLine($"\n\nResponse from GitHubAgent:\n{response.Content}");

0 commit comments

Comments
 (0)