Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8d06a62
Updated
crickman Jun 24, 2024
0b8f5a1
Outline
crickman Jun 24, 2024
f10eeee
Sample
crickman Jun 24, 2024
5ac0a10
Checkpoint
crickman Jun 24, 2024
00bd702
Merge branch 'main' into feature_agent_logging
crickman Jun 24, 2024
e1042ba
Merge branch 'feature_agent_logging' into feature_single_agent_patter…
crickman Jun 24, 2024
4f9f2c5
Checkpoint
crickman Jun 24, 2024
82a249a
Merge branch 'main' into feature_agent_logging
crickman Jun 24, 2024
c4df90a
Merge branch 'main' into feature_agent_logging
crickman Jun 25, 2024
a4d6969
Resolve merge
crickman Jun 25, 2024
178a305
Merge branch 'main' into feature_agent_logging
crickman Jun 25, 2024
a6c0c4a
Checkpoint
crickman Jun 25, 2024
a6bed6a
Merge branch 'feature_agent_logging' into feature_single_agent_patter…
crickman Jun 25, 2024
b78b243
Update sample
crickman Jun 25, 2024
b5b3c7f
Merge fix
crickman Jun 25, 2024
6df6e1f
Support thread access
crickman Jun 25, 2024
7b53c5a
Update assistant sample
crickman Jun 25, 2024
48ab517
Logger update
crickman Jun 25, 2024
c5aa3e6
Consistent naming
crickman Jun 25, 2024
25b0f07
Add thread clean-up to sample
crickman Jun 25, 2024
b873433
Merge branch 'main' into feature_single_agent_patterns_nochat
crickman Jun 25, 2024
57ba517
Comment cleanup
crickman Jun 25, 2024
b14244b
Rename
crickman Jun 25, 2024
0666ae8
Merge branch 'main' into feature_single_agent_patterns_nochat
crickman Jun 25, 2024
a34c789
Merge branch 'main' into feature_single_agent_patterns_nochat
crickman Jun 25, 2024
a14bf21
Merge branch 'main' into feature_single_agent_patterns_nochat
crickman Jun 25, 2024
a495eac
Merge branch 'main' into feature_single_agent_patterns_nochat
crickman Jun 26, 2024
51dcfb4
Merge branch 'main' into feature_single_agent_patterns_nochat
crickman Jun 27, 2024
191e789
Merge branch 'main' into feature_single_agent_patterns_nochat
crickman Jun 28, 2024
c1ef358
Merge branch 'main' into feature_single_agent_patterns_nochat
crickman Jul 1, 2024
07e82c7
Consistency
crickman Jul 1, 2024
489e0f1
Merge branch 'feature_single_agent_patterns_nochat' of https://github…
crickman Jul 1, 2024
3bf2b70
Sample clean-up
crickman Jul 1, 2024
45592c7
Header fix
crickman Jul 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dotnet/samples/GettingStartedWithAgents/Step1_Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task UseSingleChatCompletionAgentAsync()
};

/// Create a chat for agent interaction. For more, <see cref="Step3_Chat"/>.
AgentGroupChat chat = new();
ChatHistory chat = new();

// Respond to user input
await InvokeAgentAsync("Fortune favors the bold.");
Expand All @@ -37,11 +37,11 @@ public async Task UseSingleChatCompletionAgentAsync()
// Local function to invoke agent and display the conversation messages.
async Task InvokeAgentAsync(string input)
{
chat.AddChatMessage(new ChatMessageContent(AuthorRole.User, input));
chat.Add(new ChatMessageContent(AuthorRole.User, input));

Console.WriteLine($"# {AuthorRole.User}: '{input}'");

await foreach (var content in chat.InvokeAsync(agent))
await foreach (var content in agent.InvokeAsync(chat))
{
Console.WriteLine($"# {content.Role} - {content.AuthorName ?? "*"}: '{content.Content}'");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ await OpenAIAssistantAgent.CreateAsync(
agent.Kernel.Plugins.Add(plugin);

// Create a chat for agent interaction.
var chat = new AgentGroupChat();
string threadId = await agent.CreateThreadAsync();

// Respond to user input
try
Expand All @@ -49,19 +49,23 @@ await OpenAIAssistantAgent.CreateAsync(
}
finally
{
await agent.DeleteThreadAsync(threadId);
await agent.DeleteAsync();
}

// Local function to invoke agent and display the conversation messages.
async Task InvokeAgentAsync(string input)
{
chat.AddChatMessage(new ChatMessageContent(AuthorRole.User, input));
await agent.AddChatMessageAsync(threadId, new ChatMessageContent(AuthorRole.User, input));

Console.WriteLine($"# {AuthorRole.User}: '{input}'");

await foreach (var content in chat.InvokeAsync(agent))
await foreach (var content in agent.InvokeAsync(threadId))
{
Console.WriteLine($"# {content.Role} - {content.AuthorName ?? "*"}: '{content.Content}'");
if (content.Role != AuthorRole.Tool)
{
Console.WriteLine($"# {content.Role} - {content.AuthorName ?? "*"}: '{content.Content}'");
}
}
}
}
Expand Down
Loading