Commit Graph

563 Commits

Author SHA1 Message Date
cheng-tan 4ccff54dbe
Logging (#1146)
* WIP:logging

* serialize request, response and client

* Fixed code formatting.

* Updated to use a global package, and added some test cases. Still very-much a draft.

* Update work in progress.

* adding cost

* log new agent

* update log_completion test in test_agent_telemetry

* tests

* fix formatting

* Added additional telemetry for wrappers and clients.

* WIP: add test for oai client and oai wrapper table

* update test_telemetry

* fix format

* More tests, update doc and clean up

* small fix for session id - moved to start_logging and return from start_logging

* update start_logging type to return str, add notebook to demonstrate use of telemetry

* add ability to get log dataframe

* precommit formatting fixes

* formatting fix

* Remove pandas dependency from telemetry and only use in notebook

* formatting fixes

* log query exceptions

* fix formatting

* fix ci

* fix comment - add notebook link in doc and fix groupchat serialization

* small fix

* do not serialize Agent

* formatting

* wip

* fix test

* serialization bug fix for soc moderator

* fix test and clean up

* wip: add version table

* fix test

* fix test

* fix test

* make the logging interface more general and fix client model logging

* fix format

* fix formatting and tests

* fix

* fix comment

* Renaming telemetry to logging

* update notebook

* update doc

* formatting

* formatting and clean up

* fix doc

* fix link and title

* fix notebook format and fix comment

* format

* try fixing agent test and update migration guide

* fix link

* debug print

* debug

* format

* add back tests

* fix tests

---------

Co-authored-by: Adam Fourney <adamfo@microsoft.com>
Co-authored-by: Victor Dibia <victordibia@microsoft.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-15 00:54:17 +00:00
Gunnar Kudrjavets f68c09b035
Validate the OpenAI API key format (#1635)
* Validate the OpenAI API key format

Increase the amount of internal validation for OpenAI API keys. The intent is
to shorten the debugging loop in case of typos. The changes do *not* add
validation for Azure OpenAI API keys.

* Add the validation in `__init__` of `OpenAIClient`.

* Introduce the `MOCK_OPEN_AI_API_KEY` constant for testing.

*  Add unit test coverage for the `is_valid_api_key` function.

* Validate the OpenAI API key format

Increase the amount of internal validation for OpenAI API keys. The intent is
to shorten the debugging loop in case of typos. The changes do *not* add
validation for Azure OpenAI API keys.

* Add the validation in `__init__` of `OpenAIClient`.

* Introduce the `MOCK_OPEN_AI_API_KEY` constant for testing.

*Add unit test coverage for the `is_valid_api_key` function.

* Log a warning when register a default client fails.

* Validate the OpenAI API key format

Increase the amount of internal validation for OpenAI API keys. The intent is
to shorten the debugging loop in case of typos. The changes do *not* add
validation for Azure OpenAI API keys.

* Add the validation in `__init__` of `OpenAIClient`. We'll log a
  warning when the OpenAI API key isn't valid.

* Introduce the `MOCK_OPEN_AI_API_KEY` constant for testing.

* Add unit test coverage for the `is_valid_api_key` function.

* Check for OpenAI base_url before API key validation

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-14 18:51:38 +00:00
olgavrou 71829f3fdf
Fix custom client registration (#1653)
* fix custom client registration

* fix

* add test with extra args
2024-02-13 21:41:20 +00:00
Qingyun Wu fb22f78b08
add autogen.initiate_chats (#1638)
* add initiate_chats

* update notebook

* different user

* add notebook

* add link to website

* update notebook title

* remove redundancy

* notebook

* return list

* tag

* update notebook

* update notebook

* return finished tasks

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-13 05:23:08 +00:00
Chi Wang 6d93765b96
return None instead of tuple in _generate_oai_reply_from_client (#1644)
* return None instead of tuple

* return final=False if extracted response is None
2024-02-12 19:58:30 +00:00
Chi Wang 5c58be65f4
remove print config list (#1637) 2024-02-12 18:26:15 +00:00
Qingyun Wu 899b250c08
Adding callable summary_method support and enhancements to initiate_chats (#1628)
* initiate_chats enhancements

* callable summary_method

* summary method

* summary method default

* docstr

* add timeout to slient pip install test

* consolidate_chat_info

* a_initiate_chat

* AssertionError test

* update tests

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2024-02-12 02:25:09 +00:00
Davor Runje 80890588ca
Refactoring web surfer to use function decorators (#1435)
* refactoring web surfer to use function decorators

* limited pytest version

* bug fix in test

* bug fixes

* refactoring

* Fix web_surfer tests.

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Adam Fourney <adamfo@microsoft.com>
2024-02-10 05:09:08 +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
gagb 47d6c7567e
Proxy PR for Long Context Capability 1513 (#1591)
* Add new capability to handle long context

* Make print conditional

* Remove superfluous comment

* Fix msg order

* Allow user to specify max_tokens

* Add ability to specify max_tokens per message; improve name

* Improve doc and readability

* Add tests

* Improve documentation and add tests per Erik and Chi's feedback

* Update notebook

* Update doc string of add to agents

* Improve doc string

* improve notebook

* Update github workflows for context handling

* Update docstring

* update notebook to use raw config list.

* Update contrib-openai.yml remove _target

* Fix code formatting

* Fix workflow file

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

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-08 18:26:00 +00:00
Chi Wang 0b4bce28cf
avoid access private variable (#1592)
* avoid access private variable

* test chat messages for summary
2024-02-08 01:35:19 +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
Qingyun Wu deb5f94ffd
Error handling in getting LLM-based summary (#1567)
* summary exception

* badrequest error

* test

* skip reason

* error
2024-02-07 01:32:27 +00:00
afourney 53e6d28b9d
Allow SocietyOfMind agent to work with function calling and tools. (#1569)
* Allow SocietyOfMind agent to work with function calling and tools.

* Correctly skip OpenAI tests.
2024-02-07 01:07:35 +00:00
Qingyun Wu 3e33a2c410
New `initiate_chats` Interface for Managing Dependent Chats in ConversableAgent (#1402)
* add initiate_chats implementation and example

* update notebook

* improve takeaway method

* improve print

* improve print

* improve print

* improve print

* add tests

* minor changes

* format

* correct typo

* make prompt a parameter

* add takeaway method

* groupchat messages

* add SoM example

* fix typo

* fix SoM typo

* simplify chat function

* add carryover

* update notebook

* doc

* remove async for now

* remove condition on reply

* correct argument name

* add notebook in website

* format

* make get_chat_takeaway private

* rename takeaway method and add example

* removing SoM example for now

* carryover test

* add test

* takeaway_method

* update tests

* update notebook

* chats_queue

* add get_chat_takeaway

* delete

* add test

* Update autogen/agentchat/conversable_agent.py

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

* docstr

* wording etc

* add chat res

* revise title

* update agent_utils

* unify the async method

* add todo about overriding

* attribute check

* ChatResult type

* revise test

* takeaway to summary

* cache and documentation

* Use cache in summarize chat; polish tests

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2024-02-06 18:29:15 +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
Chi Wang c6c5fb0ffb
remove useless code in groupchat; simplify the handling of termination msg (#1532)
* remove useless code in groupchat

* include termination msg
2024-02-04 19:20:18 +00:00
Eric Zhu 1abbcf3c44
Update tests for code_utils and use ThreadPoolExecutor for code execution in windows (#1472)
* threadpoolexecutor

* update tests

* update tests

* fix tests on windows

* fix test

* update tests

* update tests

* update tests

* update tests

* update tests

* update tests

* fix build.yml

* build yaml

* test

* use skip-docker to explicitly skipping docker tests

* update tests

* contribution doc update

* Update website/docs/Contribute.md

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

* update doc

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-04 15:08:14 +00:00
olgavrou 00417edb5a
Custom Model Client support (#1345)
* add client interface, response protocol, and move code into openai client class

* add ability to register custom client

* tidy up code

* adding checks and errors, and more unit tests

* remove code

* fix error msg

* add use_docer False in notebook

* better error message

* add another example to custom model notebook

* rename and have register_client take model name too

* make Client protocol and remove inheritance

* renames

* update notebook

* add link

* rename and more error checking for registered agents

* adding message retrieval to client protocol for more flexible response

* fix failing openai test

* api_type req made model_client_cls requirement

* notebook cleanup and added blog

* remove raise error if client list is empty - client list will never be empty it will have placeholders

* rename Client -> ModelClient

* add forgotten file

* fix test by fetching internal client

* Update autogen/oai/client.py

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

* don't add retrieval function to cache

* added placeholder cllient class during initial client init, and rewrote registration

* fix spelling

* Update autogen/agentchat/conversable_agent.py

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

* type hints, small fixes, docstr comment

* fix api type checking

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-02 17:21:19 +00:00
Davor Runje b0f42a1bd4
Fix tests for GPT assistant (#1505)
* fixed tests for gpt assistant

* fixed tests for gpt assistant

* api_type openai

* tests updated

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-02 16:27:13 +00:00
Justin Trugman 5eaf712a88
Implement Overwrite Tools Functionality in GPTAssistantAgent (#1434)
* added overwrite_tools logic to GPTAssistantAgent

* added test test_gpt_assistant_tools_overwrite

* fetch tools without get_assistant_tools method

* fixed code formatting

* fixed no .get found
2024-02-01 15:11:54 +00:00
olgavrou 03f165ce81
fix: unit test should not call private function (#1494)
* fix: unit test should not call private function

* fix test

* restore config
2024-01-31 21:31:45 +00:00
Davor Runje a2d4b47503
Function calling upgrade (#1443)
* function calling upgraded: async/sync mixing works now for all combinations and register_function added to simplify registration of functions without decorators

* polishing

* fixing tests

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-31 15:30:55 +00:00
afourney 0107b52d5a
Adds a SocietyOfMindAgent that presents as a single agent, but runs GroupChat as an inner-monologue (#890)
* Added a GroupChatRepresentative class that uses group chat as an inner-monologue.

* Renamed GroupChatRepresentative to SocietyOfMindAgent

* Added tests for the society of mind agent.

* Don't force message attribution -- the defaults are correct.

* Add names to external messages.

* Added some comments to document code, per request.

* Added some comments to document code, per request.

* Added a Notebook example, and the ability to use a prompt as the response_preparer.

* Protect inner chat with try-catch

* Fixed typo.

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-31 00:01:40 +00:00
afourney 8d1d07308a
Removed "Tool Call Id" from main content string. (#1471)
* Removed Tool Call Id from main content string.

* Fixed tests.
2024-01-30 21:41:27 +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 fd0094ce51
bump version to 0.2.9 (#1430)
* Fixed rounding bug.

* bump version to 0.2.9

* fix format error

* simplify contrib tests

---------

Co-authored-by: Adam Fourney <adamfo@microsoft.com>
2024-01-27 18:49:24 +00:00
Davor Runje 0c5d6b2533
fixed skipping code execution in docker test if already runnning in a container (#1383) 2024-01-23 23:38:52 +00:00
afourney c05e212d15
Change last_n_messages to default to 'auto' (#1356)
* Change last_n_messages to default to 'auto'

* Added last_n_messages validation, as per Eric's comment.

---------

Co-authored-by: Davor Runje <davor@airt.ai>
2024-01-23 01:12:50 +00:00
Chi Wang 05923a7301
bump version to 0.2.8 (#1349)
* bump version to 0.2.8

* make import easier

* redis
2024-01-22 14:17:59 +00:00
afourney 708eb4d884
Add a web surfer agent that can search and browse the web. (#1093)
* Initial commit of WebSurfer. Adds the browser_utils, and related tests. WebSurfer will be added in a subsequent commit.

* Added the web surfer agent, and related tests.

* Added a notebook to show how WebSurferAgent works.

* Fixed a typo.

* Updated test_web_surfer for compatibility with #1110.

* Updated skip_oai logic.

* Fixed code formatting.

* More pre-commit fixes.

* Added block to contrib-openai.yml

* Added block to contrib-openai.yml

* Added hook for BING_API_KEY

* Temporarily commented out other tests, per request.

* Fixed indentation (maybe?)

* Restoring contrib-openai.yml
2024-01-22 03:43:15 +00:00
Vijay Ramesh ee6ad8d519
[Core] implement redis cache mode (#1222)
* implement redis cache mode, if redis_url is set in the llm_config then
it will try to use this.  also adds a test to validate both the existing
and the redis cache behavior.

* PR feedback, add unit tests

* more PR feedback, move the new style cache to a context manager

* Update agent_chat.md

* more PR feedback, remove tests from contrib and have them run with the normal jobs

* doc

* updated

* Update website/docs/Use-Cases/agent_chat.md

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

* update docs

* update docs; let openaiwrapper to use cache object

* typo

* Update website/docs/Use-Cases/enhanced_inference.md

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

* save previous client cache and reset it after send/a_send

* a_run_chat

---------

Co-authored-by: Vijay Ramesh <vijay@regrello.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-20 17:06:29 +00:00
bitnom e97b6395af
Allow initiate_chat without passing message (#1244)
* allow initiate_chat without passing message

* test human input

* assert called

* Add missing method a_generate_init_message

* fix tests

* add back skipif

* Update test/agentchat/test_async_get_human_input.py

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-19 03:46:20 +00:00
olgavrou a911d1c2ec
set use_docker to default to True (#1147)
* set use_docker to default to true

* black formatting

* centralize checking and add env variable option

* set docker env flag for contrib tests

* set docker env flag for contrib tests

* better error message and cleanup

* disable explicit docker tests

* docker is installed so can't check for that in test

* pr comments and fix test

* rename and fix function descriptions

* documentation

* update notebooks so that they can be run with change in default

* add unit tests for new code

* cache and restore env var

* skip on windows because docker is running in the CI but there are problems connecting the volume

* update documentation

* move header

* update contrib tests
2024-01-18 17:03:49 +00:00
Eric Zhu 22e36cbb10
Support for Python 3.12 (#1317)
* support for Python 3.12

* add python 3.12 to workflows

* version string fix

* retrieval chat

* teachability

* workflow

* redistribute notebook tests

* fix incorrect notebook introduction

* update banner; remove unused imports; update openai workflow

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-18 07:15:06 +00:00
Maxim Saplin 00dbcb247e
Switched to AzureOpenAI for api_type=="azure" (#1232)
* Switched to AzureOpenAI for api_type=="azure"

* Setting AzureOpenAI to empty object if no `openai`

* extra_ and openai_ kwargs

* test_client, support for Azure and "gpt-35-turbo-instruct"

* instruct/azure model in test_client_stream

* generalize aoai support (#1)

* generalize aoai support

* Null check, fixing tests

* cleanup test

---------

Co-authored-by: Maxim Saplin <smaxmail@gmail.com>

* Returning back model names for instruct

* process model in create

* None check

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-17 02:03:14 +00:00
Yiran Wu acf81ac420
Add usage summary for agents (#1269)
* update

* update

* Update notebook/oai_client_cost.ipynb

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

* update doc and test

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-17 01:55:29 +00:00
Chi Wang 563b1bb00b
remove filter_dict (#1284) 2024-01-16 17:24:17 +00:00
Chi Wang adbfb206dc
add workdir in test (#1274)
* add workdir in test

* catch filenotfound

* modify print msg
2024-01-16 03:26:18 +00:00
Eric Zhu e784f2b9b6
[Core] Update documentation for function call compatibility (#1237)
* #1206

* doc

* add test for azure openai

* prior to

* filter for versions

* up to

* literal type

* update doc

* update doc

* update model list

* Update autogen/agentchat/conversable_agent.py

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

* Update test/agentchat/test_tool_calls.py

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

* Update test_tool_calls.py

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-16 03:04:27 +00:00
Brian Finney d1c1548888
remove name from tool response (#1263)
* remove name from tool response

* fix tool response tests

* fix output string
2024-01-16 02:54:56 +00:00
Davor Runje bde2fc9398
replaced asyncio.coroutines.iscoroutinefunction with inspect.iscoroutine (#1267) 2024-01-16 00:21:12 +00:00
afourney e6325a402a
Added the ability to add tags to the OAI_CONFIG_LIST, and filter (#1226)
* Added the ability to add tags to the OAI_CONFIG_LIST, and filter on them.

* Update openai_utils.py

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

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-15 04:47:19 +00:00
Brian Finney 63a35e79f8
run sync and async in async (#1242)
* run sync and async in async

* test for async multitool call

* uncomment notebook

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Davor Runje <davor@airt.ai>
2024-01-15 02:34:27 +00:00
Chi Wang 156579565d
Improve test for function call in groupchat (#1252) 2024-01-14 22:55:53 +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
Chi Wang 42674c58b7
update default aoai version (#1229)
* update default aoai version

* disable notebook test that is going to be outdated

* bump version to 0.2.7
2024-01-14 05:44:30 +00:00
Eric Zhu d6a3304f55
[Core] Compatibility with function call style API (Azure OpenAI and Gemini) (#1227)
* #1206

* doc

* add test for azure openai

* prior to

* filter for versions

* up to

* literal type

* update doc
2024-01-13 20:48:46 +00:00
Eric Zhu f82248dce3
[Core] Sanitize filename before using it as docker image tag. Fix #1069 (#1127)
* fix #1069

* uncomment skips

* use importlib to check package

* better code

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-13 18:42:44 +00:00
Josef Erben 44260934f3
fix: forward kwargs to conversable agent + fix typing (#1193)
* fix: forwards kwargs to conversable agent + typing

* add description unit test

* add documentation for description
2024-01-13 15:01:39 +00:00
Davor Runje 2589ae8749
Add documentation and raise exception when registering async reply function in sync chat (#1208)
* documentation update and added tests for register_reply function

* added raising an exception on an async reply function in sync chat

* big fixing

* test expanded

* Update autogen/agentchat/conversable_agent.py

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

* Update autogen/agentchat/conversable_agent.py

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

* refactorization

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-13 07:35:31 +00:00
Davor Runje 2e519b016a
Fix registration of async functions (#1201)
* bug fix for async functions

* Update test_conversable_agent.py

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

* Update test/agentchat/test_conversable_agent.py

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

* commented out cell in a notebook until issue #1205 is not fixed

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-11 09:01:58 +00:00
Davor Runje 56aed2d3d1
Added support for streaming tool calls (#1184)
* added support for streaming tool calls

* bug fix: removed tmp assert

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-11 04:34:51 +00:00
Maxim Saplin 083ba32a73
Change `contrib-tests.yml` tests to use `--skip-openai` (#1132)
* Fixing RetrieveChat part

* All 5 test groups are updated to --skip-openai

* sys.path.append() fix
2024-01-10 01:42:07 +00:00
Ricky Loynd 3680197f70
Teachability for any agent (#1091)
* 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 <wang.chi@microsoft.com>
2024-01-07 19:59:42 +00:00
Chi Wang 295b8355f1
bump version to 0.2.4 (#1160)
* bump version to 0.2.4

* update

---------

Co-authored-by: kevin666aa <yrwu000627@gmail.com>
2024-01-07 00:45:36 +00:00
Brian Finney 40dbf31a92
[Core] [Tool Call] adjust conversable agent to support tool_calls (#974)
* adjust conversable and compressible agents to support tool_calls

* split out tools into their own reply def

* copilot typo

* address review comments

* revert compressible_agent and token_count_utils calls

* cleanup terminate check and remove unnecessary code

* doc search and update

* return function/tool calls as interrupted when user provides a reply to a tool call request

* fix tool name reference

* fix formatting

* fix initiate receiving a dict

* missed changed roled

* ignore incoming role, more similiar to existing code

* consistency

* redundant to_dict

* fix todo comment

* uneeded change

* handle dict reply in groupchat

* Fix generate_tool_call_calls_reply_comment

* change method annotation for register_for_llm from functions to tools

* typo autogen/agentchat/conversable_agent.py

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

* add deprecation comments for function_call

* tweak doc strings

* switch to ToolFunction type

* update the return to

* fix generate_init_message return type

* Revert "fix generate_init_message return type"

This reverts commit 645ba8b76a.

* undo force init to dict

* fix notebooks and groupchat tool handling

* fix type

* use get for key error

* fix teachable to pull content from dict

* change single message tool response

* cleanup unnessary changes

* little better tool response concatenation

* update tools tests

* add skip openai check to tools tests

* fix nits

* move func name normalization to oai_reply and assert configured names

* fix whitespace

* remove extra normalize

* tool name is now normalized in the generate_reply function, so will not be incorrect when sent to receive

* validate function names in init and expand comments for validation methods

* fix dict comprehension

* Dummy llm config for unit tests

* handle tool_calls set to None

* fix tool name reference

* method operates on responses not calls

---------

Co-authored-by: Yiran Wu <32823396+kevin666aa@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2024-01-06 17:55:25 +00:00
Linxin Song e673500129
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039)
* try to fix blog

* modify blog

* fix test error in #717; fix blog typo in installation; update blogs with output examples.

* pre-commit

* pre-commit

* Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx

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

* add future work

* fix grammar

* update agent_builder

* solve #941; add detailed debug info; support json string config

* pre-commit

* solve #954

* pre-commit

* [new feature] build group chat agents from library.

* pre-commit

* add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort

* update test and example for build_from_library

* pre-commit

* add notebook; update docs

* change notebook name

* change description for notebook and doc

* remove default value for default_llm_config

* add embedding similarity agent selection

* pre-commit

* update test

* add dependency installation in github workflow

* update test

* pre-commit

* update notebook

* support directly json as library; support customize embedding model

* update test

* pre-commit

* update github test workflow

* Update autobuild_agent_library.ipynb

* add agent description

* refine prompt; update notebook

* pre-commit

* update test example

* update test

* update test

* update test

* change `config_path` to `config_path_or_env`; update test

* pre-commit

* update test

* update test

* update test: add config_file_location

* change `config_path_or_env` to `config_file_or_env`

* update test

* solve noqa

* fix import error for conftest

* fix test error

* pre-commit

* * update error message in `_create_agent`.
* replace `gpt-4-1106-preview` to `gpt-4` in test file.

* add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement

* move import huggingface_hub to _create_agent

* pre-commit

* add uncover comment in the endpoint creation code block

* recover contrib-openai.yml for merge

---------

Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-06 17:23:23 +00:00
afourney e5ebdb66bf
Remove GPT-4 as the default model. (#1072)
* Remove GPT-4 as the default model.

* Updated test_compressible_agent to work around a bug that would otherwise default to gpt-4. Revist after #1073 is addressed.

* Worked around another bug in test_compressible_agent. It seems the config_list was always empty!

* Reverted changes to compressible agent.

* Noted that GPT-4 is the preferred model in the OAI_CONFIG_LIST_sample and README.

* Fixed failing tests after #1110

* Update OAI_CONFIG_LIST_sample

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

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-05 14:27:48 +00:00
Maxim Saplin 3f343654bd
Let run tests directly via `python test_xyz.py`, fix for `conftest` import via `sys.path.append` (#1144)
* Runnig tests directly

* All tests with contrib add sys.path
2024-01-05 14:24:49 +00:00
afourney 4fcc45f140
[Core] Throw an error when the OAI_CONFIG_LIST is missing. (#1082)
* Throw an explicit and proper error when someone asks to load the OAI_CONFIG_LIST, and it is missing.

* Updated to use pytest.raises. Added docstring. Updated some tests to not try to load the config_list when skipping OAI tests.

* Fixed wrong indentation in config_list_from_json, and updated test_utils to work with non-empty lists.

* Read key location from global constants.

* Added missingpath.

* Moved config_list_from_json to inside a skip check.
2024-01-03 16:58:58 +00:00
Yiran Wu 8a26d3b3cd
Minor fix groupchat (#904)
* minor fix groupchat

* update

* update

---------

Co-authored-by: Davor Runje <davor@airt.ai>
2024-01-03 00:23:11 +00:00
Beibin Li b26e659362
[Core] Improve config_list_from_json (#1026)
* Improve config_list_from_json
The `env_or_file` variabe can point to an
environment variable of file path.

* Update autogen/oai/openai_utils.py

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

* Use "with" to open config file

* Remove unused.

* Remove accidental added file

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-01-02 21:33:28 +00:00
Maxim Saplin c80df8acab
Skip tests that depend on OpenAI via `--skip-openai` (#1097)
* --skip-openai

* All tests pass

* Update build.yml

* Update Contribute.md

* Fix for failing Ubuntu tests

* More tests skipped, fixing 3.10 build

* Apply suggestions from code review

Co-authored-by: Qingyun Wu <qingyun0327@gmail.com>

* Added more comments

* fixed test__wrap_function_*

---------

Co-authored-by: Qingyun Wu <qingyun0327@gmail.com>
Co-authored-by: Davor Runje <davor@airt.ai>
2023-12-31 19:37:21 +00:00
Chi Wang 3b0e059699
openai base url default to None; read files when env vars exist; remove deprecated models (#1110)
* openai base url default to None

* read from files when env vars exist
2023-12-31 18:12:49 +00:00
Maxim Saplin 16b1723c74
[Core] Extending inline docs for `openai_utils.py`, boosting coverage in `test_utils.py`, fixing #762 (#1046)
* fix for #762 ,get_config_list/oia assetion, docs, test

* Improved docstrings

* test_utils using fake data and temp files

* "Black" formatting applied

* Fix build (KEY_LOC and OAI_CONFIG_LIST as consts in test_client)

* Ramping up openai_utils coverage

* Missing parameter doc.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2023-12-30 02:03:34 +00:00
Ian d583ad833f
Filter out candidates with the same name but different instructions, … (#925)
* Filter out candidates with the same name but different instructions, file IDs, and function names

* polish

* improve log

* improving log

* improve log

* Improve function signature (#2)

* try to fix ci

* try to fix ci

---------

Co-authored-by: gagb <gagb@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-12-27 14:21:09 +00:00
Davor Runje 4b5ec5a52f
Add decorator for function calling (#1018)
* add function decorator to converasble agent

* polishing

* polishing

* added function decorator to the notebook with async function calls

* added support for return type hint and JSON encoding of returned value if needed

* polishing

* polishing

* refactored async case

* Python 3.8 support added

* polishing

* polishing

* missing docs added

* refacotring and changes as requested

* getLogger

* documentation added

* test fix

* test fix

* added testing of agentchat_function_call_currency_calculator.ipynb to test_notebook.py

* added support for Pydantic parameters in function decorator

* polishing

* Update website/docs/Use-Cases/agent_chat.md

Co-authored-by: Li Jiang <bnujli@gmail.com>

* Update website/docs/Use-Cases/agent_chat.md

Co-authored-by: Li Jiang <bnujli@gmail.com>

* fixes problem with logprob parameter in openai.types.chat.chat_completion.Choice added by openai version 1.5.0

* get 100% code coverage on code added

* updated docs

* default values added to JSON schema

* serialization using json.dump() add for values not string or BaseModel

* added limit to openai version because of breaking changes in 1.5.0

* added line-by-line comments in docs to explain the process

* polishing

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Li Jiang <bnujli@gmail.com>
2023-12-25 16:07:20 +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
KazooTTT a122ffe541
Fix/typo (#1034)
* fix: typo

* fix: typo

* fix: typo of function name

* fix: typo of function name of test file

* Update test_token_count.py

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2023-12-22 16:00:46 +00:00
gagb 03b819bdf2
Add async test (#520)
* Add example nb for async funcs

* Add a notebook based test for async function calls

* Update nb

* Update nb

* Remove duplicate code

* Rename func for consistency

* Fix bug

* Add intro text for cmd cell 4

* Add a short comment on await

* Update agentchat_function_call_async.ipynb

Minor typo

* Add link to nb

---------

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-19 19:01:23 +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 b29f9a90e8
Updated get_max_token_limit with latest models and numbers (#972)
* Updated with latest models and numbers

* Updated as per comments.

* Added common Azure deployment names for models.

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-18 03:06:41 +00:00
Linxin Song 605882b432
[AutoBuild] address issue 941 954; add new feature; add debug information (#944)
* try to fix blog

* modify blog

* fix test error in #717; fix blog typo in installation; update blogs with output examples.

* pre-commit

* pre-commit

* Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx

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

* add future work

* fix grammar

* update agent_builder

* solve #941; add detailed debug info; support json string config

* pre-commit

* solve #954

* pre-commit

---------

Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-18 02:54:12 +00:00
Yiran Wu 9cec541630
Convert ChatCompletionMessage to Dict after completion (#791)
* update

* update

* update signature

* update

* update

* fix test funccall groupchat

* reverse change

* update

* update

* update

* update

* update

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-12-10 03:28:13 +00:00
Chi Wang a31b240100
bump version to 0.2.2 (#906)
* bump version to 0.2.2

* openai version
2023-12-10 03:16:18 +00:00
Yiran Wu fd84ef1970
Raise error when function as llm_config passed to GroupChatManager (#911)
* fix groupchat selection

* update

* update notbooks

* update

* update
2023-12-10 01:33:46 +00:00
kittyandrew 6e2387192f
Make groupchat & generation async, actually (#543)
* make groupchat & generation async actually

* factored out func call pre-select; updated indecies

* fixed code format issue

* mark prepare agents subset as internal

* func renaming

* func inputs

* return agents

* Update test/agentchat/test_async.py

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

* Update notebook/agentchat_stream.ipynb

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

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-09 20:50:36 +00:00
afourney e74abe253e
Added an agent description field distinct from the system_message. (#736)
* Added an agent description field that can be distinct from the system_message, and be used to for orchestration (e.g., GroupChatManager, etc.)

* Added debugging.

* Moved default descriptions to constants.

* Fixed conditions under which the assistant uses the default description.

* Removed debugging.

* Updated GroupChat prompt.

* Re-added debugging.

* Removed double [[ ]].

* Another update to GroupSelection prompt.

* Changed 'people' to 'participants' since agents are not people.

* Changed 'role' to 'name'

* Removed debugging statements.

* Restored the default prompt. Created a contrib class with new prompt.

* Fixed documentation.

* Removed broken link.

* Fixed a warning message.

* Removed GroupChatModerator contrib. Will re-add in another PR

* Resolving comment.

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-12-09 19:50:03 +00:00
afourney 4324b27b0b
Allow GroupChat to recieve messages from outside. (#912) 2023-12-08 15:39:27 +00:00
tyler-suard-parker e96213e30b
Add test for async group chat (#902)
* Add test for async group chat

* run pre-commit

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-07 17:32:27 +00:00
Yiran Wu cbd1e19307
Update cache if cost not calculated (#903)
* update cost for cache

* fix test
2023-12-07 03:43:30 +00:00
Chi Wang 73d7e9203b
bump version to 0.2.1 (#867)
* bump version to 0.2.1

* remove example link

* update

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
Co-authored-by: kevin666aa <yrwu000627@gmail.com>
2023-12-05 21:09:05 +00:00
Linxin Song fa5f4ca8e3
Add details to AutoBuild's blog and fix test error. This PR is related to #846 (#865)
* try to fix blog

* modify blog

* fix test error in #717; fix blog typo in installation; update blogs with output examples.

* pre-commit

* pre-commit

* Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx

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

* add future work

* fix grammar

---------

Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-05 18:50:17 +00:00
Linxin Song 83f0c744b2
Testing AutoBuild (#846)
* init notebook for agent set up

* complete AgentCreator

* AgentCreator first step features completed.

* update AgentCreator

* update AgentCreator

* update AgentCreator (modify params of build)

* [update AgentCreator] add auto judgement of coding

* add autobuild

* rename autobuild notebook

* Add step-by-step command.

* modify name

* fix bugs

* update for new openai api

* add example

* add load_config, save_config, and add task in build and start

* modify notebook

* rewrite save and load function; update notebook

* update description

* update description

* update description

* change member variable of agent_creator.py

* update notebook

* new feature: auto-generate agent name and system message

* new feature: add gpts support

* update notebook

* update notebook

* beautify; add docstring for build

* Update notebook; PR version

* typo

* update notebook

* fix typo

* try to run llama

* try to run llama

* switch api_base to base_url

* add details for Step 6; add print in clear_all_agents()

* Change description of Step 5

* delete ASSISTANT_CONFIG_LIST

* add Linxin to blog authors

* add blog

* Update index.mdx

* add test; add user proxy constrain; change show case in notebook

* modify blog for test

* change test file name; modify test

* modify test

* modify test

* add try/catch for dependency

* add version requirement for openai

* add exception for DistributionNotFound error

* add requirement

* change assertion

* rename test; modify index.mdx

* change config file name

* Update agent_chat.md

* Update agent_chat.md

* Update AgentChat.md

* complete blog; fix typos in notebook

* add autobuild banner

* try to merge

* Update Examples.md

* update test

* skip if openai not installed

* pre-commit

* Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx

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

* update contrib-openai.yml

* change pull_request_target to pull_request

* disable other openai tests

* address issues from ekzhu; modify notebook; modify blog; modify test

* update test example

* update test

* Update agent_chat.md

* Update Examples.md

* address issues from qingyun; update agent_builder.py; update notebook

* recover contrib-openai.yml

* pre-commit solve

---------

Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu>
Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 02:12:26 +00:00
Yiran Wu 7a4ba1a732
Add cost summary to client.py (#812)
* init commit

* add doc, notebook and test

* fix test

* update

* update

* update

* update
2023-12-03 21:06:46 +00:00
Beibin Li c19f234149
Message "content" now supports both `str` and `List` in Agents (#713)
* Change "content" type in Conversable Agent

* content and system_message support str and List
Update for all other agents

* Content_str now also takes None as input

* Group Chat now works with LMM too

* Style: newline for import in Conversable Agentt

* Add test for gourpchat + lmm

* Resolve comments
1. Undo AssistantAgent changes
2. Modify the asserts and raises in `content_str` function and update
test accordingly.

* Undo AssistantAgent

* Update comments and add assertion for LMM

* Typo fix in docstring for content_str

* Remove “None” out conversable_agent.py

* Lint message to dict in multimodal_conversable_agent.py

* Address lint issues

* linting

* Move lmm test into contrib test

* Resolve 2 comments

* Move img_utils into contrib folder

* Resolve img_utils path issues
2023-12-03 01:40:50 +00:00
Nicolas Marchildon 17c51fd2f0
Enable defining new functions after agent creation (#285)
* Enable defining new functions after agent creation

* Add notebook for function inception example

* format

* 1. fix bug 2. support remove function

* 1. fix bug 2. support remove function

* 1. add example doc 2. change test file 3. change ipynb title

* Update website/docs/Examples.md

---------

Co-authored-by: Li Jiang <bnujli@gmail.com>
Co-authored-by: “skzhang1” <“shaokunzhang529@gmail.com”>
Co-authored-by: Shaokun Zhang <shaokunzhang529@gmail.com>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-02 01:05:54 +00:00
Li Jiang ae7066be57
Add a warning message if docs_path not explicitly set (#814)
* Add a warning message if docs_path not explicitly set

* update

* Add how to suppress warning message

* Fix tests errors

* Fix tests errors

* Fix tests errors
2023-11-30 16:34:45 +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
Yiran Wu f812a238b1
add cost calculation to client (#769)
* add cost calculation

* Update autogen/oai/client.py

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

* Update autogen/oai/client.py

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

* update

* add doc

---------

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>
2023-11-28 19:47:53 +00:00
Ricky Loynd 0468f53210
Restore TeachableAgent tests (#761)
* Update chat_with_teachable_agent.py to v2.

* Update agentchat_teachability.ipynb to v2.

* Add test of teachability accuracy.

* Update installation instructions.

* Add to contrib tests.

* pre-commit fixes

* Apply reviewer suggestions to test workflows.
2023-11-27 02:10:02 +00:00
Ian c705c6a6f8
support retrievaling assistant by name (#718)
* support assistant retrieval using name

* address comment

* Update autogen/agentchat/contrib/gpt_assistant_agent.py

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

* make code more reading friendly

* ignore test error

* format code

* Update autogen/agentchat/contrib/gpt_assistant_agent.py

typo fix

* fix test case

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-11-24 17:46:50 +00:00
Joshua Kim 9d2ee46ebc
Controlling select_speaker using Graph Modelling Language (#720)
* Completed notebook on using GML

* Added optional dependencies for graph

* Run pre-commit

* Added pytest

* Added LLM to pick an agent before catch-all

* Updated website links to notebook

* Reviewer's suggestions

* pre-commit checked

* pre-commit passed

* Change beta version
2023-11-22 20:36:52 +00:00
Dear.Va d22664f7e7
improve CODE_BLOCK_PATTERN for a more robust code match (#571)
* improve CODE_BLOCK_PATTERN for more robust match

* improve and add tests

* Add support for \r\n

* Updated the regex to support indented code blocks (per the Markdown spec). Added test cases for both.

* Update formatting

---------

Co-authored-by: Adam Fourney <adamfo@microsoft.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-11-21 05:06:56 +00:00
Julia Kiseleva 19c7da2dd1
Adding first version of AgentEval -- a framework for assessing task utility for LLM-powered applications (#681)
* add agenteval-notebook for math problems and the blog post about it

* update gitignore

* updates to notebook

* adding folder for the logs

* adding math problems logs

* adding folder for alfworld logs

* added limitiation and future work to blog post

* minor edits blog post

* adding changes

* reorg

* modify the main notebook

* modification of the main notebook

* remove wrong notebook

* uploading new notebook

* update agenteval notebook

* change the sample

* Update agenteval_cq_math.ipynb

* adding final changes to notebook

* updated framework picture

* Update index.mdx

* Update index.md

* Add files via upload

* updates to notebool

* revise the blog

* revise the blog

* update the agent img

* revise the blog

* revise the blog

* Excluded model logs from the main branch, you can find them in agenteval branch

* Fixed pre-commit formatting.

* Update website/blog/2023-11-11-AgentEval/index.mdx

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

* update gitignore

* update index.mdx

* update authors.yml by adding Negar and Julia

* remove md file

* remove md file

* update gitignore

* update authors file

* pre-commit checks

* pre-commit checks on authors.yml

* pre-commit checks on authors.yml

* update index.mdx

* update authors.yml by adding Negar and Julia

* updated the blog-post version 1

* updated the blog-post: TL;DR is ready

* updated the blog-post: first part of introduction is ready

* updated figures: typos on fig 1, changed terminology on the fig 2

* upadated the Framework part

* fixed redering issues

* upload zip file instead of single samples

* update prealgebra.zip

* update

* upload

* update z

* update naming

* update zip

* update the agenteval notebook

* update the notebook - removing unmercenary logs

* updated fig 1 and references to it

* updated fig 1

* incorporated PR comments

* merged agenteval branch

* final changes to the blog

* updated taxonomy

* update notebook

* minor changes to the blog

* Fixed formatting

* Update the link in agenteval_cq_math.ipynb

* update the blog and link in notebook

* Update index.mdx

* change folder name

* Changes to be committed:
	modified:    OAI_CONFIG_LIST_sample.txt

* add sample OAI file

* fix the url link to colab and typos

* fix the url link to colab and typos

* add authors

* update profile pic

* "update authors"

* fixing the problem in test_groupchat.py

* update the title lower case

* reverting changes in setup.py

* rerun pre-commit

---------

Co-authored-by: Negar Arabzadeh <ngr.arabzadeh@gmail.com>
Co-authored-by: Julia Kiseleva <jukisele@microsoft.com>
Co-authored-by: afourney <adamfo@microsoft.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-11-21 04:07:33 +00:00
Li Jiang 07646d448c
Support custom text formats and recursive (#496)
* Add custom text types and recursive

* Add custom text types and recursive

* Fix format

* Update qdrant, Add pdf to unstructured

* Use unstructed as the default text extractor if installed

* Add tests for unstructured

* Update tests env for unstructured

* Fix error if last message is a function call, issue #569

* Remove csv, md and tsv from UNSTRUCTURED_FORMATS

* Update docstring of docs_path

* Update test for get_files_from_dir

* Update docstring of custom_text_types

* Fix missing search_string in update_context

* Add custom_text_types to notebook example
2023-11-21 03:53:50 +00:00
Surav Shrestha a4d9ce8c5b
fix typos in function helper text (#503)
* fix typos in autogen/agentchat/conversable_agent.py

* fix typos in autogen/code_utils.py

* fix typos in autogen/oai/completion.py

* fix typos in test/agentchat/test_assistant_agent.py

* Update test/agentchat/test_assistant_agent.py

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

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-11-19 19:38:49 +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
Ian a730a63e30
fix assistant creating without file (#689)
* fix assistant creating without file

* add a simple unit test

* format code
2023-11-16 12:51:32 +00:00
afourney 5dfc73dfb0
Added an 'auto' mode to last_n_messages (#693)
* Added an 'auto' mode to last_n_messages

* Added tests for the last_n_messages = 'auto' mode

* Added test one additional test case that was overlooked.
2023-11-15 22:26:04 +00:00
Chi Wang 337ac4c5ce
bump version (#645)
* bump version

* use AssertionError

* revise error

* oai import

* ImportError

* error

* use openai endpoint

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-11-12 20:35:03 +00:00
Qingyun Wu c22a322aff
uncomment test (#640) 2023-11-12 13:37:48 +00:00
gagb df2cd36dee
Refactor GPTAssistantAgent (#632)
* Refactor GPTAssistantAgent constructor to handle
instructions and overwrite_instructions flag

- Ensure that `system_message` is always consistent with `instructions`
- Ensure provided instructions are always used
- Add option to permanently modify the instructions of the assistant

* Improve default behavior

* Add a test; add method to delete assistant

* Add a new test for overwriting instructions

* Add test case for when no instructions are given for existing assistant

* Add pytest markers to test_gpt_assistant.py

* add test in workflow

* update

* fix test_client_stream

* comment out test_hierarchy_

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: kevin666aa <yrwu000627@gmail.com>
2023-11-12 06:03:51 +00:00
Yiran Wu 805d8452c4
Fix test error of compressible agent (#631)
* fix bug in test

* update workflow

* update

* deepcopy to copy
2023-11-11 19:57:14 +00:00
wonderful 6bb7acc34d
Handled possible unclear IndexError in ConversableAgent.last_message method (#622)
* Handled possible IndexError in ConversableAgent.last_message method with more clear error message and added test in test_conversable_agent.py.

* Fix code formatting issues.

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-11-11 18:55:57 +00:00
Alvaro Mateos 849feda98e
Enable streaming support for openai v1 (#597)
* Enable streaming support for openai v1

* Added tests for openai client streaming

* Fix test_completion_stream
2023-11-11 14:30:40 +00:00
Ian f77ca897f2
Introducing Experimental GPT Assistant Agent in AutoGen (#616)
* add gpt assistant agent

* complete code

* Inherit class ConversableAgent

* format code

* add code comments

* add test case

* format code

* fix test

* format code

* Improve GPTAssistant

* Use OpenAIWrapper to create client
* Implement clear_history()
* Reply message formatting improvements
* Handle the case when content contains image files

* README update

* Fix doc string of methods

* add multiple conversations support

* Add GPT Assistant Agent into README

* fix test

---------

Co-authored-by: gagb <gagb@users.noreply.github.com>
Co-authored-by: Beibin Li <beibin79@gmail.com>
2023-11-11 13:54:18 +00:00
Yiran Wu 19ea8b8b7a
Add CompressibleAgent (#443)
* api_base -> base_url (#383)

* InvalidRequestError -> BadRequestError (#389)

* remove api_key_path; close #388

* close #402 (#403)

* openai client (#419)

* openai client

* client test

* _client -> client

* _client -> client

* extra kwargs

* Completion -> client (#426)

* Completion -> client

* Completion -> client

* Completion -> client

* Completion -> client

* support aoai

* fix test error

* remove commented code

* support aoai

* annotations

* import

* reduce test

* skip test

* skip test

* skip test

* debug test

* rename test

* update workflow

* update workflow

* env

* py version

* doc improvement

* docstr update

* openai<1

* add compressibleagent

* revise doc, add tests, add example

* fix link

* fix link

* fix link

* remove test

* update doc

* update doc

* add tiktoken to dependency

* filter_func

* async test

* dependency

* revision

* migration guide (#477)

* migration guide

* change in kwargs

* simplify header

* update optigude description

* update for dev

* revision

* revision

* allow not compressing last n msgs

* update

* correct merge

* update test workflow

* check test

* update for test

* update

* update notebook

* update

* fix bug

* update

* update

* update

* check to "pull_request_target" in contrib-openai

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-11-10 04:11:28 +00:00
Chi Wang dfcbea9777
seed -> cache_seed (#600) 2023-11-08 23:39:02 +00:00
Joshua Kim 2a96e4d9d2
Notebook/hierarchy flow (#482)
* Notebook showing how to use select speaker to control conversation flow.

* pytest associated with notebook.

* Added llm_config to assistant and user proxy agent, and clarified why we set use_cache to false, as requested in the review.

* Added a @pytest.mark.skipif decorator like other tests to run it only in one py version, 3.10

* Fixed config warning.

* Removd llm_config to UserProxyAgent

* Fixed minor typos.

* Reran outputs

* Remopved llm_config from user_proxy_agent

* Colab Badge link updated.

* pre-commit formatting changes.

* Fixed base_url

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-11-07 22:06:45 +00:00
Beibin Li b41b366549
Large Multimodal Models in AgentChat (#554)
* LMM Code added

* LLaVA notebook update

* Test cases and Notebook modified for OpenAI v1

* Move LMM into contrib
To resolve test issues and deploy issues
In the future, we can install pillow by default, and then move back
LMM agents into agentchat

* LMM test setup update

* try...except... clause for LMM tests

* disable patch for llava agent test
To resolve dependencies issue for build

* Add LMM Blog

* Change docstring for LMM agents

* Docstring update patch

* llava: insert reply at position 1 now
So, it can still handle human_input_mode
and max_consecutive_reply

* Resolve comments
Fixing: typos, blogs, yml, and add OpenAIWrapper

* Signature typo fix for LMM agent: system_message

* Update LMM "content" from latest OpenAI release
Reference  https://platform.openai.com/docs/guides/vision

* update LMM test according to latest OpenAI release

* Fully support GPT-4V now
1. Add a notebook for GPT-4V. LLava notebook also updated.
2. img_utils updated
3. GPT-4V formatter now return base64 image with mime type
4. Infer mime type directly from b64 image content (while loading
   without suffix)
5. Test cases modified according to all the related changes.

* GPT-4V link updated in blog

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-11-06 21:33:51 +00:00
Li Jiang f052977e24
Add support to unstructrued (#501)
* Add support to unstructrued

* Fix tests

* Add test and documents

* Fix tests

* Fix tests

* Test unstructured on linux and mac
2023-11-05 13:30:28 +00:00
Chi Wang c4f8b1c761
Dev/v0.2 (#393)
* api_base -> base_url (#383)

* InvalidRequestError -> BadRequestError (#389)

* remove api_key_path; close #388

* close #402 (#403)

* openai client (#419)

* openai client

* client test

* _client -> client

* _client -> client

* extra kwargs

* Completion -> client (#426)

* Completion -> client

* Completion -> client

* Completion -> client

* Completion -> client

* support aoai

* fix test error

* remove commented code

* support aoai

* annotations

* import

* reduce test

* skip test

* skip test

* skip test

* debug test

* rename test

* update workflow

* update workflow

* env

* py version

* doc improvement

* docstr update

* openai<1

* add tiktoken to dependency

* filter_func

* async test

* dependency

* migration guide (#477)

* migration guide

* change in kwargs

* simplify header

* update optigude description

* deal with azure gpt-3.5

* add back test_eval_math_responses

* timeout

* Add back tests for RetrieveChat (#480)

* Add back tests for RetrieveChat

* Fix format

* Update dependencies order

* Fix path

* Fix path

* Fix path

* Fix tests

* Add not run openai on MacOS or Win

* Update skip openai tests

* Remove unnecessary dependencies, improve format

* Add py3.8 for testing qdrant

* Fix multiline error of windows

* Add openai tests

* Add dependency mathchat, remove unused envs

* retrieve chat is tested

* bump version to 0.2.0b1

---------

Co-authored-by: Li Jiang <bnujli@gmail.com>
2023-11-04 04:01:49 +00:00
Jason Holtkamp 55d27cccc9
Added example .txt file for agentchat_langchain sample notebook (#373)
* Added example .txt file for agentchat_langchain sample notebook

* Update radius.txt

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-11-02 05:34:05 +00:00
bonadio 957ec00edd
Adding async support to get_human_input (#466)
* Adding async support to get_human_input

* Adjust code for Code formatting testing fail

* Adjust the test_async_get_human_input.py to run async on test

* Adjust the test_async_get_human_input.py for pre-commit-check error

* Adjust the test_async_get_human_input.py for pre-commit-check error v2

* Adjust remove unnecessary register_reply

* Adjust test to use asyncio call

* Adjust go back to not use asyncio
2023-11-01 04:30:22 +00:00
Aayush Chhabra 503c2430f9
Fix/async function and tool execution (#87)
* async run group chat

* conversible agent allow async functions to generate reply

* test for async execution

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-10-31 16:04:32 +00:00
Chi Wang dd90756bdb
bump version to 0.1.14 (#400)
* bump version to 0.1.14

* endpoint

* test

* test

* add ipython to retrievechat dependency

* constraints

* target
2023-10-28 00:24:04 +00:00
Yiran Wu 8c3401dd6a
Add token_count_util (#421)
* add token_count_util

* remove token_count from retrieval util

* format

* update dependency

* update test
2023-10-27 12:57:35 +00:00
Anush 50ac547637
feat: Qdrant vector store support (#303)
* feat: QdrantRetrieveUserProxyAgent

* fix: QdrantRetrieveUserProxyAgent docstring

* chore: batch of 500 all CPU cores

* chore: conditional import for tests

* chore: config parallel, batch 100

* chore: collection creation params

* chore: conditonal payload indexing
fastembed import check

* docs: notebook for QdrantRetrieveUserProxyAgent

* docs: update docs link

* docs: notebook examples update

* chore: hnsw, payload index reference

* docs: notebook docs_path update

* Update test/agentchat/test_qdrant_retrievechat.py

Co-authored-by: Li Jiang <bnujli@gmail.com>

* chore: update notebook output

* Fix format

---------

Co-authored-by: Li Jiang <bnujli@gmail.com>
2023-10-25 05:08:43 +00:00
Li Jiang 80954e4b8d
Fix tmp dir not exists (#401)
* Fix tmp dir not exists

* Update tests to make it more clear

* Add check if save path is not None
2023-10-24 16:09:25 +00:00
Chi Wang 9ed6c8e5d0
config list for test (#395) 2023-10-24 03:54:45 +00: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
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
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
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
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
Shaokun dd9202bb01
Update OptunaSearch (#1106)
* update optuna

* update setup

* fix dependencies

* fix bugs in test

* fix bugs, web format

---------

Co-authored-by: “skzhang1” <“shaokunzhang529@gmail.com”>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-07-05 03:14:02 +00:00
Chi Wang 4f1dfe6676
doc update (#1089)
* doc update

* add link to mathchat notebook

* use_docker property

* function name

* version update

---------

Co-authored-by: kevin666aa <yrwu000627@gmail.com>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-07-04 20:29:32 +00:00
Shaokun 7a64148676
support string alg in tune (#1093)
* support string alg in tune

* add test, enforce string feasible, support lexico in set_search_priorities in CFO

* fix bug

* fix bug

* fix bug

* fix bug

* fix bugs

* fix yiran

---------

Co-authored-by: “skzhang1” <“shaokunzhang529@gmail.com”>
2023-07-01 03:01:14 +00:00
Yiran Wu e3ca95bf8a
An agent implementation of MathChat (#1090)
* mathcaht implementation

* code forrmat

* update readme

* update openai.yml

* update openai.yml

* update openai.yml
2023-06-25 13:49:34 +00:00
EgorKraevTransferwise 5245efbd2c
Factor out time series-related functionality into a time series Task object (#989)
* Refactor into automl subpackage

Moved some of the packages into an automl subpackage to tidy before the
task-based refactor. This is in response to discussions with the group
and a comment on the first task-based PR.

Only changes here are moving subpackages and modules into the new
automl, fixing imports to work with this structure and fixing some
dependencies in setup.py.

* Fix doc building post automl subpackage refactor

* Fix broken links in website post automl subpackage refactor

* Fix broken links in website post automl subpackage refactor

* Remove vw from test deps as this is breaking the build

* Move default back to the top-level

I'd moved this to automl as that's where it's used internally, but had
missed that this is actually part of the public interface so makes sense
to live where it was.

* Re-add top level modules with deprecation warnings

flaml.data, flaml.ml and flaml.model are re-added to the top level,
being re-exported from flaml.automl for backwards compatability. Adding
a deprecation warning so that we can have a planned removal later.

* Fix model.py line-endings

* WIP

* WIP - Notes below

Got to the point where the methods from AutoML are pulled to
GenericTask. Started removing private markers and removing the passing
of automl to these methods. Done with decide_split_type, started on
prepare_data. Need to do the others after

* Re-add generic_task

* Most of the merge done, test_forecast_automl fit succeeds, fails at predict()

* Remaining fixes - test_forecast.py passes

* Comment out holidays-related code as it's not currently used

* Further holidays cleanup

* Fix imports in a test

* tidy up validate_data in time series task

* Test fixes

* Fix tests: add Task.__str__

* Fix tests: test for ray.ObjectRef

* Hotwire TS_Sklearn wrapper to fix test fail

* Attempt at test fix

* Fix test where val_pred_y is a list

* Attempt to fix remaining tests

* Push to retrigger tests

* Push to retrigger tests

* Push to retrigger tests

* Push to retrigger tests

* Remove plots from automl/test_forecast

* Remove unused data size field from Task

* Fix import for CLASSIFICATION in notebook

* Monkey patch TFT to avoid plotting, to fix tests on MacOS

* Monkey patch TFT to avoid plotting v2, to fix tests on MacOS

* Monkey patch TFT to avoid plotting v2, to fix tests on MacOS

* Fix circular import

* remove redundant code in task.py post-merge

* Fix test: set svd_solver="full" in PCA

* Update flaml/automl/data.py

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

* Fix review comments

* Fix task -> str in custom learner constructor

* Remove unused CLASSIFICATION imports

* Hotwire TS_Sklearn wrapper to fix test fail by setting
optimizer_for_horizon == False

* Revert changes to the automl_classification and pin FLAML version

* Fix imports in reverted notebook

* Fix FLAML version in automl notebooks

* Fix ml.py line endings

* Fix CLASSIFICATION task import in automl_classification notebook

* Uncomment pip install in notebook and revert import

Not convinced this will work because of installing an older version of
the package into the environment in which we're running the tests, but
let's see.

* Revert c6a5dd1a0

* Fix get_classification_objective import in suggest.py

* Remove hcrystallball docs reference in TS_Sklearn

* Merge markharley:extract-task-class-from-automl into this

* Fix import, remove smooth.py

* Fix dependencies to fix TFT fail on Windows Python 3.8 and 3.9

* Add tensorboardX dependency to fix TFT fail on Windows Python 3.8 and 3.9

* Set pytorch-lightning==1.9.0 to fix  TFT fail on Windows Python 3.8 and 3.9

* Set pytorch-lightning==1.9.0 to fix  TFT fail on Windows Python 3.8 and 3.9

* Disable PCA reduction of lagged features for now, to fix svd convervence fail

* Merge flaml/main into time_series_task

* Attempt to fix formatting

* Attempt to fix formatting

* tentatively implement holt-winters-no covariates

* fix forecast method, clean class

* checking external regressors too

* update test forecast

* remove duplicated test file, re-add sarimax, search space cleanup

* Update flaml/automl/model.py

removed links. Most important one probably was: https://robjhyndman.com/hyndsight/ets-regressors/

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

* prevent short series

* add docs

* First attempt at merging Holt-Winters

* Linter fix

* Add holt-winters to TimeSeriesTask.estimators

* Fix spark test fail

* Attempt to fix another spark test fail

* Attempt to fix another spark test fail

* Change Black max line length to 127

* Change Black max line length to 120

* Add logging for ARIMA params, clean up time series models inheritance

* Add more logging for missing ARIMA params

* Remove a meaningless test causing a fail, add stricter check on ARIMA params

* Fix a bug in HoltWinters

* A pointless change to hopefully trigger the on and off KeyError in ARIMA.fit()

* Fix formatting

* Attempt to fix formatting

* Attempt to fix formatting

* Attempt to fix formatting

* Attempt to fix formatting

* Add type annotations to _train_with_config() in state.py

* Add type annotations to prepare_sample_train_data() in state.py

* Add docstring for time_col argument of AutoML.fit()

* Address @sonichi's comments on PR

* Fix formatting

* Fix formatting

* Reduce test time budget

* Reduce test time budget

* Increase time budget for the test to pass

* Remove redundant imports

* Remove more redundant imports

* Minor fixes of points raised by Qingyun

* Try to fix pandas import fail

* Try to fix pandas import fail, again

* Try to fix pandas import fail, again

* Try to fix pandas import fail, again

* Try to fix pandas import fail, again

* Try to fix pandas import fail, again

* Try to fix pandas import fail, again

* Try to fix pandas import fail, again

* Try to fix pandas import fail, again

* Try to fix pandas import fail, again

* Try to fix pandas import fail, again

* Formatting fixes

* More formatting fixes

* Added test that loops over TS models to ensure coverage

* Fix formatting issues

* Fix more formatting issues

* Fix random fail in check

* Put back in tests for ARIMA predict without fit

* Put back in tests for lgbm

* Update test/test_model.py

cover dedup

* Match target length to X length in missing test

---------

Co-authored-by: Mark Harley <mark.harley@transferwise.com>
Co-authored-by: Mark Harley <mharley.code@gmail.com>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Andrea W <a.ruggerini@ammagamma.com>
Co-authored-by: Andrea Ruggerini <nescio.adv@gmail.com>
Co-authored-by: Egor Kraev <Egor.Kraev@tw.com>
Co-authored-by: Li Jiang <bnujli@gmail.com>
2023-06-19 11:20:32 +00:00
Chi Wang 8760631349
string to array (#1086)
* string to array

* exclude aoai
2023-06-17 13:11:22 +00:00
Chi Wang e1da7f7d68
update openai model support (#1082)
* update openai model support

* new gpt3.5

* docstr

* function_call and content may co-exist

* test function call

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-06-16 00:58:44 +00:00
Qingyun Wu 0c7082c7bf
Docmentation for agents (#1057)
* add agent notebook and documentation

* fix bug

* set flush to True when printing msg in agent

* add a math problem in agent notebook

* remove

* header

* improve notebook doc

* notebook update

* improve notebook example

* improve doc

* improve notebook doc

* improve print

* doc

* human_input_mode

* human_input_mode str

* indent

* indent

* Update flaml/autogen/agent/user_proxy_agent.py

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

* Update notebook/autogen_agent.ipynb

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

* Update notebook/autogen_agent.ipynb

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

* Update notebook/autogen_agent.ipynb

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

* add agent doc

* del old files

* remove chat

* agent doc

* remove chat_agent

* naming

* improve documentation

* wording

* improve agent doc

* wording

* general auto reply

* update agent doc

* human input mode

* add agent figure

* update agent figure

* update agent example figure

* update code example

* extensibility of UserProxyAgent

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-06-14 23:56:13 +00:00
Chi Wang c5dfb03f0e
encode timeout msg in bytes (#1078)
* encode timeout msg in bytes

* fix msg and test
2023-06-12 18:07:14 +00:00
Chi Wang 5387a0a607
Agent notebook example with human feedback; Support shell command and multiple code blocks; Improve the system message for assistant agent; Improve utility functions for config lists; reuse docker image (#1056)
* add agent notebook and documentation

* fix bug

* set flush to True when printing msg in agent

* add a math problem in agent notebook

* remove

* header

* improve notebook doc

* notebook update

* improve notebook example

* improve doc

* agent notebook example with user feedback

* log

* log

* improve notebook doc

* improve print

* doc

* human_input_mode

* human_input_mode str

* indent

* indent

* Update flaml/autogen/agent/user_proxy_agent.py

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

* shell command and multiple code blocks

* Update notebook/autogen_agent.ipynb

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

* Update notebook/autogen_agent.ipynb

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

* Update notebook/autogen_agent.ipynb

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

* coding agent

* math notebook

* renaming and doc format

* typo

* infer lang

* sh

* docker

* docker

* reset consecutive autoreply counter

* fix explanation

* paper talk

* human feedback

* web info

* rename test

* config list explanation

* link to blogpost

* installation

* homepage features

* features

* features

* rename agent

* remove notebook

* notebook test

* docker command

* notebook update

* lang -> cmd

* notebook

* make it work for gpt-3.5

* return full log

* quote

* docker

* docker

* docker

* docker

* docker

* docker image list

* notebook

* notebook

* use_docker

* use_docker

* use_docker

* doc

* agent

* doc

* abs path

* pandas

* docker

* reuse docker image

* context window

* news

* print format

* pyspark version in py3.8

* pyspark in py3.8

* pyspark and ray

* quote

* pyspark

* pyspark

* pyspark

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-06-09 18:40:04 +00:00
Chi Wang b90e9ee283
doc and test update (#1053)
* doc and test update

* docker update
2023-05-26 20:24:30 +00:00
Chi Wang a0b318b12e
create an automl option to remove unnecessary dependency for autogen and tune (#1007)
* version update post release v1.2.2

* automl option

* import pandas

* remove automl.utils

* default

* test

* type hint and version update

* dependency update

* link to open in colab

* use packging.version to close #725

---------

Co-authored-by: Li Jiang <lijiang1@microsoft.com>
Co-authored-by: Li Jiang <bnujli@gmail.com>
2023-05-24 23:55:04 +00:00
Chi Wang e463146cb8
response filter (#1039)
* response filter

* rewrite implement based on the filter

* multi responses

* abs path

* code handling

* option to not use docker

* context

* eval_only -> raise_error

* notebook

* utils

* utils

* separate tests

* test

* test

* test

* test

* test

* test

* test

* test

* **config in test()

* test

* test

* filename
2023-05-21 22:22:29 +00:00
Li Jiang 7de4eb347d
Fix PULL_REQUEST_TEMPLATE and improve test by removing unnecessary environment variable (#1043)
* Improve test by removing unnecessary environment variable

* Fix PULL_REQUEST_TEMPLATE

* Hide pre-commit check

* remove the checkbox for pre-commit

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

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-05-19 20:05:14 +00:00
Qingyun Wu 2e43509690
Human agent (#1025)
* add human agent and chat agent

* feedback msg

* clean print

* remove redundant import

* make coding agent work

* import check

* terminate condition

* rename

* add docstr

* exitcode to str

* print

* save and execute code

* add max_turn_num

* add max_turn_num in test_agent.py

* reduce max_turn_num in the test

* change max_turn_num to max_consecutive_auto_reply

* update human proxy agent

* remove execution agent and dated docstr

* clean doc

* add back work_dir

* add is_termination_msg when mode is NEVER

* revise stop condition

* remove work_dir in coding agent

* human_proxy_agent docstr

* auto_reply

* clean auto_reply

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-05-16 00:37:38 +00:00
Susan Xueqing Liu f01acb67f6
update model of text summarization (#1030) 2023-05-10 00:48:22 +00:00
Chi Wang 59e882e5cc
chat completion check (#1024)
* chat completion check

* add test

* doc

* timeout

* bump version to 1.2.4
2023-05-09 20:39:46 +00:00
Chi Wang b3fba9734e
Mark experimental classes; doc; multi-config trial (#1021)
* Mark experimental classes

* template

* multi model

* test

* multi-config doc

* doc

* doc

* test

---------

Co-authored-by: Li Jiang <bnujli@gmail.com>
2023-05-05 02:48:31 +00:00
Li Jiang 8b2411b219
update spark session in spark tests (#1006)
* add mlflow and spark integration tests

* remove unused params

* remove mlflow tests
2023-05-03 09:59:29 +00:00
Li Jiang fd1f36597b
update max_spark_parallelism to fit in auto-scale spark cluster (#1008)
* update max_spark_parallelism to fit in auto-scale spark cluster

* update test
2023-05-03 09:16:32 +00:00
garar 31864d2d77
Add mlflow_logging param (#1015)
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-05-03 03:09:04 +00:00
Chi Wang 19aee67f55
coding agent; logging (#1011)
* coding agent

* tsp

* tsp

* aoai

* logging

* compact

* Handle Import Error

* cost function

* reset counter; doc

* reset_counter

* home page update

* use case

* catboost in linux

* catboost

* catboost

* catboost

* doc

* intro

* catboost
2023-05-02 20:38:23 +00:00
Chi Wang fa5ccea862
extract code from text; solve_problem; request_timeout in config; improve code (#999)
* extract code from text

* solve_problem; request_timeout in config

* improve

* move import statement

* improve code

* generate assertions

* constant

* configs for implement; voting

* doc

* execute code in docker

* success indicator of code executation in docker

* success indicator

* execute code

* strip n

* add cost in generate_code

* add docstr

* filename

* bytes

* check docker version

* print log

* python test

* remove api key address

* rename exit code

* success exit code

* datasets

* exit code

* recover openai tests

* cache and pattern match

* wait

* wait

* cache and test

* timeout test

* python image name and skip macos

* windows image

* docker images

* volume path and yaml

* win path -> posix

* extensions

* path

* path

* path

* path

* path

* path

* path

* path

* path

* path

* path

* skip windows

* path

* timeout in windows

* use_docker

* use_docker

* hot fix from #1000

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-04-23 11:50:29 +00:00
Chi Wang d4070e24c1
make context optional; improve error handling and doc (#997)
* make context optional

* better error handling and doc

* skip instantiation if no context

* skip test
2023-04-16 21:18:32 +00:00
Li Jiang c9fc622af1
fix tests failure caused by version incompatibility (#995) 2023-04-15 14:52:40 +00:00
Chi Wang c780d79004
Post release update (#985)
* news update

* doc update

* avoid KeyError

* bump version to 1.2.1

* handle empty responses

* typo

* eval function
2023-04-10 20:46:28 +00:00
Jirka Borovec a701cd82f8
set black with 120 line length (#975)
* set black with 120 line length

* apply pre-commit

* apply black
2023-04-10 19:50:40 +00:00
Susan Xueqing Liu ef5a17cd83
handling nlp divide by zero (#926)
* handling nlp divide by zero

* catching zerodivisionerror

* catching zerodivisionerror

* catching zerodivisionerror

* addressing comments

* addressing comments

* updating test case

* update

* add blank to last line

* update nlp notebook

* rerun

* rerun

* sync with main

* add model selection for nlg

* addressing keyerror

* add raise exception

* update

* fix bug

* revert

* updating automl_nlp

* Update flaml/automl/model.py

Co-authored-by: Zvi Baratz <z.baratz@gmail.com>

* address comments

* address comments

---------

Co-authored-by: Li Jiang <lijiang1@microsoft.com>
Co-authored-by: Zvi Baratz <z.baratz@gmail.com>
2023-04-09 16:53:30 +00:00
Chi Wang 82f0a4309d
autogen subpackage (#968)
* math utils in autogen

* cleanup

* code utils

* remove check function from code response

* comment out test

* GPT-4

* increase request timeout

* name

* logging and error handling

* better doc

* doc

* codegen optimized

* GPT series

* text

* no demo example

* math

* import openai

* import openai

* azure model name

* azure model name

* openai version

* generate assertion if necessary

* condition to generate assertions

* init region key

* rename

* comments about budget

* prompt

---------

Co-authored-by: Susan Xueqing Liu <liususan091219@users.noreply.github.com>
2023-04-08 03:04:01 +00:00
Andrea Ruggerini 7f9402b8fd
Add Holt-Winters exponential smoothing (#962)
* tentatively implement holt-winters-no covariates

* fix forecast method, clean class

* checking external regressors too

* update test forecast

* remove duplicated test file, re-add sarimax, search space cleanup

* Update flaml/automl/model.py

removed links. Most important one probably was: https://robjhyndman.com/hyndsight/ets-regressors/

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

* prevent short series

* add docs

---------

Co-authored-by: Andrea W <a.ruggerini@ammagamma.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-04-04 17:29:54 +00:00
Qingyun Wu 45641000c0
Adding a test function for OpenAI completion in flaml (#951)
* improve max_valid_n and doc

* Update README.md

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

* add support for chatgpt

* notebook

* newline at end of file

* chatgpt notebook

* ChatGPT in Azure

* doc

* math

* warning, timeout, log file name

* handle import error

* doc update; default value

* paper

* doc

* docstr

* eval_func

* add a test func in completion

* update notebook

* update math notebook

* improve notebok

* lint and handle exception

* flake8

* exception in test

* add agg_method

* NameError

* refactor

* Update flaml/integrations/oai/completion.py

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

* Update flaml/integrations/oai/completion.py

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

* add example

* merge files from oai_eval_test

* Revert "merge files from oai_eval_test"
This reverts commit 1e6a550f913bb94df6e9680934ccb7175d00702e.

* merge

* save results to notebook_output

* update version and cache

* update doc

* save nb cell results to file

* fix typo in model name

* code improvements

* improve docstr

* docstr

* docstr on the Returns of test

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Li Jiang <lijiang1@microsoft.com>
Co-authored-by: Susan Xueqing Liu <liususan091219@users.noreply.github.com>
2023-04-02 16:14:11 +00:00
levscaut 05c5f8f426
more tolerant time limit for test_overtime (#960)
* more tolerant time limit for test_overtime

* Cancel assertion becasue github VM sometimes is super slow

---------

Co-authored-by: Li Jiang <lijiang1@microsoft.com>
2023-03-27 04:12:50 +00:00