* Feat/headless browser (retargeted) (#1832)
* Add headless browser to the WebSurferAgent, closes#1481
* replace soup.get_text() with markdownify.MarkdownConverter().convert_soup(soup)
* import HeadlessChromeBrowser
* implicitly wait for 10s
* inicrease max. wait time to 99s
* fix: trim trailing whitespace
* test: fix headless tests
* better bing query search
* docs: add example 3 for headless option
---------
Co-authored-by: Vijay Ramesh <vijay@regrello.com>
* Handle missing Selenium package.
* Added browser_chat.py example to simplify testing.
* Based browser on mdconvert. (#1847)
* Based browser on mdconvert.
* Updated web_surfer.
* Renamed HeadlessChromeBrowser to SeleniumChromeBrowser
* Added an initial POC with Playwright.
* Separated Bing search into it's own utility module.
* Simple browser now uses Bing tools.
* Updated Playwright browser to inherit from SimpleTextBrowser
* Got Selenium working too.
* Renamed classes and files for consistency.
* Added more instructions.
* Initial work to support other search providers.
* Added some basic behavior when the BING_API_KEY is missing.
* Cleaned up some search results.
* Moved to using the request.Sessions object. Moved Bing SERP paring to mdconvert to be more broadly useful.
* Added backward compatibility to WebSurferAgent
* Selenium and Playwright now grab the whole DOM, not jus the body, allowing the converters access to metadata.
* Fixed printing of page titles in Playwright.
* Moved installation of WebSurfer dependencies to contrib-tests.yml
* Fixing pre-commit issues.
* Reverting conversable_agent, which should not have been changed in prior commit.
* Added RequestMarkdownBrowser tests.
* Fixed a bug with Bing search, and added search test cases.
* Added tests for Bing search.
* Added tests for md_convert
* Added test files.
* Added missing pptx.
* Added more tests for WebSurfer coverage.
* Fixed guard on requests_markdown_browser test.
* Updated test coverage for mdconvert.
* Fix brwser_utils tests.
* Removed image test from browser, since exiftool isn't installed on test machine.
* Removed image test from browser, since exiftool isn't installed on test machine.
* Disable Selenium GPU and sandbox to ensure it runs headless in Docker.
* Added option for Bing API results to be interleaved (as Bing specifies), or presented in a categorized list (Web, News, Videos), etc
* Print more details when requests exceptions are thrown.
* Added additional documentation to markdown_search
* Added documentation to the selenium_markdown_browser.
* Added documentation to playwright_markdown_browser.py
* Added documentation to requests_markdown_browser
* Added documentation to mdconvert.py
* Updated agentchat_surfer notebook.
* Update .github/workflows/contrib-tests.yml
Co-authored-by: Davor Runje <davor@airt.ai>
* Merge main. Resolve conflicts.
* Resolve pre-commit checks.
* Removed offending LFS file.
* Re-added offending LFS file.
* Fixed browser_utils tests.
* Fixed style errors.
---------
Co-authored-by: Asapanna Rakesh <45640029+INF800@users.noreply.github.com>
Co-authored-by: Vijay Ramesh <vijay@regrello.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Davor Runje <davor@airt.ai>
* Add isort
* Apply isort on py files
* Fix circular import
* Fix format for notebooks
* Fix format
---------
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
* Validate llm_config passed to ConversableAgent
Based on #1522, this commit implements the additional validation checks in
`ConversableAgent.`
Add the following validation and `raise ValueError` if:
- The `llm_config` is `None`.
- The `llm_config` is valid, but `config_list` is missing or lacks elements.
- The `config_list` is valid, but no `model` is specified.
The rest of the changes are code churn to adjust or add the test cases.
* Validate llm_config passed to ConversableAgent
Based on #1522, this commit implements the additional validation checks in
`ConversableAgent.`
Add the following validation and `raise ValueError` if:
- The `llm_config` is `None` (validated in `ConversableAgent`).
- The `llm_config` has no `model` specified and `config_list` is empty
(validated in `OpenAIWrapper`).
- The `config_list` has at least one entry, but not all the entries have
the `model` is specified (validated in `OpenAIWrapper`).
The rest of the changes are code churn to adjust or add the test cases.
* Validate llm_config passed to ConversableAgent
Based on #1522, this commit implements the additional validation checks in
`ConversableAgent.`
Add the following validation and `raise ValueError` if:
- The `llm_config` is `None` (validated in `ConversableAgent`).
- The `llm_config` has no `model` specified and `config_list` is empty
(validated in `OpenAIWrapper`).
- The `config_list` has at least one entry, but not all the entries have
the `model` is specified (validated in `OpenAIWrapper`).
The rest of the changes are code churn to adjust or add the test cases.
* Validate llm_config passed to ConversableAgent
Based on #1522, this commit implements the additional validation checks in
`ConversableAgent.`
Add the following validation and `raise ValueError` if:
- The `llm_config` is `None` (validated in `ConversableAgent`).
- The `llm_config` has no `model` specified and `config_list` is empty
(validated in `OpenAIWrapper`).
- The `config_list` has at least one entry, but not all the entries have
the `model` is specified (validated in `OpenAIWrapper`).
The rest of the changes are code churn to adjust or add the test cases.
* Validate llm_config passed to ConversableAgent
Based on #1522, this commit implements the additional validation checks in
`ConversableAgent.`
Add the following validation and `raise ValueError` if:
- The `llm_config` is `None` (validated in `ConversableAgent`).
- The `llm_config` has no `model` specified and `config_list` is empty
(validated in `OpenAIWrapper`).
- The `config_list` has at least one entry, but not all the entries have
the `model` is specified (validated in `OpenAIWrapper`).
The rest of the changes are code churn to adjust or add the test cases.
* Fix the test_web_surfer issue
For anyone reading this: you need to `pip install markdownify` for the
`import WebSurferAgent` to succeed. That is needed to run the
`test_web_surfer.py` locally.
Test logic needs `llm_config` that is not `None` and that is not
`False`.
Let us pray that this works as part of GitHub actions ...
* One more fix for llm_config validation contract
* 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>
* 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>
* 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