Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net - Agents Fix: Capture Function-Calling Content (ChatCompletionAgent) #6046

Merged
merged 7 commits into from
Apr 30, 2024

Conversation

crickman
Copy link
Contributor

Motivation and Context

Result from function-calling not being captured in agent-chat history for ChatCompletionAgent.

Description

Updated logic to:

  1. Capture mutated chat-history, in addition to the iterated messages.
  2. Suppress exposing function-content as AgentChat interaction (while retaining in history).
  3. "Tool" role transformed to "Assistant" for OpenAI Assistant API

Contribution Checklist

@crickman crickman added bug Something isn't working PR: ready for review All feedback addressed, ready for reviews .NET Issue or Pull requests regarding .NET code experimental Associated with an experimental feature agents labels Apr 29, 2024
@crickman crickman self-assigned this Apr 29, 2024
@crickman crickman requested a review from a team as a code owner April 29, 2024 21:06
@crickman crickman enabled auto-merge April 30, 2024 17:17
@crickman crickman added this pull request to the merge queue Apr 30, 2024
Merged via the queue into main with commit 2119695 Apr 30, 2024
15 checks passed
@crickman crickman deleted the fix_agent_capture_functioncontent branch April 30, 2024 17:29
@@ -179,6 +179,12 @@ await foreach (var message in channel.InvokeAsync(agent, cancellationToken).Conf
this.History.Add(message);
messages.Add(message);

if (message.Role == AuthorRole.Tool || message.Items.All(i => i is FunctionCallContent))
{
// Don't explore internal messages to caller.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be 'Don't expose' ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents bug Something isn't working experimental Associated with an experimental feature .NET Issue or Pull requests regarding .NET code PR: ready for review All feedback addressed, ready for reviews
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

.Net: When using InvokeAsync on an agent, function call and function call results are missing
4 participants