mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET: [BREAKING] Rename AgentThread to AgentSession (#3430)
* Rename AgentThread to AgentSession * Add more renames * Update readme files * Revert nullable variable change and further fixes. * Revert change in header name * Fix some comments and tests * Update changelog. * Address PR feedback. * Fixing code review comments. * Fix new errors after merging latest code.
This commit is contained in:
committed by
GitHub
Unverified
parent
bbe096a764
commit
a3a9147e61
+5
-5
@@ -30,12 +30,12 @@ AIAgent agent = new AzureOpenAIClient(
|
||||
.AsAIAgent(instructions: "You are a helpful assistant", tools: [new ApprovalRequiredAIFunction(AIFunctionFactory.Create(GetWeather))]);
|
||||
|
||||
// Call the agent and check if there are any user input requests to handle.
|
||||
AgentThread thread = await agent.GetNewThreadAsync();
|
||||
var response = await agent.RunAsync("What is the weather like in Amsterdam?", thread);
|
||||
AgentSession session = await agent.GetNewSessionAsync();
|
||||
var response = await agent.RunAsync("What is the weather like in Amsterdam?", session);
|
||||
var userInputRequests = response.UserInputRequests.ToList();
|
||||
|
||||
// For streaming use:
|
||||
// var updates = await agent.RunStreamingAsync("What is the weather like in Amsterdam?", thread).ToListAsync();
|
||||
// var updates = await agent.RunStreamingAsync("What is the weather like in Amsterdam?", session).ToListAsync();
|
||||
// userInputRequests = updates.SelectMany(x => x.UserInputRequests).ToList();
|
||||
|
||||
while (userInputRequests.Count > 0)
|
||||
@@ -52,12 +52,12 @@ while (userInputRequests.Count > 0)
|
||||
.ToList();
|
||||
|
||||
// Pass the user input responses back to the agent for further processing.
|
||||
response = await agent.RunAsync(userInputResponses, thread);
|
||||
response = await agent.RunAsync(userInputResponses, session);
|
||||
|
||||
userInputRequests = response.UserInputRequests.ToList();
|
||||
|
||||
// For streaming use:
|
||||
// updates = await agent.RunStreamingAsync(userInputResponses, thread).ToListAsync();
|
||||
// updates = await agent.RunStreamingAsync(userInputResponses, session).ToListAsync();
|
||||
// userInputRequests = updates.SelectMany(x => x.UserInputRequests).ToList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user