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

Added ability to specify 'role' field for select speaker messages for Group Chats (addresses #1861) #2167

Closed
wants to merge 7 commits into from

Conversation

marklysze
Copy link
Collaborator

Why are these changes needed?

As per feature request #1861 ("[Feature Request]: Allowing user to specify the "role" field for select speaker messages"), this PR includes changes to the GroupChat constructor to allow the user to specify the role for the select speaker messages. This addresses the issue of role names when using Mistral through Mistral.AI's API.

Changes:

  • Added role_for_select_speaker_messages to GroupChat constructor in groupchat.py
  • Added @ekzhu's Mistral.AI notebook to documentation under Non-OpenAI models section
  • Added @ekzhu's updates to the Using Non-OpenAI about page
  • Added a Tips for Non-OpenAI models page to documentation (should be a basis for future tips)
  • Added a sub-section on the Conversation Patterns tutorial explaining the new attribute and provided an example

Related issue number

Addresses #1861

Checks

@codecov-commenter
Copy link

codecov-commenter commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.22%. Comparing base (5ef2dfc) to head (5320521).

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2167       +/-   ##
===========================================
+ Coverage   37.98%   49.22%   +11.23%     
===========================================
  Files          75       75               
  Lines        7589     7580        -9     
  Branches     1636     1766      +130     
===========================================
+ Hits         2883     3731      +848     
+ Misses       4463     3543      -920     
- Partials      243      306       +63     
Flag Coverage Δ
unittests 49.08% <100.00%> (+11.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@ekzhu ekzhu left a comment

Choose a reason for hiding this comment

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

Looks like this change set is based off an older version of main. Can you base the changes from the latest main? Also, since the group chat change would require running OAI tests so can you start a new PR using a branch from the microsoft repo?

@@ -716,7 +716,7 @@ def _print_received_message(self, message: Union[Dict, str], sender: Agent):
if "function_call" in message and message["function_call"]:
function_call = dict(message["function_call"])
func_print = (
f"***** Suggested function call: {function_call.get('name', '(No function name found)')} *****"
f"***** Suggested function Call: {function_call.get('name', '(No function name found)')} *****"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
f"***** Suggested function Call: {function_call.get('name', '(No function name found)')} *****"
f"***** Suggested function call: {function_call.get('name', '(No function name found)')} *****"

@@ -728,7 +728,7 @@ def _print_received_message(self, message: Union[Dict, str], sender: Agent):
iostream.print(colored("*" * len(func_print), "green"), flush=True)
if "tool_calls" in message and message["tool_calls"]:
for tool_call in message["tool_calls"]:
id = tool_call.get("id", "No tool call id found")
id = tool_call.get("id", "(No id found)")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
id = tool_call.get("id", "(No id found)")
id = tool_call.get("id", "No tool_call_id found")

@@ -1311,12 +1311,6 @@ def _generate_oai_reply_from_client(self, llm_client, messages, cache) -> Union[
)
for tool_call in extracted_response.get("tool_calls") or []:
tool_call["function"]["name"] = self._normalize_name(tool_call["function"]["name"])
# Remove id and type if they are not present.
Copy link
Collaborator

Choose a reason for hiding this comment

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

These were for Mistral AI compatibility. Are these not needed now?

@marklysze
Copy link
Collaborator Author

Closing this PR as it was based on an older version of main.

New PR #2199

@marklysze marklysze closed this Mar 28, 2024
github-merge-queue bot pushed a commit that referenced this pull request Mar 31, 2024
… Group Chats (Replaces PR #2167) (#2199)

* Re-commit of code from PR (#2167) addressing #1861, due to wrong basing

* Update website/docs/topics/non-openai-models/best-tips-for-nonopenai-models.md

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>

* Removed unnecessary notebook images

* Update conversation-patterns.ipynb

Updated to include note about being applicable when auto.

* Updated to include checks that the role is not blank/None. Added tests.

* Changed try-except to use pytest

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
… Group Chats (Replaces PR microsoft#2167) (microsoft#2199)

* Re-commit of code from PR (microsoft#2167) addressing microsoft#1861, due to wrong basing

* Update website/docs/topics/non-openai-models/best-tips-for-nonopenai-models.md

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>

* Removed unnecessary notebook images

* Update conversation-patterns.ipynb

Updated to include note about being applicable when auto.

* Updated to include checks that the role is not blank/None. Added tests.

* Changed try-except to use pytest

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants