Skip to content

Commit

Permalink
Autogenstudio Updates [CSV support, Workflow Export, Skill Editing, W…
Browse files Browse the repository at this point in the history
…indows Testing ] (#1475)

* support groupchat, other QOL fixes

* remove gallery success toast

* Fix #1328. Add CSVLoader component and related support for rendering CSV files. Add download link in the modal for appropriate file types including CSV, Code, and PDF.

* add name and description field to session datamodel

* Update website/blog/2023-12-01-AutoGenStudio/index.mdx

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

* sanitize llmconfig, remove additional fields

* improve models UX, only modify models from model tab.

* readme updates

* improve db defaults

* improve ui hover behavior and add note on models

* general qol updats

* add support for returning summary_method

* use ant design tables

* icon and layout updates

* css and layout updates

* readme updates and QOL updates

* fix bug where empty string is used as apikey #1415

* add speaker selection to UI #1373

* Fixed a bug that localAgent updates were not synchronized between GroupChatFlowSpecView and AgentFlowSpecView.

* Fixed a bug in Agent Specification Modal that caused localAgent updates to remain in state when closing a modal other than onOk.

* Fixed a bug that the updated Agent Specification Modal was not saved when the content of FlowConfigViewer Modal was changed after the Agent Specification Modal was updated when an updatedFlowConfig was created using localFlowConfig.

* add version to package

* remove sample key

* early support for versions table and testing models

* Add support for testing model when created #1404

* remove unused imports, qol updates

* fix bug on workflowmanager

* make file_name optional in skills datamodel

* update instructions on models

* fix errors from merge conflict with main

* santize workflow before download

* add support for editing skills in full fledged editor (monaco) #1442

* fix merge artifacts

* Fix build command for windows

Replaced && to & to continue execution when the 'ui' folder doesn't exist and also suppressed error "The system cannot find the file specified."

* Fix setup instructions

The config file starts with a dot (according to gatsby-config.ts).

* Throw error if env file doesn't exist

Otherwise the app will not work (issue very hard to trace)

* version bump

* formattin gupdates

* formatting updates

* Show warning instead of error if env config file doesn't exist

Fix: #1475 (comment)

* add rel noopener to a tags

* formating updates

* remove double section in readme.

* update dev readme

* format update

* add default autoreply to agent config datamodel

* add check for empty messages list

* improve groupchat behavior, add sender to list of agents

* update system_message defaults to fit autogen default system message #1474

* simplify response from test_model to only return content, fix serialization issue in #1404

* readme and other formatting updates

* add support for showing temp and default auto reply #1521

* formatting updates

* formating and other updates

---------

Co-authored-by: Paul Retherford <paul@scanpower.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: junkei_okinawa <ceazy.x2.okinawan@gmail.com>
Co-authored-by: Christopher Pereira <kripper@imatronix.com>
  • Loading branch information
5 people authored Feb 6, 2024
1 parent 26daa18 commit feed806
Show file tree
Hide file tree
Showing 33 changed files with 1,257 additions and 766 deletions.
24 changes: 21 additions & 3 deletions samples/apps/autogen-studio/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# AutoGen Studio

[![PyPI version](https://badge.fury.io/py/autogenstudio.svg)](https://badge.fury.io/py/autogenstudio)
[![Downloads](https://static.pepy.tech/badge/autogenstudio/week)](https://pepy.tech/project/autogenstudio)

Expand All @@ -10,6 +11,9 @@ Code for AutoGen Studio is on GitHub at [microsoft/autogen](https://github.com/m

> **Note**: AutoGen Studio is meant to help you rapidly prototype multi-agent workflows and demonstrate an example of end user interfaces built with AutoGen. It is not meant to be a production-ready app.
> [!WARNING]
> AutoGen Studio is currently under active development and we are iterating quickly. Kindly consider that we may introduce breaking changes in the releases during the upcoming weeks, and also the `README` might be outdated. We'll update the `README` as soon as we stabilize the API.
### Capabilities / Roadmap

Some of the capabilities supported by the app frontend include the following:
Expand All @@ -30,6 +34,8 @@ Project Structure:

There are two ways to install AutoGen Studio - from PyPi or from source. We **recommend installing from PyPi** unless you plan to modify the source code.

There are two ways to install AutoGen Studio - from PyPi or from source. We **recommend installing from PyPi** unless you plan to modify the source code.

1. **Install from PyPi**

We recommend using a virtual environment (e.g., conda) to avoid conflicts with existing Python packages. With Python 3.10 or newer active in your virtual environment, use pip to install AutoGen Studio:
Expand Down Expand Up @@ -64,7 +70,7 @@ For Windows users, to build the frontend, you may need alternative commands to b
```bash
gatsby clean && rmdir /s /q ..\\autogenstudio\\web\\ui && (set \"PREFIX_PATH_VALUE=\" || ver>nul) && gatsby build --prefix-paths && xcopy /E /I /Y public ..\\autogenstudio\\web\\ui
gatsby clean && rmdir /s /q ..\\autogenstudio\\web\\ui 2>nul & (set \"PREFIX_PATH_VALUE=\" || ver>nul) && gatsby build --prefix-paths && xcopy /E /I /Y public ..\\autogenstudio\\web\\ui
```
Expand All @@ -77,6 +83,7 @@ autogenstudio ui --port 8081
```
This will start the application on the specified port. Open your web browser and go to `http://localhost:8081/` to begin using AutoGen Studio.
AutoGen Studio also takes a `--host <host>` argument to specify the host address. By default, it is set to `localhost`. You can also use the `--appdir <appdir>` argument to specify the directory where the app files (e.g., database and generated user files) are stored. By default, it is set to the directory where autogen pip package is installed.
Now that you have AutoGen Studio installed and running, you are ready to explore its capabilities, including defining and modifying agent workflows, interacting with agents and sessions, and expanding agent skills.
Expand Down Expand Up @@ -124,19 +131,30 @@ We welcome contributions to AutoGen Studio. We recommend the following general s
## FAQ
**Q: How do I specify the directory where files(e.g. database) are stored?**
A: You can specify the directory where files are stored by setting the `--appdir` argument when running the application. For example, `autogenstudio ui --appdir /path/to/folder`. This will store the database and other files in the specified directory e.g. `/path/to/folder/database.sqlite`.
**Q: Where can I adjust the default skills, agent and workflow configurations?**
A: You can modify agent configurations directly from the UI or by editing the [dbdefaults.json](autogenstudio/utils/dbdefaults.json) file which is used to initialize the database.
**Q: If I want to reset the entire conversation with an agent, how do I go about it?**
A: To reset your conversation history, you can delete the `database.sqlite` file. If you need to clear user-specific data, remove the relevant `autogenstudio/web/files/user/<user_id_md5hash>` folder.
A: To reset your conversation history, you can delete the `database.sqlite` file in the `--appdir` directory. This will reset the entire conversation history. To delete user files, you can delete the `files` directory in the `--appdir` directory.
**Q: Is it possible to view the output and messages generated by the agents during interactions?**
A: Yes, you can view the generated messages in the debug console of the web UI, providing insights into the agent interactions. Alternatively, you can inspect the `database.sqlite` file for a comprehensive record of messages.
**Q: Can I use other models with AutoGen Studio?**
Yes. AutoGen standardizes on the openai model api format, and you can use any api server that offers an openai compliant endpoint. In the AutoGen Studio UI, each agent has an `llm_config` field where you can input your model endpoint details including `model name`, `api key`, `base url`, `model type` and `api version`. For Azure OpenAI models, you can find these details in the Azure portal. Note that for Azure OpenAI, the `model name` is the deployment id or engine, and the `model type` is "azure".
Yes. AutoGen standardizes on the openai model api format, and you can use any api server that offers an openai compliant endpoint. In the AutoGen Studio UI, each agent has an `llm_config` field where you can input your model endpoint details including `model`, `api key`, `base url`, `model type` and `api version`. For Azure OpenAI models, you can find these details in the Azure portal. Note that for Azure OpenAI, the `model name` is the deployment id or engine, and the `model type` is "azure".
For other OSS models, we recommend using a server such as vllm to instantiate an openai compliant endpoint.
**Q: The server starts but I can't access the UI**
A: If you are running the server on a remote machine (or a local machine that fails to resolve localhost correstly), you may need to specify the host address. By default, the host address is set to `localhost`. You can specify the host address using the `--host <host>` argument. For example, to start the server on port 8081 and local address such that it is accessible from other machines on the network, you can run the following command:

```bash
autogenstudio ui --port 8081 --host 0.0.0.0
```

## Acknowledgements

AutoGen Studio is Based on the [AutoGen](https://microsoft.github.io/autogen) project. It was adapted from a research prototype built in October 2023 (original credits: Gagan Bansal, Adam Fourney, Victor Dibia, Piali Choudhury, Saleema Amershi, Ahmed Awadallah, Chi Wang).
1 change: 1 addition & 0 deletions samples/apps/autogen-studio/autogenstudio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .chatmanager import *
from .workflowmanager import *
from .datamodel import *
from .version import __version__
3 changes: 2 additions & 1 deletion samples/apps/autogen-studio/autogenstudio/chatmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def chat(self, message: Message, history: List, flow_config: AgentWorkFlowConfig

if flow_config.summary_method == "last":
successful_code_blocks = extract_successful_code_blocks(flow.agent_history)
last_message = flow.agent_history[-1]["message"]["content"]
last_message = flow.agent_history[-1]["message"]["content"] if flow.agent_history else ""
successful_code_blocks = "\n\n".join(successful_code_blocks)
output = (last_message + "\n" + successful_code_blocks) if successful_code_blocks else last_message
elif flow_config.summary_method == "llm":
Expand All @@ -43,6 +43,7 @@ def chat(self, message: Message, history: List, flow_config: AgentWorkFlowConfig
output = ""

metadata["code"] = ""
metadata["summary_method"] = flow_config.summary_method
end_time = time.time()
metadata["time"] = end_time - start_time
modified_files = get_modified_files(start_time, end_time, scratch_dir, dest_dir=work_dir)
Expand Down
6 changes: 5 additions & 1 deletion samples/apps/autogen-studio/autogenstudio/datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def dict(self):
@dataclass
class Skill(object):
title: str
file_name: str
content: str
file_name: Optional[str] = None
id: Optional[str] = None
description: Optional[str] = None
timestamp: Optional[str] = None
Expand Down Expand Up @@ -110,6 +110,7 @@ class AgentConfig:
system_message: Optional[str] = None
is_termination_msg: Optional[Union[bool, str, Callable]] = None
code_execution_config: Optional[Union[bool, str, Dict[str, Any]]] = None
default_auto_reply: Optional[str] = ""

def dict(self):
result = asdict(self)
Expand Down Expand Up @@ -172,6 +173,7 @@ class GroupChatFlowSpec:
timestamp: Optional[str] = None
user_id: Optional[str] = None
description: Optional[str] = None
skills: Optional[Union[None, List[Skill]]] = None

def __post_init__(self):
if self.timestamp is None:
Expand Down Expand Up @@ -237,6 +239,8 @@ class Session(object):
id: Optional[str] = None
timestamp: Optional[str] = None
flow_config: AgentWorkFlowConfig = None
name: Optional[str] = None
description: Optional[str] = None

def __post_init__(self):
if self.timestamp is None:
Expand Down
Loading

0 comments on commit feed806

Please sign in to comment.