Files
autogen/samples/apps/autogen-assistant
Victor Dibia 143e49c6e8 Sample Web Application Built with AutoGen (#695)
* Adding research assistant code

* Adding research assistant code

* checking in RA files

* Remove used text file

* Update README.md to include Saleema's name to the Contributors list.

* remove extraneous files

* update gitignore

* improve structure on global skills

* fix linting error

* readme update

* readme update

* fix wrong function bug

* readme update

* update ui build

* cleanup, remove unused modules

* readme and docs updates

* set default user

* ui build update

* add screenshot to improve instructions

* remove logout behaviour, replace with note to developers to add their own logout logic

* Create blog and edit ARA README

* Added the stock prices example in the readme for ARA

* Include edits from review with Saleema

* fix format issues

* Cosmetic changes for betting debug messages

* edit authors

* remove references to request_timeout to support autogen v0.0.2

* update bg color for UI

* readme update

* update research assistant blog post

* omit samples folder from codecov

* ui build update + precommit refactor

* formattiing updates  fromo pre-commit

* readme update

* remove compiled source files

* update gitignore

* refactor, file removals

* refactor for improved structure - datamodel, chat and db helper

* update gitignore

* refactor, file removals

* refactor for improved structure - datamodel, chat and db helper

* refactor skills view

* general refactor

* gitignore update and general refactor

* skills update

* general refactor

* ui folder structure refactor

* improve support for skills loading

* add fetch profile default skill

* refactor chat to autogenchat

* qol refactor

* improve metadata display

* early support for autogenflow in ui

* docs update general refactor

* general refactor

* readme update

* readme update

* readme and cli update

* pre-commit updates

* precommit update

* readme update

* add steup.py for older python build versions

* add manifest.in, update app icon

* in-progress changes to agent specification

* remove use_cache refs

* update datamodel, and fix for default serverurl

* request_timeout

* readme update, fix autogen values

* fix pyautogen version

* precommit formatting and other qol items

* update folder structure

* req update

* readme and docs update

* docs update

* remove duplicate in yaml file

* add support for explicit skills addition

* readme and documentation updates

* general refactor

* remove blog post, schedule for future PR

* readme update, add info on llmconfig

* make use_cache False by default unless set

* minor ui updates

* upgrade ui to use latest uatogen lib version 0.2.0b5

* Ui refactor, support for adding arbitrary model specifications

* formatting/precommit checks

* update readme, utils default skill

---------

Co-authored-by: Piali Choudhury <pialic@microsoft.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2023-11-20 18:40:30 +00:00
..

AutoGen Assistant

ARA

AutoGen Assistant is an Autogen-powered AI app (user interface) that can converse with you to help you conduct research, write and execute code, run saved skills, create new skills (explicitly and by demonstration), and adapt in response to your interactions.

Capabilities / Roadmap

Some of the capabilities supported by the app frontend include the following:

  • Select fron a list of agents (current support for two agent workflows - UserProxyAgent and AssistantAgent)
  • Modify agent configuration (e.g. temperature, model, agent system message, model etc) and chat with updated agent configurations.
  • View agent messages and output files in the UI from agent runs.
  • Support for more complex agent workflows (e.g. GroupChat workflows)
  • Improved user experience (e.g., streaming intermediate model output, better summarization of agent responses, etc)

Project Structure:

  • autogenra/ code for the backend classes and web api (FastAPI)
  • frontend/ code for the webui, built with Gatsby and Tailwind

Getting Started

AutoGen requires access to an LLM. Please see the AutoGen docs on how to configure access to your LLM provider. In this sample, We recommend setting up your OPENAI_API_KEY or AZURE_OPENAI_API_KEY environment variable and then specifying the exact model parameters to be used in the llm_config that is passed to each agent specification. See the get_default_agent_config() method in utils.py to see an example of setting up llm_config. The example below shows how to configure access to an Azure OPENAI LLM.

llm_config = LLMConfig(
        config_list=[{
                "model": "gpt-4",
                "api_key": "<azure_api_key>",
                "api_base": "<azure api base>",
                "api_type": "azure",
                "api_version": "2023-06-01-preview"
        }],
        temperature=0,
    )
export OPENAI_API_KEY=<your_api_key>

Install and Run

To install a prebuilt version of the app from PyPi. We highly recommend using a virtual environment (e.g. miniconda) and python 3.10+ to avoid dependency conflicts.

pip install autogenra
autogenra ui --port 8081  # run the web ui on port 8081

Install from Source

To install the app from source, clone the repository and install the dependencies.

pip install -e .

You will also need to build the app front end. Note that your Gatsby requires node > 14.15.0 . You may need to upgrade your node version as needed.

npm install --global yarn
cd frontend
yarn install
yarn build

The command above will build the frontend ui and copy the build artifacts to the autogenra web ui folder. Note that you may have to run npm install --force --legacy-peer-deps to force resolve some peer dependencies.

Run the web ui:

autogenra ui --port 8081 # run the web ui on port 8081

Navigate to http://localhost:8081/ to view the web ui.

To update the web ui, navigate to the frontend directory, make changes and rebuild the ui.

Capabilities

This demo focuses on the research assistant use case with some generalizations:

  • Skills: The agent is provided with a list of skills that it can leverage while attempting to address a user's query. Each skill is a python function that may be in any file in a folder made availabe to the agents. We separate the concept of global skills available to all agents backend/files/global_utlis_dir and user level skills backend/files/user/<user_hash>/utils_dir, relevant in a multi user environment. Agents are aware skills as they are appended to the system message. A list of example skills is available in the backend/global_utlis_dir folder. Modify the file or create a new file with a function in the same directory to create new global skills.

  • Conversation Persistence: Conversation history is persisted in an sqlite database database.sqlite.

  • Default Agent Workflow: The default a sample workflow with two agents - a user proxy agent and an assistant agent.

Example Usage

Let us use a simple query demonstrating the capabilities of the research assistant.

Plot a chart of NVDA and TESLA stock price YTD. Save the result to a file named nvda_tesla.png

The agents responds by writing and executing code to create a python program to generate the chart with the stock prices.

Note than there could be multiple turns between the AssistantAgent and the UserProxyAgent to produce and execute the code in order to complete the task.

ARA

Note: You can also view the debug console that generates useful information to see how the agents are interacting in the background.

FAQ

  • How do I add more skills to the research assistant? This can be done by adding a new file with documented functions to autogenra/web/skills/global directory.
  • How do I specify the agent configuration (e.g. temperature, model, agent system message, model etc). You can do either from the UI interface or by modifying the default agent configuration in utils.py (get_default_agent_config() method)
  • How do I reset the conversation? You can reset the conversation by deleting the database.sqlite file. You can also delete user files by deleting the autogenra/web/files/user/<user_id_md5hash> folder.
  • How do I view messages generated by agents? You can view the messages generated by the agents in the debug console. You can also view the messages in the database.sqlite file.

Acknowledgements

Based on the AutoGen project. Adapted in October 2023 from a research prototype (original credits: Gagan Bansal, Adam Fourney, Victor Dibia, Piali Choudhury, Saleema Amershi, Ahmed Awadallah, Chi Wang)