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

Teachability for any agent #1091

Merged
merged 34 commits into from
Jan 7, 2024
Merged

Teachability for any agent #1091

merged 34 commits into from
Jan 7, 2024

Conversation

rickyloynd-microsoft
Copy link
Contributor

@rickyloynd-microsoft rickyloynd-microsoft commented Dec 28, 2023

Why are these changes needed?

It’s often useful to combine multiple advanced capabilities into a single agent, as OpenAI has done with their recently released GPTs and Assistants, for which function calling, code interpreter, and RAG capabilities can work together in a composable and chainable way. But AutoGen makes it hard to chain advanced capabilities because ConversableAgent obtains each agent reply from just one registered reply function. Given the mutual exclusivity among registered reply functions, the capabilities of (for example) RetrieveAssistantAgent and TeachableAgent cannot be easily chained (combined in producing a single response) today; any given reply can leverage one or the other but not both.

This PR enhances ConversableAgent to support chainable capabilities by means of a lightweight hook-registration mechanism allowing multiple capabilities to contribute to each agent reply. Leveraging this new mechanism, teachability can now be added to any agent that inherits from ConversableAgent by instantiating a Teachability object (which replaces the original TeachableAgent class) and calling its add_to_agent(agent) method. For illustration, teachability can now be added to OpenAI Assistants through GPTAssistantAgent (unmodified by this PR), successfully combining teachability in a chain with whatever capabilities the particular OpenAI Assistants have (tools including functions, code interpreter, and retrieval). Teachable OpenAI Assistants are demonstrated in a new notebook.

The original teachability tests, notebook, documentation, and blog post are all updated.

Related issue number

Closes #534, #535, #782

Checks

@rickyloynd-microsoft
Copy link
Contributor Author

LGTM. In this PR or a separate PR, could you add the added notebook to this example page via https://github.com/microsoft/autogen/blob/main/website/docs/Examples.md

Now added!

@rickyloynd-microsoft
Copy link
Contributor Author

@sonichi Is this test currently expected to fail?

OpenAI4ContribTests / CompressionTest (ubuntu-latest, 3.9) (pull_request_target)

@sonichi
Copy link
Contributor

sonichi commented Jan 7, 2024

@sonichi Is this test currently expected to fail?

OpenAI4ContribTests / CompressionTest (ubuntu-latest, 3.9) (pull_request_target)

Yes. #1073

@sonichi sonichi added this pull request to the merge queue Jan 7, 2024
Merged via the queue into main with commit 3680197 Jan 7, 2024
81 of 87 checks passed
@sonichi sonichi deleted the teach_cap branch January 7, 2024 20:15
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* update funccall

* code format

* update to comments

* update notebook

* remove test for py3.7

* allow funccall to class functions

* add test and clean up notebook

* revise notebook and test

* update

* update mathagent

* Update flaml/autogen/agent/agent.py

Co-authored-by: Chi Wang <[email protected]>

* Update flaml/autogen/agent/user_proxy_agent.py

Co-authored-by: Chi Wang <[email protected]>

* revise to comments

* revise function call design, notebook and test. add doc

* code format

* ad message_to_dict function

* update mathproxyagent

* revise docstr

* update

* Update flaml/autogen/agent/math_user_proxy_agent.py

Co-authored-by: Chi Wang <[email protected]>

* Update flaml/autogen/agent/math_user_proxy_agent.py

Co-authored-by: Qingyun Wu <[email protected]>

* Update flaml/autogen/agent/user_proxy_agent.py

Co-authored-by: Qingyun Wu <[email protected]>

* simply funccall in userproxyagent, rewind auto-gen.md, revise to comments

* code format

* update

* remove notebook for another pr

* revise oai_conversation part  in agent, revise function exec in user_proxy_agent

* update test_funccall

* update

* update

* fix pydantic version

* Update test/autogen/test_agent.py

Co-authored-by: Chi Wang <[email protected]>

* fix bug

* fix bug

* update

* update is_termination_msg to accept dict

---------

Co-authored-by: Chi Wang <[email protected]>
Co-authored-by: Qingyun Wu <[email protected]>
Co-authored-by: Li Jiang <[email protected]>
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* Partial implementation

* Partial implementation

* Fixes

* update tests

* cleanup

* update tests

* comments

* logging

* wording

* underscore

* Extend notebook for teachable GPTAssistantAgent

* Notebook for teachable GPTAssistantAgents

* Update notebook

* Update notebook

* Update notebook

* Update notebook

* revert file

* Update blog post and other documentation.

* pre-commit

* Address reviewer feedback.

* Add new nb link to examples page.

---------

Co-authored-by: Chi Wang <[email protected]>
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.

Teachability for any agent
7 participants