32 Commits

Author SHA1 Message Date
Mark Sze
4451632784
Ability to add MessageTransforms to the GroupChat's Select Speaker nested chat (speaker_selection_method='auto') (#2719)
* Initial commit with ability to add transforms to GroupChat

* Added tests

* Tidy up

* Tidy up of variable names and commented out test

* Tidy up comment

* Update import to relative

* Added documentation topic for transform messages for speaker selection.

* Added handling of non-core module, transforms, in groupchat

* Adjusted parameter if module not loaded.

* Updated groupchat test which failed during CI/CD

---------

Co-authored-by: Li Jiang <bnujli@gmail.com>
2024-08-26 03:47:48 +00:00
Mark Sze
77ae3c09a5
Ensure 'name' on initial message (#2635)
* 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>
2024-08-20 04:08:26 +00:00
aswny
75f0808b5a
allow function to remove termination string in groupchat (#2804)
* allow function to remove termination string in groupchat

* improve docstring

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>

* improve docstring

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>

* improve test case description

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>

---------

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>
2024-06-06 21:55:55 +00:00
Mark Sze
3d8fd5cc91
Added ability to ignore the addition of the select speaker prompt for a group chat (#2726)
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2024-05-22 19:55:26 +00:00
MarianoMolina
4b747d731a
Add role to reflection with llm (#2527)
* Added 'role' as a summary_args and to the reflection_with_llm flow to be able to pass the role for the summarizing prompt

* Added 'role' as a summary_args and to the reflection_with_llm flow to be able to pass the role for the summarizing prompt, minor docstring adjustments

* Added test for summary prompt role assignment

* Fixed docstrings and mocked llm-config in the test

* Update autogen/agentchat/conversable_agent.py

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* ran pre-commit

* ran pre-commit2

* fixed old arg name

* Delete dasdaasd

No idea what this file was about

* Fixed incorrect merge update on test_groupchat

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2024-05-14 06:46:01 +00:00
Mark Sze
a86c474339
Resuming a GroupChat (#2627)
* Initial resume

* Cleaned up resume function

* Further updating resuming group chat

* Added async resume_chat and documentation

* Added test cases, refined group chat function parameters

* compiled documentation

* Added tests to main

* Removed mdx file.

* Revert "Merge remote-tracking branch 'origin/main' into groupchatresume"

This reverts commit 8f709308f049d6f07f32a93db6900ef05a130751, reversing
changes made to 8bfcb2bff13384877ec6734f6d5ddcb1a028246d.

* Refactored resume to remove initiate_chat

* fix git history

* fix history

* Added clean-up of objects, _groupchat references, and messages_to_string updated

* Added termination-based resumption in notebook, added test cases and improved robustness on resuming messages parameter

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2024-05-10 22:56:25 +00:00
Mark Sze
5b6ae324e2
Re-query speaker name when multiple speaker names returned during Group Chat speaker selection (#2304)
* Added requery_on_multiple_speaker_names to GroupChat and updated _finalize_speaker to requery on multiple speaker names (if enabled)

* Removed unnecessary comments

* Update to current main

* Tweak error message.

* Comment clarity

* Expanded description of Group Chat requery_on_multiple_speaker_names

* Reworked to two-way nested chat for speaker selection with default of 2 retries.

* Adding validation of new GroupChat attributes

* Updates as per @ekzhu's suggestions

* Update groupchat

- Added select_speaker_auto_multiple_template and select_speaker_auto_none_template
- Added max_attempts comment
- Re-instated support for role_for_select_speaker_messages
-

* Update conversable_agent.py

Added ability to force override role for a message to support select speaker prompt.

* Update test_groupchat.py

Updated existing select_speaker test functions as underlying approach has changed, added necessary tests for new functionality.

* Removed block for manual selection in select_speaker function.

* Catered for no-selection during manual selection mode

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-04-30 04:16:08 +00:00
Mark Sze
89f3cfd1ad
Recommit from my repo - Enhanced speaker name selection during agent name matching. (#2267) 2024-04-03 22:57:41 +00:00
Mark Sze
32fbfa233b
Re-commit code from #2182 to Microsoft branch (#2233) 2024-04-01 13:49:13 +00:00
Mark Sze
3f63db32b9
Added ability to specify 'role' field for select speaker messages for 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>
2024-03-31 22:54:17 +00:00
Wael Karkoub
29b9c80c40
General Enhancements in agentchat 2.0 (#1906)
* work in progress

* wip

* groupchat type hints

* clean up

* formatting

* formatting

* clean up

* address comments

* better comment

* updates docstring a_send

* resolve comments

* agent.py back to original format

* resolve more comments

* rename carryover type exception

* revert next_agent changes + keeping UndefinedNextagent

* fixed ciruclar dependencies?

* fix cache tests

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-03-09 15:15:19 +00:00
Yiran Wu
c37227bd04
Allow user to pass in a customized speaker selection method (#1791)
* init PR

* update

* update code check

* update

* update

* update

* update

* Test the ability to have agents a,u,t,o,g,e,n speak in turn.

* update

* update

* update

* Evidence that groupchat not terminating because of the TERMINATE substring.

* Raising NoEligibleSpeakerException allows graceful exit before max turns

* update

* To confirm with author that custom function is meant to override graph constraints

* Confirmed the expected test behaviour with author

* Update autogen/agentchat/groupchat.py

* update

* update

---------

Co-authored-by: Joshua Kim <Joshua@spectdata.com>
Co-authored-by: Qingyun Wu <qingyun0327@gmail.com>
2024-03-07 02:28:22 +00:00
Grigorij Dudnik
f2e42326e1
Fix for bugs appeared when using function calls with clear history functionality (#1531)
* resolved errors happening when using function calling and clear history

* checking in nr_of_messages_to_preserve were provided

* code formatting

* test added, dict signature improved

* test added, dict signature improved

* test added, dict signature improved

* test added, dict signature improved

* test added, dict signature improved

* test added, dict signature improved

* test added, dict signature improved

* test added, dict signature improved

* Test updated

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* test improved

* test improved

* comment about preserving additional message added

* commentary about clear history called in tool response improved

* created test for clear hisotry called from tool response

* code formatting

* added 'USER INTERRUPTED' as internal content of tool response

* added separate vatiable 'nr_messages_to_preserve_internal'

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-03-02 18:03:52 +00:00
Gunnar Kudrjavets
b8ceb866e6
Add shebang functionality to tests (#1784)
Tests that contain `if __name__ == "__main__":` now have a shebang line
and execute permission.
2024-02-29 01:11:08 +00:00
afourney
477598afff
Groupchat send introductions (#961)
* Allow the GroupChatManager to send introductions.

* Fixed function name.

* Added test cases for sending introductions.

* Trying to sort out why remote pytest is failing.

* Fixed broken plugin behavior.

* Update autogen/agentchat/groupchat.py

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* Updated as per Chi's suggestions.

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2024-02-24 16:50:46 +00:00
Wael Karkoub
a52f52a1b5
Feature: Get Nested Agents in a GroupChat (#1636)
* implements features

* fix docstring

* adds test

* resolve some comments

* remove unused group chat manager from test

* list implementation

* better naming

* resolve comments

* adds one more test

* checks case when agent doesnt exist

* clean up

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-15 18:33:59 +00:00
Eric Zhu
609ba7c649
Code executors (#1405)
* code executor

* test

* revert to main conversable agent

* prepare for pr

* kernel

* run open ai tests only when it's out of draft status

* update workflow file

* revert workflow changes

* ipython executor

* check kernel installed; fix tests

* fix tests

* fix tests

* update system prompt

* Update notebook, more tests

* notebook

* raise instead of return None

* allow user provided code executor.

* fixing types

* wip

* refactoring

* polishing

* fixed failing tests

* resolved merge conflict

* fixing failing test

* wip

* local command line executor and embedded ipython executor

* revert notebook

* fix format

* fix merged error

* fix lmm test

* fix lmm test

* move warning

* name and description should be part of the agent protocol, reset is not as it is only used for ConversableAgent; removing accidentally commited file

* version for dependency

* Update autogen/agentchat/conversable_agent.py

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>

* ordering of protocol

* description

* fix tests

* make ipython executor dependency optional

* update document optional dependencies

* Remove exclude from Agent protocol

* Make ConversableAgent consistent with Agent

* fix tests

* add doc string

* add doc string

* fix notebook

* fix interface

* merge and update agents

* disable config usage in reply function

* description field setter

* customize system message update

* update doc

---------

Co-authored-by: Davor Runje <davor@airt.ai>
Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
Co-authored-by: Aaron <aaronlaptop12@hotmail.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-10 04:52:16 +00:00
Qingyun Wu
2a2e466932
Using a more robust "reflection_with_llm" summary method (#1575)
* summary exception

* badrequest error

* test

* skip reason

* error

* address func call in summary

* reflection_with_llm enhancement and tests

* remove old

* update notebook

* update notebook
2024-02-07 17:17:05 +00:00
Chi Wang
18a15d78fd
patch to graph groupchat (#1555)
* patch to #1541

* graph validity test

* update docstr
2024-02-06 07:18:13 +00:00
Joshua Kim
c603ca434e
Graph group chat (#857)
* Move contrib-openai.yml

* Moved groupgroupchat

* From #753

* Removed local test references

* Added ignore=test/agentchat/contrib

* Trying to pass contrib-openai tests

* More specific in unit testing.

* Update .github/workflows/contrib-tests.yml

Co-authored-by: Li Jiang <lijiang1@microsoft.com>

* Remove coverage as it is included in test dependencies

* Improved docstring with overview of GraphGroupChat

* Iterate on feedback

* Precommit pass

* user just use pip install pyautogen[graphs]

* Pass precommit

* Pas precommit

* Graph utils an test completed

* Added inversion tests

* Added inversion util

* allow_repeat_speaker can be a list of Agents

* Remove unnessary imports

* Expect ValueError with 1 and 0 agents

* Check that main passes all tests

* Check main

* Pytest all in main

* All done

* pre-commit changes

* noqa E402

* precommit pass

* Removed bin

* Removed old unit test

* Test test_graph_utils

* minor cleanup

* restore tests

* Correct documentation

* Special case of only one agent remaining.

* Improved pytest

* precommit pass

* Delete OAI_CONFIG_LIST_sample copy

* Returns a filtered list for auto to work

* Rename var speaker_order_dict

* To write test cases

* Added check for a list of Agents to repeat

* precommit pass

* Update documentation

* Extract names in allow_repeat_speaker

* Post review changes

* hange "pull_request_target" into "pull_request" temporarily.

* 3 return values from main

* pre-commit changes

* PC edits

* docstr changes

* PC edits

* Rest of changes from main

* Update autogen/agentchat/groupchat.py

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* Remove unnecessary script files from tracking

* Non empty scripts files from main

* Revert changes in script files to match main branch

* Removed link from website as notebook is removed.

* test/test_graph_utils.py is tested as part of L52 of build.yml

* GroupChat ValueError check

* docstr update

* More clarification in docstr

* Update autogen/agentchat/groupchat.py

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* Update autogen/agentchat/groupchat.py

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* Update autogen/agentchat/groupchat.py

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* Update autogen/agentchat/groupchat.py

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* 1.add commit to line138 in groupchat.py;2.fix bug if random choice [];3.return selected_agent if len(graph_eligible_agents) is 1;4.replace all speaker_order to speaker_transitions;5.format

* fix graph_modelling notebook in the last cell

* fix failure in test_groupchat.py

* fix agent out of group to initiate a chat like SocietyOfMind

* add a warning rule in graph_utils to check duplicates in any lists

* refactor allowed_or_disallowed_speaker_transitions to Dict[Agent, List[Agent]] and modify the tests and notebook

* delete Rule 4 in graph_utils and related test case. Add a test to resolve 993fd006e9 (r1460726831)

* fix as the final comments

* modify setup option from graphs to graph and add texts in optional-dependencies.md

* Update autogen/graph_utils.py

---------

Co-authored-by: Li Jiang <lijiang1@microsoft.com>
Co-authored-by: Beibin Li <BeibinLi@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Qingyun Wu <qingyun0327@gmail.com>
Co-authored-by: Yishen Sun <freedeaths@FREEDEATHS-XPS>
Co-authored-by: freedeaths <register917@gmail.com>
2024-02-06 03:13:18 +00:00
Grigorij
0790da0bd3
functionality of manual history cleaning by user proxy added (#1230)
* functionality of manual history cleaning by admin added

* formatting improved

* formatting improved 2

* formatting improved 3

* test function added

* test code formatting

* test code formatting 2

* more advanced logging. Now user can see nr of messages to preserve as confirmation

* test_invalid_allow_repeat_speaker uncommented

* warning when providing recepient agent and nr messages to preserve added, changed variables names

* code formatting

* code formatting

* code formatting

* added 'enable_clear_history' variable to GroupChat

* 'enable_clear_history' added, better descripted

* clearing groupchat history added

* clearing groupchat history added

* two ifs merged into one, formatting improved

* two ifs merged into one, formatting improved

* two ifs merged into one, formatting improved

* formatting

* formatting

---------

Co-authored-by: Davor Runje <davor@airt.ai>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-27 19:14:03 +00:00
Chi Wang
f9c16d26a3
Fix bug in async group chat with func/tool call (#1243)
* test func/tool call in group chat w/ >2 agents

* filter_dict -> exclude

* modify comment

* add last message to groupchat

* typecheck allow_repeat_speaker
2024-01-14 18:24:05 +00:00
afourney
b1adac5159
Partial fix for 960 (#963)
* Partial fix for 960

* Fixed a missing = None

* Added test coverage.
2023-12-24 12:23:06 +00:00
afourney
dd4a2da204
Enable allow_repeat_speaker to be a list of agents that are allowed to repeat, rather than just a global boolean. (#905)
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-18 03:51:39 +00:00
afourney
4324b27b0b
Allow GroupChat to recieve messages from outside. (#912) 2023-12-08 15:39:27 +00:00
afourney
8d5f1766c9
GroupChat handle is_termination_msg (#804)
* Have GroupChatManager check is_termination_msg

* Added test cases.
2023-11-29 20:43:57 +00:00
Qingyun Wu
7c528a601c
add relevant dependency to the oai test workflow (#712)
* add oaitest dependency

* mock

* mock

* install

* get mock from unittest

* get mock from unitteset
2023-11-18 17:13:37 +00:00
Li Jiang
370ebf5e00
Update speaker selector in GroupChat and update some notebooks (#688)
* Add speaker selection methods

* Update groupchat RAG

* Update seed to cache_seed

* Update RetrieveChat notebook

* Update parameter name

* Add test

* Add more tests

* Add mock to test

* Add mock to test

* Fix typo speaking

* Add gracefully exit manual input

* Update round_robin docstring

* Add method checking

* Remove participant roles

* Fix versions in notebooks

* Minimize installation overhead

* Fix missing lower()

* Add comments for try_count 3

* Update warning for n_agents < 3

* Update warning for n_agents < 3

* Add test_n_agents_less_than_3

* Add a function for manual select

* Update version in notebooks

* Fixed bugs that allow speakers to go twice in a row even when allow_repeat_speaker = False

---------

Co-authored-by: Adam Fourney <adamfo@microsoft.com>
2023-11-17 13:56:11 +00:00
afourney
f939dda150
Makes select_speaker more robust by checking for mentions anywhere. (#669)
* Makes select_speaker more robust by checking for agents mentioned anywhere in the selection string. Addresses 663.

* Added test coverage for group chat mentions. Refactored mention counter to own function.

* Fixed pre-commit formatting.
2023-11-17 02:30:24 +00:00
Chi Wang
8d4afe4263
function call filter in group chat (#294)
* function call filter in group chat

* find agents with function_map
2023-10-19 14:43:36 +00:00
Chi Wang
a4b9297719 cleanup 2023-09-16 16:34:16 +00:00
Chi Wang
bc4473fe8a cleanup 2023-09-16 10:57:57 +00:00