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

[dotnet] Duplicate user role message send to agent #4731

Open
kimmywork opened this issue Dec 17, 2024 · 0 comments
Open

[dotnet] Duplicate user role message send to agent #4731

kimmywork opened this issue Dec 17, 2024 · 0 comments
Assignees
Labels
0.2 Issues which are related to the pre 0.4 codebase dotnet issues related to AutoGen.Net

Comments

@kimmywork
Copy link

What happened?

Duplicate message send to an agent for after initialize and get reply from one.

Here is the request generated by AutoGen and I observed via LM Studio logs.

2024-12-17 12:47:07  [INFO]
Received POST request to /v1/chat/completions with body: {
  "messages": [
    {
      "role": "system",
      "content": "You are a student that answer question from teacher",
      "name": "student"
    },
    {
      "role": "assistant",
      "content": "Hey teacher, please create math question for me.",
      "name": "student"
    },
    {
      "role": "user",
      "content": "Here's a simple addition problem for you:\n\nIf I have 2 blocks and my friend gives me 1 more block, how many blocks do I have now?\n\nWhat is your answer?",
      "name": "teacher"
    },
    {
      "role": "user",
      "content": "Here's a simple addition problem for you:\n\nIf I have 2 blocks and my friend gives me 1 more block, how many blocks do I have now?\n\nWhat is your answer?",
      "name": "teacher"
    }
  ],
  "model": "llama-3.2-3b-instruct"
}

What did you expect to happen?

There only should be 1 user role in the messages list.

How can we reproduce it (as minimally and precisely as possible)?

Run Following C# code (from one of the examples).

var config = new LMStudioConfig("localhost", 1234);


var teacher = new AssistantAgent(
    name: "teacher",
    systemMessage: @"You are a teacher that create pre-school math question for student and check answer.
If the answer is correct, you stop the conversation by saying [COMPLETE].
If the answer is wrong, you ask student to fix it.",
    llmConfig: new ConversableAgentConfig {
            Temperature = 0.0f,
            ConfigList = [config]
    }
).RegisterPrintMessage();

var student = new AssistantAgent(
    name: "student",
    systemMessage: "You are a student that answer question from teacher",
    llmConfig: new ConversableAgentConfig {
            Temperature = 0.0f,
            ConfigList = [config]
    }
).RegisterPrintMessage();

var conversation = await student.InitiateChatAsync(
    receiver: teacher,
    message: "Hey teacher, please create math question for me.",
    maxRound: 10);

AutoGen version

55e157c

Which package was this bug in

Other

Model used

llama-3.2-3b-instruct

Python version

N/A

Operating system

macOS

Any additional info you think would be helpful for fixing this bug

I found one possible solution, by update GroupChatExtension.cs line 64 in AutoGen.Core package to avoid this duplication.

if (!chatHistory.Contains(lastMessage)) {
    chatHistory = chatHistory.Append(lastMessage);
}

Just a suggestion.

@kimmywork kimmywork changed the title Duplicate user role message send to agent [dotnet] Duplicate user role message send to agent Dec 17, 2024
@rysweet rysweet added dotnet issues related to AutoGen.Net 0.2 Issues which are related to the pre 0.4 codebase and removed needs-triage labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.2 Issues which are related to the pre 0.4 codebase dotnet issues related to AutoGen.Net
Projects
None yet
Development

No branches or pull requests

3 participants