Commit Graph

295 Commits

Author SHA1 Message Date
Yiran Wu f64a07428a
Merge branch 'main' into compression 2023-10-21 17:20:34 -04:00
Ricky Loynd d22b6b2006
TeachableAgent (#278)
* Initial commit.

* Disable LLM response caching.

* Add teachability option to setup.py

* Modify test to use OAI_CONFIG_LIST as suggested in the docs.

* Expand unit test.

* Complete unit test.

* Add filter_dict

* details

* AnalysisAgent

* details

* More documentation and debug output.

* Support retrieval of any number of relevant memos, including zero.

* More robust analysis separator.

* cleanup

* teach_config

* refactoring

* For robustness, allow more flexibility on memo storage and retrieval.

* de-dupe the retrieved memos.

* Simplify AnalysisAgent. The unit tests now pass with gpt-3.5

* comments

* Add a verbosity level to control analyzer messages.

* refactoring

* comments

* Persist memory on disk.

* cleanup

* Use markdown to format retrieved memos.

* Use markdown in TextAnalyzerAgent

* Add another verbosity level.

* clean up logging

* notebook

* minor edits

* cleanup

* linter fixes

* Skip tests that fail to import openai

* Address reviewer feedback.

* lint

* refactoring

* Improve wording

* Improve code coverage.

* lint

* Use llm_config to control caching.

* lowercase notebook name

* Sort out the parameters passed through to ConversableAgent, and supply full docstrings for the others.

* lint

* Allow TextAnalyzerAgent to be given a different llm_config than TeachableAgent.

* documentation

* Modifications to run openai workflow.

* Test on just python 3.10.
Replace agent with agent teachable_agent as recommended.

* Test on python 3.9 instead of 3.10.

* Remove space from name -> teachableagent

---------

Co-authored-by: Li Jiang <bnujli@gmail.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-10-21 02:27:10 +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
kevin666aa ffb314cb08 Merge remote-tracking branch 'origin/main' into compression 2023-10-17 13:25:22 -04:00
Li Jiang f2d7553cdc
Add support to custom text spliter (#270)
* Add support to custom text spliter function and a list of files or urls

* Add parameter to retrieve_config, add tests

* Fix tests

* Fix tests
2023-10-17 14:53:40 +00:00
kevin666aa 4109f58880 update to resolve comments 2023-10-12 14:51:31 -04:00
kevin666aa 1a63430291 Merge remote-tracking branch 'origin/main' into compression 2023-10-12 13:58:34 -04:00
Yiran Wu b61aeb6cce
Improving logging in oai.completion to show token_count (#179)
* update

* update doc

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-10-12 14:31:52 +00:00
Yiran Wu f6ebf1132b
Merge branch 'main' into compression 2023-10-11 09:12:48 -04:00
Li Jiang fa6e2a52c0
Add support to customized vectordb and embedding functions (#161)
* Add custom embedding function

* Add support to custom vector db

* Improve docstring

* Improve docstring

* Improve docstring

* Add support to customized is_termination_msg fucntion

* Add a test for customize vector db with lancedb

* Fix tests

* Add test for embedding_function

* Update docstring
2023-10-10 12:53:18 +00:00
Li Jiang 19f8711c1b
Update num tokens from text (#149)
* Improve num_tokens_from_text

* Format

* Update comments

* Improve docstrings
2023-10-09 02:30:11 +00:00
kevin666aa e95797fe91 update 2023-10-08 16:38:56 -04:00
kevin666aa 0d4d7ddf38 add test 2023-10-08 16:38:36 -04:00
Aaron 5c2a268d95
openai_utils.py - functionality for instantiating config_list with a .env file (#68)
* FORMATTING

* UPDATE - OAI __init__.py

* ruff

* ADD - notebook covering oai API configuration options and their different purposes

* ADD openai util updates so that the function just assumes the same environment variable name for all models, also added functionality for adding API configurations like api_base etc.

* ADD - updates to config_list_from_dotenv and tests for openai_util testing, update example notebook

* UPDATE - added working config_list_from_dotenv() with passing tests, and updated notebook

* UPDATE - code and tests to potentially get around the window build permission error, used different method of producing temporary files

---------

Co-authored-by: Ward <award40@LAMU0CLP74YXVX6.uhc.com>
2023-10-05 04:45:11 +00:00
Mohamed Attia a3547f82c4
Replace the use of `assert` in non-test code (#80)
* Replace `assert`s in the `conversable_agent` module with `if-log-raise`.

* Use a `logger` object in the `code_utils` module.

* Replace use of `assert` with `if-log-raise` in the `code_utils` module.

* Replace use of `assert` in the `math_utils` module with `if-not-raise`.

* Replace `assert` with `if` in the `oai.completion` module.

* Replace `assert` in the `retrieve_utils` module with an if statement.

* Add missing `not`.

* Blacken `completion.py`.

* Test `generate_reply` and `a_generate_reply` raise an assertion error
when there are neither `messages` nor a `sender`.

* Test `execute_code` raises an `AssertionError` when neither code nor
filename is provided.

* Test `split_text_to_chunks` raises when passed an invalid chunk mode.

* * Add `tiktoken` and `chromadb` to test dependencies as they're used in
the `test_retrieve_utils` module.

* Sort the test requirements alphabetically.
2023-10-03 17:52:50 +00:00
Yiran Wu 4d85f4db0a
fix append_oai_message (#47)
* fix append_oai_message

* add testcase for groupchat

* add test_oai to openai workflow

* code formate

* update

* formate

* update
2023-10-02 18:52:38 +00:00
Xiaoyun Zhang b642f69005
minor fix (#31)
* minor fix for stablility

* fix format

* fix format

* update run_code logic

* format

* Update conversable_agent.py

* fix format

* Update conversable_agent.py

* add tests

* fix format

* revert changes
2023-10-02 12:15:25 +00:00
Aaron 4adbffa94b
retrieve_utils.py - Updated.py to have the ability to parse text from PDF Files (#50)
* UPDATE - Updated retrieve_utils.py to have the ability to parse text from pdf files

* UNDO - change to recursive condition

* UPDATE - updated agentchat_RetrieveChat.ipynb to clarify which file types are accepted to be in the docs path

* ADD - missing import

* UPDATE - setup.py to have PyPDF2 in retrievechat

* RE-ADD - urls

* ADD - tests for retrieve utils, and removed deprecated PyPdf2

* Update agentchat_RetrieveChat.ipynb

* Update retrieve_utils.py

Fix format

* Update retrieve_utils.py

Replace print with logger

* UPDATE - added more specific exception to PDF decryption try/catch

* FIX - typo, return statement at wrong indentation in extract_text_from_pdf

---------

Co-authored-by: Ward <award40@LAMU0CLP74YXVX6.uhc.com>
Co-authored-by: Li Jiang <bnujli@gmail.com>
2023-10-01 10:22:58 +00:00
Chi Wang 904b293aa4
make retry_time configurable, add doc (#53)
* make retry_time configurable, add doc

* in seconds

* retry_wait_time

* bump version to 0.1.4

* remove .json

* rename

* time
2023-09-30 16:21:07 +00:00
Chi Wang 402c5bf8d1
Fix bug for windows and improve sample code (#38)
* fix bug for windows

* fix bug for windows

* more clear example

* link to example

* add test

* format

* comment

* fix assertion error

* fix test error and links

---------

Co-authored-by: Chi Wang (MSR) <chiw@microsoft.com>
2023-09-28 20:14:36 +00:00
Li Jiang 11088181b6
Improve RetrieveChat (#6)
* Upsert in batch

* Improve update context, support customized answer prefix

* Update tests

* Update intermediate answer

* Fix duplicate intermediate answer, add example 6 to notebook

* Add notebook results

* Works better without intermediate answers in the context

* Bump version to 0.1.2

* Remove commented code and add descriptions to _generate_retrieve_user_reply

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-09-27 01:22:50 +00:00
Beibin Li 3627ca4f2c
Extact_code can detect single-line code now (#2)
* Extact_code can detect single-line code now

* Add comments for RE

* Add test case and adjust UNKNOWN behavior

* Remove tmp test files

* Update autogen/code_utils.py

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-09-21 16:50:44 +00:00
Chi Wang 7dd9831857 cleanup 2023-09-21 15:20:10 +00:00
Chi Wang c8cdb2a752 cleanup 2023-09-21 15:19:06 +00:00
Chi Wang ec85b4984d cleanup 2023-09-19 02:26:57 +00:00
Chi Wang 0c60bc5111 cleanup 2023-09-16 20:41:27 +00:00
Chi Wang 45ddfa2dd0 cleanup 2023-09-16 19:03:53 +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
Chi Wang 4886cb5689
Rename Responsive -> Conversable (#1202)
* responsive -> conversable

* preview

* rename

* register reply

* rename and version

* bump version to 2.1.0

* notebook

* bug fix
2023-09-12 00:07:35 +00:00
Chi Wang 5f9b514be7
suffix in model name (#1206)
* suffix in model name

* bump version to 2.0.3
2023-09-04 02:32:51 +00:00
Yiran Wu 87c2361040
fix generate_reply when sender is None. (#1186)
* fix generate_reply

* code format

* add test case

* update

* update

* Update test/autogen/agentchat/test_responsive_agent.py

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

* Update test/autogen/agentchat/test_responsive_agent.py

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

* Update flaml/autogen/agentchat/responsive_agent.py

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

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-08-25 10:50:22 +00:00
Yiran Wu 07b97eb469
cover function calls with no arguments (#1185) 2023-08-20 05:28:29 +00:00
Chi Wang 7ab4d114d7
silent; code_execution_config; exit; version (#1179)
* silent; code_execution_config; exit; version

* url

* url

* readme

* preview

* doc

* url

* endpoints

* timeout

* chess

* Fix retrieve chat

* config

* mathchat

---------

Co-authored-by: Li Jiang <bnujli@gmail.com>
2023-08-14 07:09:45 +00:00
Li Jiang 700ff05874
Add RetrieveChat (#1158)
* Add RetrieveChat notebook, RetrieveAssistantAgent and RetrieveUserProxyAgent

* Update according to comments

* Add output

* Add tests, merge main, address comments

* Fix tests

* Merge main

* Remove unnecessary code

* Update test

* Update notebook, some functions

* Fix print issue

* Update notebook

* Update notebook

* Update notebook

* Improve retrieve utils and update notebook

* Update vector db creation method

* Update notebook

* Update notebook

* Add terminate if no more context

* Update prompt and notebook, add example for update context

* Update results

* Update results

* Update results of update context

* Fix typo

* Add table of contents

* Update table of contents
2023-08-13 12:51:54 +00:00
Chi Wang c44d2f4a01
support async in agents (#1178)
* Make auto reply method pluggable

* support async

* async

* allow richer trigger types

* test list

* rename key
2023-08-08 01:34:47 +00:00
Chi Wang a603e6dddc
Make auto reply method pluggable (#1177)
* Make auto reply method pluggable

* allow richer trigger types

* test list
2023-08-07 18:41:58 +00:00
Chi Wang 2208dfb79e
Improve auto reply registration (#1170)
* Improve auto reply registration

* object key

* fix test error

* bug fix in math user proxy agent

* allow send/receive without reply

* reset -> stop
2023-08-04 14:26:58 +00:00
Chi Wang 45b7d908e4
consecutive auto reply, history, template, group chat, class-specific reply (#1165)
* max consecutive auto reply

* chess notebook

* link to notebook

* clear history

* filter

* **context -> context

* format str template

* groupchat

* register class specific reply

* groupchat notebook

* move human reply into generate_reply

* arg in config

* colab link

* remove room

* rename
2023-08-03 09:17:20 +00:00
Chi Wang c48babd02f
raise error when msg is invalid; fix docstr; improve ResponsiveAgent; update doc and packaging; capture ipython output; find code blocks with llm when regex fails. (#1154)
* autogen.agent -> autogen.agentchat

* bug fix in portfolio

* notebook

* timeout

* timeout

* infer lang; close #1150

* timeout

* message context

* context handling

* add sender to generate_reply

* clean up the receive function

* move mathchat to contrib

* contrib

* last_message

* Add OptiGuide: agent and notebook

* Optiguide notebook: add figures and URL
1. figures and code points to remote URL
2. simplify the prompt for the interpreter, because
all information is already in the chat history.

* Update name: Agent -> GenericAgent

* Update notebook

* Rename: GenericAgent -> ResponsiveAgent

* Rebase to autogen.agentchat

* OptiGuide: Comment, sytle, and notebook updates

* simplify optiguide

* raise error when msg is invalid; fix docstr

* allow return None for generate_reply()

* update_system_message

* test update_system_message

* simplify optiguide

* simplify optiguide

* simplify optiguide

* simplify optiguide

* move test

* add test and fix bug

* doc update

* doc update

* doc update

* color

* optiguide

* prompt

* test danger case

* packaging

* docker

* remove path in traceback

* capture ipython output

* simplify

* find code blocks with llm

* find code with llm

* order

* order

* fix bug in context handling

* print executing msg

* print executing msg

* test find code

* test find code

* disable find_code

* default_auto_reply

* default auto reply

* remove optiguide

* remove -e

---------

Co-authored-by: Beibin Li <beibin79@gmail.com>
2023-08-01 02:22:30 +00:00
Chi Wang 7ddb171cd9
autogen.agent -> autogen.agentchat (#1148)
* autogen.agent -> autogen.agentchat

* bug fix in portfolio

* notebook

* timeout

* timeout

* infer lang; close #1150

* timeout

* message context

* context handling

* add sender to generate_reply

* clean up the receive function

* move mathchat to contrib

* contrib

* last_message
2023-07-29 04:17:51 +00:00
Chi Wang ecf51f41bb
rename GenericAgent -> ResponsiveAgent (#1146)
* rename GenericAgent -> ResponsiveAgent

* always
2023-07-26 05:22:25 +00:00
Chi Wang 3e7aac6e8b
unify auto_reply; bug fix in UserProxyAgent; reorg agent hierarchy (#1142)
* simplify the initiation of chat

* version update

* include openai

* completion

* load config list from json

* initiate_chat

* oai config list

* oai config list

* config list

* config_list

* raise_error

* retry_time

* raise condition

* oai config list

* catch file not found

* catch openml error

* handle openml error

* handle openml error

* handle openml error

* handle openml error

* handle openml error

* handle openml error

* close #1139

* use property

* termination msg

* AIUserProxyAgent

* smaller dev container

* update notebooks

* match

* document code execution and AIUserProxyAgent

* gpt 3.5 config list

* rate limit

* variable visibility

* remove unnecessary import

* quote

* notebook comments

* remove mathchat from init import

* two users

* import location

* expose config

* return str not tuple

* rate limit

* ipython user proxy

* message

* None result

* rate limit

* rate limit

* rate limit

* rate limit

* make auto_reply a common method for all agents

* abs path

* refactor and doc

* set mathchat_termination

* code format

* modified

* emove import

* code quality

* sender -> messages

* system message

* clean agent hierarchy

* dict check

* invalid oai msg

* return

* openml error

* docstr

---------

Co-authored-by: kevin666aa <yrwu000627@gmail.com>
2023-07-25 23:46:11 +00:00
Chi Wang 2406e69496
Json config list, agent refactoring and new notebooks (#1133)
* simplify the initiation of chat

* version update

* include openai

* completion

* load config list from json

* initiate_chat

* oai config list

* oai config list

* config list

* config_list

* raise_error

* retry_time

* raise condition

* oai config list

* catch file not found

* catch openml error

* handle openml error

* handle openml error

* handle openml error

* handle openml error

* handle openml error

* handle openml error

* close #1139

* use property

* termination msg

* AIUserProxyAgent

* smaller dev container

* update notebooks

* match

* document code execution and AIUserProxyAgent

* gpt 3.5 config list

* rate limit

* variable visibility

* remove unnecessary import

* quote

* notebook comments

* remove mathchat from init import

* two users

* import location

* expose config

* return str not tuple

* rate limit

* ipython user proxy

* message

* None result

* rate limit

* rate limit

* rate limit

* rate limit
2023-07-23 13:23:09 +00:00
Chi Wang 16f0fcd6f8
simplify the initiation of chat (#1131)
* simplify the initiation of chat

* version update

* include openai

* completion
2023-07-18 03:40:41 +00:00
Chi Wang 297a1ea9e0
Update assistant agent (#1121)
* update colab link

* typo

* upload file instruction

* update system message and notebooks

* update notebooks

* notebook test

* aoai api version and exclusion

* gpt-3.5-turbo

* dict check

* change model for test

* endpoints, cache_path and func description update

* model list

* gitter -> discord
2023-07-14 22:52:45 +00:00
Chi Wang 784c4c4f86
Try to prevent the default AssistantAgent from asking users to modify the code (#1114)
* inform assistant agent:
user proxy agent can't modify code

* update notebooks

* configure timeout in UserProxyAgent

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-07-10 16:07:48 +00:00
Yiran Wu 255faf97e2
Add Funccall notebook and document (#1110)
* add funccall example and doc

* revise to comments

* Update website/docs/Use-Cases/Auto-Generation.md

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

* revise

* update

* minor update

* add test notebook

* update

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-07-10 04:56:07 +00:00
levscaut 5eece5c748
Enhance Integration with Spark (#1097)
* add doc for spark

* labelCol equals to label by default

* change title and reformat

* reference about default index type

* fix doc build

* Update website/docs/Examples/Integrate - Spark.md

* update doc

* Added more references

* remove exception case when `y_train.name` is None

* fix broken link

---------

Co-authored-by: Wendong Li <v-wendongli@microsoft.com>
Co-authored-by: Li Jiang <bnujli@gmail.com>
2023-07-10 04:44:01 +00:00
Yiran Wu ca10b286cc
Support function_call in `autogen/agent` (#1091)
* 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 <wang.chi@microsoft.com>

* Update flaml/autogen/agent/user_proxy_agent.py

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

* 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 <wang.chi@microsoft.com>

* Update flaml/autogen/agent/math_user_proxy_agent.py

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>

* Update flaml/autogen/agent/user_proxy_agent.py

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>

* 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 <wang.chi@microsoft.com>

* fix bug

* fix bug

* update

* update is_termination_msg to accept dict

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
Co-authored-by: Li Jiang <bnujli@gmail.com>
2023-07-05 22:08:44 +00:00