-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Ensure 'name' on initial message #2635
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 tasks
open-autogen
pushed a commit
to autogenhub/autogen
that referenced
this pull request
Aug 21, 2024
* Update to ensure name on initial messages * Corrected test cases for messages now including names. * Added name to messages within select speaker nested chat * Corrected select speaker group chat tests for name field --------- Co-authored-by: Chi Wang <wang.chi@microsoft.com>
randombet
pushed a commit
to randombet/autogen
that referenced
this pull request
Aug 21, 2024
* Update to ensure name on initial messages * Corrected test cases for messages now including names. * Added name to messages within select speaker nested chat * Corrected select speaker group chat tests for name field --------- Co-authored-by: Chi Wang <wang.chi@microsoft.com>
victordibia
pushed a commit
that referenced
this pull request
Aug 28, 2024
* Update to ensure name on initial messages * Corrected test cases for messages now including names. * Added name to messages within select speaker nested chat * Corrected select speaker group chat tests for name field --------- Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
When initiating a chat through ConversableAgent's
initiate_chat
the passed in message in the conversation doesn't get thename
of the agent initiating the conversation attached to it. This is, then, not passed through to the LLM and it cannot use that name information.So, running this block of code:
will result in a list of messages to the LLM like this:
I would expect there to be a
name
key, with the valuejoe
, attached to the second message as that agent initiated the chat.The response from the LLM is:
'Why did Cathy and her comedy partner decide to open a bakery together?\n\nBecause they realized they "dough"n\'t just make people laugh, they can also make them delicious pastries!'
... and it can be seen that it doesn't reference Joe's name.
By including the
name
key/value in the messages, like this:... the LLM can use the name and returns this:
'Why did Cathy and Joe go to the comedy club?\n\nBecause they heard it was a great place for two funny people to crack jokes and make people laugh!'
... indicating that the name field is utilised (and LLMs aren't great at jokes!).
To fix this, the ConversableAgent's
_append_oai_message
has been updated to add the name field, if it doesn't exist and is not a function/tool message. To support this addition, anis_sending
parameter is used on the function to indicate whether theself
agent orconversation_id
agent is the sender and, hence, the name to attach to the message.I have not added this to documentation or updated tests for this. Please let me know if it needs specific tests added.
Related issue number
No related issue.
Checks