A programming framework for agentic AI
Autogenstudio - Add GroupChat Support to UI (#1352)
Victor Dibia30b84d4254dc
diff --git a/samples/apps/autogen-studio/MANIFEST.in b/samples/apps/autogen-studio/MANIFEST.inindex 6406a9240..8882713fa 100644--- a/samples/apps/autogen-studio/MANIFEST.in+++ b/samples/apps/autogen-studio/MANIFEST.in@@ -1,5 +1,7 @@recursive-include autogenstudio/web/ui *+recursive-include autogenstudio/web/database.sqliterecursive-exclude notebooks *+recursive-exclude frontend *recursive-exclude docs *recursive-exclude tests *diff --git a/samples/apps/autogen-studio/README.md b/samples/apps/autogen-studio/README.mdindex 6eb2a1acd..0f007731d 100644--- a/samples/apps/autogen-studio/README.md+++ b/samples/apps/autogen-studio/README.md@@ -28,6 +28,8 @@ Project Structure:### Installation+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:@@ -108,6 +110,18 @@ The agent workflow responds by _writing and executing code_ to create a python p<!--  -->+## Contribution Guide++We welcome contributions to AutoGen Studio. We recommend the following general steps to contribute to the project:++- Review the overall AutoGen project [contribution guide](https://github.com/microsoft/autogen?tab=readme-ov-file#contributing)+- Please review the AutoGen Studio [roadmap](https://github.com/microsoft/autogen/issues/737) to get a sense of the current priorities for the project. Help is appreciated especially with Studio issues tagged with `help-wanted`+- Please initiate a discussion on the roadmap issue or a new issue to discuss your proposed contribution.+- Please review the autogenstudio dev branch here [dev branch](https://github.com/microsoft/autogen/tree/autogenstudio) and use as a base for your contribution. This way, your contribution will be aligned with the latest changes in the AutoGen Studio project.+- Submit a pull request with your contribution!+- If you are modifying AutoGen Studio, it has its own devcontainer. See instructions in `.devcontainer/README.md` to use it+- Please use the tag `studio` for any issues, questions, and PRs related to Studio+## FAQ**Q: Where can I adjust the default skills, agent and workflow configurations?**@@ -119,6 +133,10 @@ A: To reset your conversation history, you can delete the `database.sqlite` file**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".+For other OSS models, we recommend using a server such as vllm to instantiate an openai compliant endpoint.+## AcknowledgementsAutoGen 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).diff --git a/samples/apps/autogen-studio/autogenstudio/chatmanager.py b/samples/apps/autogen-studio/autogenstudio/chatmanager.pyindex 52dd37c16..034a139e9 100644--- a/samples/apps/autogen-studio/autogenstudio/chatmanager.py+++ b/samples/apps/autogen-studio/autogenstudio/chatmanager.py@@ -19,7 +19,6 @@ class AutoGenChatManager:if flow_config is None:flow_config = get_default_agent_config(scratch_dir)- # print("Flow config: ", flow_config)flow = AutoGenWorkFlowManager(config=flow_config, history=history, work_dir=scratch_dir)message_text = message.content.strip()diff --git a/samples/apps/autogen-studio/autogenstudio/cli.py b/samples/apps/autogen-studio/autogenstudio/cli.pyindex 22692700f..ed4e89f2a 100644--- a/samples/apps/autogen-studio/autogenstudio/cli.py+++ b/samples/apps/autogen-studio/autogenstudio/cli.py@@ -4,6 +4,7 @@ import typerimport uvicornfrom .version import VERSION+from .utils.dbutils import DBManagerapp = typer.Typer()@@ -15,12 +16,23 @@ def ui(workers: int = 1,reload: Annotated[bool, typer.Option("--reload")] = False,docs: bool = False,+ appdir: str = None,):"""- Launch the AutoGen Studio UI CLI .Pass in parameters host, port, workers, and reload to override the default values.+ Run the AutoGen Studio UI.++ Args:+ host (str, optional): Host to run the UI on. Defaults to 127.0.0.1 (localhost).+ port (int, optional): Port to run the UI on. Defaults to 8081.+ workers (int, optional): Number of workers to run the UI with. Defaults to 1.+ reload (bool, optional): Whether to reload the UI on code changes. Defaults to False.+ docs (bool, optional): Whether to generate API docs. Defaults to False.+ appdir (str, optional): Path to the AutoGen Studio app directory. Defaults to None."""- os.environ["AUTOGENUI_API_DOCS"] = str(docs)+ os.environ["AUTOGENSTUDIO_API_DOCS"] = str(docs)+ if appdir:+ os.environ["AUTOGENSTUDIO_APPDIR"] = appdiruvicorn.run("autogenstudio.web.app:app",@@ -37,7 +49,7 @@ def version():Print the version of the AutoGen Studio UI CLI."""- typer.echo(f"AutoGen Studio UI CLI version: {VERSION}")+ typer.echo(f"AutoGen Studio CLI version: {VERSION}")def run():diff --git a/samples/apps/autogen-studio/autogenstudio/datamodel.py b/samples/apps/autogen-studio/autogenstudio/datamodel.pyindex be23dbdb0..283cd2610 100644--- a/samples/apps/autogen-studio/autogenstudio/datamodel.py+++ b/samples/apps/autogen-studio/autogenstudio/datamodel.py@@ -58,7 +58,7 @@ class Skill(object):# autogenflow data models@dataclass-class ModelConfig:+class Model:"""Data model for Model Config item in LLMConfig for AutoGen"""model: str@@ -66,17 +66,38 @@ class ModelConfig:base_url: Optional[str] = Noneapi_type: Optional[str] = Noneapi_version: Optional[str] = None+ id: Optional[str] = None+ timestamp: Optional[str] = None+ user_id: Optional[str] = None+ description: Optional[str] = None++ def dict(self):+ result = asdict(self)+ return result++ def __post_init__(self):+ if self.id is None:+ self.id = str(uuid.uuid4())+ if self.timestamp is None:+ self.timestamp = datetime.now().isoformat()+ if self.user_id is None:+ self.user_id = "default"@dataclassclass LLMConfig:"""Data model for LLM Config for AutoGen"""- config_list: List[Any] = field(default_factory=List)+ config_list: List[Any] = field(default_factory=list)temperature: float = 0cache_seed: Optional[Union[int, None]] = Nonetimeout: Optional[int] = None+ def dict(self):+ result = asdict(self)+ result["config_list"] = [c.dict() for c in self.config_list]+ return result+@dataclassclass AgentConfig:@@ -101,8 +122,8 @@ class AgentConfig:class AgentFlowSpec:"""Data model to help flow load agents from config"""- type: Literal["assistant", "userproxy", "groupchat"]- config: AgentConfig = field(default_factory=AgentConfig)+ type: Literal["assistant", "userproxy"]+ config: AgentConfigid: Optional[str] = Nonetimestamp: Optional[str] = Noneuser_id: Optional[str] = None@@ -122,6 +143,51 @@ class AgentFlowSpec:return result+@dataclass+class GroupChatConfig:+ """Data model for GroupChat Config for AutoGen"""++ agents: List[AgentFlowSpec] = field(default_factory=list)+ admin_name: str = "Admin"+ messages: List[Dict] = field(default_factory=list)+ max_round: Optional[int] = 10+ admin_name: Optional[str] = "Admin"+ speaker_selection_method: Optional[str] = "auto"+ allow_repeat_speaker: Optional[Union[bool, List[AgentConfig]]] = True++ def dict(self):+ result = asdict(self)+ result["agents"] = [a.dict() for a in self.agents]+ return result+++@dataclass+class GroupChatFlowSpec:+ """Data model to help flow load agents from config"""++ type: Literal["groupchat"]+ config: AgentConfig = field(default_factory=AgentConfig)+ groupchat_config: Optional[GroupChatConfig] = field(default_factory=GroupChatConfig)+ id: Optional[str] = None+ timestamp: Optional[str] = None+ user_id: Optional[str] = None+ description: Optional[str] = None++ def __post_init__(self):+ if self.timestamp is None:+ self.timestamp = datetime.now().isoformat()+ if self.id is None:+ self.id = str(uuid.uuid4())+ if self.user_id is None:+ self.user_id = "default"++ def dict(self):+ result = asdict(self)+ # result["config"] = self.config.dict()+ # result["groupchat_config"] = self.groupchat_config.dict()+ return result++@dataclassclass AgentWorkFlowConfig:"""Data model for Flow Config for AutoGen"""@@ -129,17 +195,28 @@ class AgentWorkFlowConfig:name: strdescription: strsender: AgentFlowSpec- receiver: Union[AgentFlowSpec, List[AgentFlowSpec]]- type: Literal["default", "groupchat"] = "default"+ receiver: Union[AgentFlowSpec, GroupChatFlowSpec]+ type: Literal["twoagents", "groupchat"] = "twoagents"id: Optional[str] = Noneuser_id: Optional[str] = Nonetimestamp: Optional[str] = None# how the agent message summary is generated. last: only last message is used, none: no summary, llm: use llm to generate summarysummary_method: Optional[Literal["last", "none", "llm"]] = "last"+ def init_spec(self, spec: Dict):+ """initialize the agent spec"""+ if not isinstance(spec, dict):+ spec = spec.dict()+ if spec["type"] == "groupchat":+ return GroupChatFlowSpec(**spec)+ else:+ return AgentFlowSpec(**spec)+def __post_init__(self):if self.id is None:self.id = str(uuid.uuid4())+ self.sender = self.init_spec(self.sender)+ self.receiver = self.init_spec(self.receiver)if self.user_id is None:self.user_id = "default"if self.timestamp is None:@@ -148,10 +225,7 @@ class AgentWorkFlowConfig:def dict(self):result = asdict(self)result["sender"] = self.sender.dict()- if isinstance(self.receiver, list):- result["receiver"] = [r.dict() for r in self.receiver]- else:- result["receiver"] = self.receiver.dict()+ result["receiver"] = self.receiver.dict()return result@@ -221,3 +295,4 @@ class DBWebRequestModel(object):tags: Optional[List[str]] = Noneagent: Optional[AgentFlowSpec] = Noneworkflow: Optional[AgentWorkFlowConfig] = None+ model: Optional[Model] = Nonediff --git a/samples/apps/autogen-studio/autogenstudio/utils/dbdefaults.json b/samples/apps/autogen-studio/autogenstudio/utils/dbdefaults.jsonindex 570323652..e3fd80697 100644--- a/samples/apps/autogen-studio/autogenstudio/utils/dbdefaults.json+++ b/samples/apps/autogen-studio/autogenstudio/utils/dbdefaults.json@@ -1,4 +1,24 @@{+ "models": [+ {+ "model": "gpt-4",+ "api_key": "Your Azure API key here",+ "base_url": "Your Azure base URL here",+ "api_type": "azure",+ "api_version": "Your Azure API version here",+ "description": "Azure Open AI model configuration"+ },+ {+ "model": "gpt-4-1106-preview",+ "description": "OpenAI model configuration"+ },+ {+ "model": "TheBloke/zephyr-7B-alpha-AWQ",+ "api_key": "EMPTY",+ "base_url": "Your Model Endpoint",+ "description": "Zephyr (local model configuration)"+ }+ ],"agents": [{"type": "userproxy",@@ -79,14 +99,15 @@],"workflows": [{- "name": "General Agent Workflow",- "description": "This workflow is used for general purpose tasks.",+ "name": "Visualization Agent Workflow",+ "description": "This workflow is used for visualization tasks.","sender": {"type": "userproxy",+ "description": "User proxy agent to execute code","config": {"name": "userproxy","human_input_mode": "NEVER",- "max_consecutive_auto_reply": 10,+ "max_consecutive_auto_reply": 5,"system_message": "","llm_config": false,"code_execution_config": {@@ -97,23 +118,9 @@},"receiver": {"type": "assistant",- "description": "Default assistant to generate plans and write code to solve tasks.",- "skills": [- {- "title": "find_papers_arxiv",- "description": "This skill finds relevant papers on arXiv given a query.",- "content": "import os\nimport re\nimport json\nimport hashlib\n\n\ndef search_arxiv(query, max_results=10):\n \"\"\"\n Searches arXiv for the given query using the arXiv API, then returns the search results. This is a helper function. In most cases, callers will want to use 'find_relevant_papers( query, max_results )' instead.\n\n Args:\n query (str): The search query.\n max_results (int, optional): The maximum number of search results to return. Defaults to 10.\n\n Returns:\n jresults (list): A list of dictionaries. Each dictionary contains fields such as 'title', 'authors', 'summary', and 'pdf_url'\n\n Example:\n >>> results = search_arxiv(\"attention is all you need\")\n >>> print(results)\n \"\"\"\n\n import arxiv\n\n key = hashlib.md5((\"search_arxiv(\" + str(max_results) + \")\" + query).encode(\"utf-8\")).hexdigest()\n # Create the cache if it doesn't exist\n cache_dir = \".cache\"\n if not os.path.isdir(cache_dir):\n os.mkdir(cache_dir)\n\n fname = os.path.join(cache_dir, key + \".cache\")\n\n # Cache hit\n if os.path.isfile(fname):\n fh = open(fname, \"r\", encoding=\"utf-8\")\n data = json.loads(fh.read())\n fh.close()\n return data\n\n # Normalize the query, removing operator keywords\n query = re.sub(r\"[^\\s\\w]\", \" \", query.lower())\n query = re.sub(r\"\\s(and|or|not)\\s\", \" \", \" \" + query + \" \")\n query = re.sub(r\"[^\\s\\w]\", \" \", query.lower())\n query = re.sub(r\"\\s+\", \" \", query).strip()\n\n search = arxiv.Search(query=query, max_results=max_results, sort_by=arxiv.SortCriterion.Relevance)\n\n jresults = list()\n for result in search.results():\n r = dict()\n r[\"entry_id\"] = result.entry_id\n r[\"updated\"] = str(result.updated)\n r[\"published\"] = str(result.published)\n r[\"title\"] = result.title\n r[\"authors\"] = [str(a) for a in result.authors]\n r[\"summary\"] = result.summary\n r[\"comment\"] = result.comment\n r[\"journal_ref\"] = result.journal_ref\n r[\"doi\"] = result.doi\n r[\"primary_category\"] = result.primary_category\n r[\"categories\"] = result.categories\n r[\"links\"] = [str(link) for link in result.links]\n r[\"pdf_url\"] = result.pdf_url\n jresults.append(r)\n\n if len(jresults) > max_results:\n jresults = jresults[0:max_results]\n\n # Save to cache\n fh = open(fname, \"w\")\n fh.write(json.dumps(jresults))\n fh.close()\n return jresults\n",- "file_name": "find_papers_arxiv.py"- },- {- "title": "generate_images",- "description": "This skill generates images from a given query using OpenAI's DALL-E model and saves them to disk.",- "content": "from typing import List\nimport uuid\nimport requests # to perform HTTP requests\nfrom pathlib import Path\n\nfrom openai import OpenAI\n\n\ndef generate_and_save_images(query: str, image_size: str = \"1024x1024\") -> List[str]:\n \"\"\"\n Function to paint, draw or illustrate images based on the users query or request. Generates images from a given query using OpenAI's DALL-E model and saves them to disk. Use the code below anytime there is a request to create an image.\n\n :param query: A natural language description of the image to be generated.\n :param image_size: The size of the image to be generated. (default is \"1024x1024\")\n :return: A list of filenames for the saved images.\n \"\"\"\n\n client = OpenAI() # Initialize the OpenAI client\n response = client.images.generate(model=\"dall-e-3\", prompt=query, n=1, size=image_size) # Generate images\n\n # List to store the file names of saved images\n saved_files = []\n\n # Check if the response is successful\n if response.data:\n for image_data in response.data:\n # Generate a random UUID as the file name\n file_name = str(uuid.uuid4()) + \".png\" # Assuming the image is a PNG\n file_path = Path(file_name)\n\n img_url = image_data.url\n img_response = requests.get(img_url)\n if img_response.status_code == 200:\n # Write the binary content to a file\n with open(file_path, \"wb\") as img_file:\n img_file.write(img_response.content)\n print(f\"Image saved to {file_path}\")\n saved_files.append(str(file_path))\n else:\n print(f\"Failed to download the image from {img_url}\")\n else:\n print(\"No image data found in the response!\")\n\n # Return the list of saved files\n return saved_files\n\n\n# Example usage of the function:\n# generate_and_save_images(\"A cute baby sea otter\")\n",- "file_name": "generate_images.py"- }- ],+ "description": "Visualization assistant to create plans and write code to generate visualizations","config": {- "name": "primary_assistant",+ "name": "visualization_assistant","llm_config": {"config_list": [{@@ -132,18 +139,18 @@"cache_seed": null},"human_input_mode": "NEVER",- "max_consecutive_auto_reply": 15,- "system_message": "You are a helpful assistant that can use available functions when needed to solve problems. At each point, do your best to determine if the user's request has been addressed. IF THE REQUEST HAS NOT BEEN ADDRESSED, RESPOND WITH CODE TO ADDRESS IT. IF A FAILURE OCCURRED (e.g., due to a missing library) AND SOME ADDITIONAL CODE WAS WRITTEN (e.g. code to install the library), ENSURE THAT THE ORIGINAL CODE TO ADDRESS THE TASK STILL GETS EXECUTED. If the request HAS been addressed, respond with a summary of the result. The summary must be written as a coherent helpful response to the user request e.g. 'Sure, here is result to your request ' or 'The tallest mountain in Africa is ..' etc. The summary MUST end with the word TERMINATE. If the user request is pleasantry or greeting, you should respond with a pleasantry or greeting and TERMINATE."+ "max_consecutive_auto_reply": 4,+ "system_message": "Your task is to ensure you generate a high quality visualization for the user. Your visualizations must follow best practices and you must articulate your reasoning for your choices. The visualization must not have grid or outline box. The visualization should have an APPROPRIATE ASPECT RATIO e..g rectangular for time series data. The title must be bold. Importantly, if THE CHART IS A LINE CHART, you MUST ADD A LINE OF BEST FIT and ADD TEXT ON THE SLOPE OF EACH LINE. Note that today's date is 12/10/2023. At each point, do your best to determine if the user's request has been addressed and if so, respond with a summary. The summary must be written as a coherent helpful response to the user request e.g. 'Sure, here is result to your request '. The summary MUST end with the word TERMINATE. If the user request is pleasantry or greeting, you should respond with a pleasantry or greeting and TERMINATE."}},- "type": "default"+ "type": "twoagents"},{- "name": "Visualization Agent Workflow",- "description": "This workflow is used for visualization tasks.",+ "name": "Travel Agent Group Chat Workflow",+ "description": "A group chat workflow",+ "type": "groupchat","sender": {"type": "userproxy",- "description": "User proxy agent to execute code","config": {"name": "userproxy","human_input_mode": "NEVER",@@ -156,11 +163,127 @@}}},+ "receiver": {+ "type": "groupchat",+ "config": {+ "name": "group_chat_manager",+ "llm_config": {+ "config_list": [+ {+ "model": "gpt-4-1106-preview"+ }+ ],+ "temperature": 0.1,+ "timeout": 600,+ "cache_seed": 42+ },+ "human_input_mode": "NEVER",+ "system_message": "Group chat manager"+ },+ "groupchat_config": {+ "admin_name": "Admin",+ "max_round": 10,+ "speaker_selection_method": "auto",++ "agents": [+ {+ "type": "assistant",+ "config": {+ "name": "primary_assistant",+ "llm_config": {+ "config_list": [+ {+ "model": "gpt-4-1106-preview"+ }+ ],+ "temperature": 0.1,+ "timeout": 600,+ "cache_seed": 42+ },+ "human_input_mode": "NEVER",+ "max_consecutive_auto_reply": 8,+ "system_message": "You are a helpful assistant that can suggest a travel itinerary for a user. You are the primary cordinator who will receive suggestions or advice from other agents (local_assistant, language_assistant). You must ensure that the finally plan integrates the suggestions from other agents or team members. YOUR FINAL RESPONSE MUST BE THE COMPLETE PLAN that ends with the word TERMINATE. "+ }+ },+ {+ "type": "assistant",+ "config": {+ "name": "local_assistant",+ "llm_config": {+ "config_list": [+ {+ "model": "gpt-4-1106-preview"+ }+ ],+ "temperature": 0.1,+ "timeout": 600,+ "cache_seed": 42+ },+ "human_input_mode": "NEVER",+ "max_consecutive_auto_reply": 8,+ "system_message": "You are a helpful assistant that can review travel plans, providing critical feedback on how the trip can be enriched for enjoyment of the local culture. If the plan already includes local experiences, you can mention that the plan is satisfactory, with rationale."+ }+ },+ {+ "type": "assistant",+ "config": {+ "name": "language_assistant",+ "llm_config": {+ "config_list": [+ {+ "model": "gpt-4-1106-preview"+ }+ ],+ "temperature": 0.1,+ "timeout": 600,+ "cache_seed": 42+ },+ "human_input_mode": "NEVER",+ "max_consecutive_auto_reply": 8,+ "system_message": "You are a helpful assistant that can review travel plans, providing feedback on important/critical tips about how best to address language or communication challenges for the given destination. If the plan already includes language tips, you can mention that the plan is satisfactory, with rationale."+ }+ }+ ]+ }+ }+ },+ {+ "name": "General Agent Workflow",+ "description": "This workflow is used for general purpose tasks.",+ "sender": {+ "type": "userproxy",+ "description": "A user proxy agent that executes code.",+ "config": {+ "name": "userproxy",+ "human_input_mode": "NEVER",+ "max_consecutive_auto_reply": 10,+ "system_message": "",+ "llm_config": false,+ "code_execution_config": {+ "work_dir": null,+ "use_docker": false+ }+ }+ },"receiver": {"type": "assistant",- "description": "Visualization assistant to create plans and write code to generate visualizations",+ "description": "Default assistant to generate plans and write code to solve tasks.",+ "skills": [+ {+ "title": "find_papers_arxiv",+ "description": "This skill finds relevant papers on arXiv given a query.",+ "content": "import os\nimport re\nimport json\nimport hashlib\n\n\ndef search_arxiv(query, max_results=10):\n \"\"\"\n Searches arXiv for the given query using the arXiv API, then returns the search results. This is a helper function. In most cases, callers will want to use 'find_relevant_papers( query, max_results )' instead.\n\n Args:\n query (str): The search query.\n max_results (int, optional): The maximum number of search results to return. Defaults to 10.\n\n Returns:\n jresults (list): A list of dictionaries. Each dictionary contains fields such as 'title', 'authors', 'summary', and 'pdf_url'\n\n Example:\n >>> results = search_arxiv(\"attention is all you need\")\n >>> print(results)\n \"\"\"\n\n import arxiv\n\n key = hashlib.md5((\"search_arxiv(\" + str(max_results) + \")\" + query).encode(\"utf-8\")).hexdigest()\n # Create the cache if it doesn't exist\n cache_dir = \".cache\"\n if not os.path.isdir(cache_dir):\n os.mkdir(cache_dir)\n\n fname = os.path.join(cache_dir, key + \".cache\")\n\n # Cache hit\n if os.path.isfile(fname):\n fh = open(fname, \"r\", encoding=\"utf-8\")\n data = json.loads(fh.read())\n fh.close()\n return data\n\n # Normalize the query, removing operator keywords\n query = re.sub(r\"[^\\s\\w]\", \" \", query.lower())\n query = re.sub(r\"\\s(and|or|not)\\s\", \" \", \" \" + query + \" \")\n query = re.sub(r\"[^\\s\\w]\", \" \", query.lower())\n query = re.sub(r\"\\s+\", \" \", query).strip()\n\n search = arxiv.Search(query=query, max_results=max_results, sort_by=arxiv.SortCriterion.Relevance)\n\n jresults = list()\n for result in search.results():\n r = dict()\n r[\"entry_id\"] = result.entry_id\n r[\"updated\"] = str(result.updated)\n r[\"published\"] = str(result.published)\n r[\"title\"] = result.title\n r[\"authors\"] = [str(a) for a in result.authors]\n r[\"summary\"] = result.summary\n r[\"comment\"] = result.comment\n r[\"journal_ref\"] = result.journal_ref\n r[\"doi\"] = result.doi\n r[\"primary_category\"] = result.primary_category\n r[\"categories\"] = result.categories\n r[\"links\"] = [str(link) for link in result.links]\n r[\"pdf_url\"] = result.pdf_url\n jresults.append(r)\n\n if len(jresults) > max_results:\n jresults = jresults[0:max_results]\n\n # Save to cache\n fh = open(fname, \"w\")\n fh.write(json.dumps(jresults))\n fh.close()\n return jresults\n",+ "file_name": "find_papers_arxiv.py"+ },+ {+ "title": "generate_images",+ "description": "This skill generates images from a given query using OpenAI's DALL-E model and saves them to disk.",+ "content": "from typing import List\nimport uuid\nimport requests # to perform HTTP requests\nfrom pathlib import Path\n\nfrom openai import OpenAI\n\n\ndef generate_and_save_images(query: str, image_size: str = \"1024x1024\") -> List[str]:\n \"\"\"\n Function to paint, draw or illustrate images based on the users query or request. Generates images from a given query using OpenAI's DALL-E model and saves them to disk. Use the code below anytime there is a request to create an image.\n\n :param query: A natural language description of the image to be generated.\n :param image_size: The size of the image to be generated. (default is \"1024x1024\")\n :return: A list of filenames for the saved images.\n \"\"\"\n\n client = OpenAI() # Initialize the OpenAI client\n response = client.images.generate(model=\"dall-e-3\", prompt=query, n=1, size=image_size) # Generate images\n\n # List to store the file names of saved images\n saved_files = []\n\n # Check if the response is successful\n if response.data:\n for image_data in response.data:\n # Generate a random UUID as the file name\n file_name = str(uuid.uuid4()) + \".png\" # Assuming the image is a PNG\n file_path = Path(file_name)\n\n img_url = image_data.url\n img_response = requests.get(img_url)\n if img_response.status_code == 200:\n # Write the binary content to a file\n with open(file_path, \"wb\") as img_file:\n img_file.write(img_response.content)\n print(f\"Image saved to {file_path}\")\n saved_files.append(str(file_path))\n else:\n print(f\"Failed to download the image from {img_url}\")\n else:\n print(\"No image data found in the response!\")\n\n # Return the list of saved files\n return saved_files\n\n\n# Example usage of the function:\n# generate_and_save_images(\"A cute baby sea otter\")\n",+ "file_name": "generate_images.py"+ }+ ],"config": {- "name": "visualization_assistant",+ "name": "primary_assistant","llm_config": {"config_list": [{@@ -179,11 +302,11 @@"cache_seed": null},"human_input_mode": "NEVER",- "max_consecutive_auto_reply": 4,- "system_message": "Your task is to ensure you generate a high quality visualization for the user. Your visualizations must follow best practices and you must articulate your reasoning for your choices. The visualization must not have grid or outline box. The visualization should have an APPROPRIATE ASPECT RATIO e..g rectangular for time series data. The title must be bold. Importantly, if THE CHART IS A LINE CHART, you MUST ADD A LINE OF BEST FIT and ADD TEXT ON THE SLOPE OF EACH LINE. Note that today's date is 12/10/2023. At each point, do your best to determine if the user's request has been addressed and if so, respond with a summary. The summary must be written as a coherent helpful response to the user request e.g. 'Sure, here is result to your request '. The summary MUST end with the word TERMINATE. If the user request is pleasantry or greeting, you should respond with a pleasantry or greeting and TERMINATE."+ "max_consecutive_auto_reply": 15,+ "system_message": "You are a helpful assistant that can use available functions when needed to solve problems. At each point, do your best to determine if the user's request has been addressed. IF THE REQUEST HAS NOT BEEN ADDRESSED, RESPOND WITH CODE TO ADDRESS IT. IF A FAILURE OCCURRED (e.g., due to a missing library) AND SOME ADDITIONAL CODE WAS WRITTEN (e.g. code to install the library), ENSURE THAT THE ORIGINAL CODE TO ADDRESS THE TASK STILL GETS EXECUTED. If the request HAS been addressed, respond with a summary of the result. The summary must be written as a coherent helpful response to the user request e.g. 'Sure, here is result to your request ' or 'The tallest mountain in Africa is ..' etc. The summary MUST end with the word TERMINATE. If the user request is pleasantry or greeting, you should respond with a pleasantry or greeting and TERMINATE."}},- "type": "default"+ "type": "twoagents"}]}diff --git a/samples/apps/autogen-studio/autogenstudio/utils/dbutils.py b/samples/apps/autogen-studio/autogenstudio/utils/dbutils.pyindex 17d05f737..d1891081b 100644--- a/samples/apps/autogen-studio/autogenstudio/utils/dbutils.py+++ b/samples/apps/autogen-studio/autogenstudio/utils/dbutils.py@@ -4,7 +4,23 @@ import sqlite3import threadingimport osfrom typing import Any, List, Dict, Optional, Tuple-from ..datamodel import AgentFlowSpec, AgentWorkFlowConfig, Gallery, Message, Session, Skill+from ..datamodel import AgentFlowSpec, AgentWorkFlowConfig, Gallery, Message, Model, Session, Skill+++MODELS_TABLE_SQL = """+ CREATE TABLE IF NOT EXISTS models (+ id TEXT NOT NULL,+ user_id TEXT NOT NULL,+ timestamp DATETIME NOT NULL,+ model TEXT,+ api_key TEXT,+ base_url TEXT,+ api_type TEXT,+ api_version TEXT,+ description TEXT,+ UNIQUE (id, user_id)+ )+ """MESSAGES_TABLE_SQL = """@@ -136,7 +152,10 @@ class DBManager:self.conn = sqlite3.connect(path, check_same_thread=False, **kwargs)self.cursor = self.conn.cursor()- # Create the table with the specified columns, appropriate data types, and a UNIQUE constraint on (root_msg_id, msg_id)+ # Create the models table+ self.cursor.execute(MODELS_TABLE_SQL)++ # Create the messages tableself.cursor.execute(MESSAGES_TABLE_SQL)# Create a sessions table@@ -160,6 +179,24 @@ class DBManager:data = json.load(json_file)skills = data["skills"]agents = data["agents"]+ models = data["models"]+ for model in models:+ model = Model(**model)+ self.cursor.execute(+ "INSERT INTO models (id, user_id, timestamp, model, api_key, base_url, api_type, api_version, description) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",+ (+ model.id,+ "default",+ model.timestamp,+ model.model,+ model.api_key,+ model.base_url,+ model.api_type,+ model.api_version,+ model.description,+ ),+ )+for skill in skills:skill = Skill(**skill)@@ -229,7 +266,7 @@ class DBManager:def commit(self) -> None:"""- Commits the current transaction to the database.+ Commits the current transaction Modelto the database."""self.conn.commit()@@ -240,6 +277,96 @@ class DBManager:self.conn.close()+def get_models(user_id: str, dbmanager: DBManager) -> List[dict]:+ """+ Get all models for a given user from the database.++ Args:+ user_id: The user id to get models for+ dbmanager: The DBManager instance to interact with the database++ Returns:+ A list of model configurations+ """+ query = "SELECT * FROM models WHERE user_id = ? OR user_id = ?"+ args = (user_id, "default")+ results = dbmanager.query(query, args, return_json=True)+ return results+++def upsert_model(model: Model, dbmanager: DBManager) -> List[dict]:+ """+ Insert or update a model configuration in the database.++ Args:+ model: The Model object containing model configuration data+ dbmanager: The DBManager instance to interact with the database++ Returns:+ A list of model configurations+ """++ # Check if the model config with the provided id already exists in the database+ existing_model = get_item_by_field("models", "id", model.id, dbmanager)++ if existing_model:+ # If the model config exists, update it with the new data+ updated_data = {+ "model": model.model,+ "api_key": model.api_key,+ "base_url": model.base_url,+ "api_type": model.api_type,+ "api_version": model.api_version,+ "user_id": model.user_id,+ "timestamp": model.timestamp,+ "description": model.description,+ }+ update_item("models", model.id, updated_data, dbmanager)+ else:+ # If the model config does not exist, insert a new one+ query = """+ INSERT INTO models (id, user_id, timestamp, model, api_key, base_url, api_type, api_version, description)+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)+ """+ args = (+ model.id,+ model.user_id,+ model.timestamp,+ model.model,+ model.api_key,+ model.base_url,+ model.api_type,+ model.api_version,+ model.description,+ )+ dbmanager.query(query=query, args=args)++ # Return the inserted or updated model config+ models = get_models(model.user_id, dbmanager)+ return models+++def delete_model(model: Model, dbmanager: DBManager) -> List[dict]:+ """+ Delete a model configuration from the database where id = model.id and user_id = model.user_id.++ Args:+ model: The Model object containing model configuration data+ dbmanager: The DBManager instance to interact with the database++ Returns:+ A list of model configurations+ """++ query = "DELETE FROM models WHERE id = ? AND user_id = ?"+ args = (model.id, model.user_id)+ dbmanager.query(query=query, args=args)++ # Return the remaining model configs+ models = get_models(model.user_id, dbmanager)+ return models++def create_message(message: Message, dbmanager: DBManager) -> None:"""Save a message in the database using the provided database manager.@@ -615,6 +742,8 @@ def upsert_workflow(workflow: AgentWorkFlowConfig, dbmanager: DBManager) -> List"""existing_workflow = get_item_by_field("workflows", "id", workflow.id, dbmanager)+ # print(workflow.receiver)+if existing_workflow:updated_data = {"user_id": workflow.user_id,diff --git a/samples/apps/autogen-studio/autogenstudio/utils/utils.py b/samples/apps/autogen-studio/autogenstudio/utils/utils.pyindex 4306c897c..ce2778f09 100644--- a/samples/apps/autogen-studio/autogenstudio/utils/utils.py+++ b/samples/apps/autogen-studio/autogenstudio/utils/utils.py@@ -4,6 +4,7 @@ import hashlibfrom typing import List, Dict, Tuple, Unionimport osimport shutil+from pathlib import Pathimport reimport autogenfrom ..datamodel import AgentConfig, AgentFlowSpec, AgentWorkFlowConfig, LLMConfig, Skill@@ -25,6 +26,9 @@ def clear_folder(folder_path: str) -> None::param folder_path: The path to the folder to clear."""+ # exit if the folder does not exist+ if not os.path.exists(folder_path):+ returnfor file in os.listdir(folder_path):file_path = os.path.join(folder_path, file)if os.path.isfile(file_path):@@ -181,7 +185,10 @@ def get_modified_files(shutil.copy2(file_path, dest_file_path)# Extract user id from the dest_dir and file path- uid = dest_dir.split("/")[-1]++ dest_dir_as_path = Path(dest_dir)+ uid = dest_dir_as_path.name+relative_file_path = os.path.relpath(dest_file_path, start=dest_dir)file_type = get_file_type(dest_file_path)file_dict = {@@ -253,14 +260,9 @@ install via pip and use --quiet option.if not os.path.exists(work_dir):os.makedirs(work_dir)- # check if skills.py exist. if exists, append to the file, else create a new file and write to it-- if os.path.exists(os.path.join(work_dir, "skills.py")):- with open(os.path.join(work_dir, "skills.py"), "a", encoding="utf-8") as f:- f.write(prompt)- else:- with open(os.path.join(work_dir, "skills.py"), "w", encoding="utf-8") as f:- f.write(prompt)+ # overwrite skills.py in work_dir+ with open(os.path.join(work_dir, "skills.py"), "w", encoding="utf-8") as f:+ f.write(prompt)return instruction + promptdiff --git a/samples/apps/autogen-studio/autogenstudio/version.py b/samples/apps/autogen-studio/autogenstudio/version.pyindex 39d2c6a40..51feb3765 100644--- a/samples/apps/autogen-studio/autogenstudio/version.py+++ b/samples/apps/autogen-studio/autogenstudio/version.py@@ -1,3 +1,4 @@-VERSION = "0.0.18a"+VERSION = "0.0.33a"__version__ = VERSION+__db_version__ = "0.0.1"APP_NAME = "autogenstudio"diff --git a/samples/apps/autogen-studio/autogenstudio/web/app.py b/samples/apps/autogen-studio/autogenstudio/web/app.pyindex 161aae91a..6934c7e8a 100644--- a/samples/apps/autogen-studio/autogenstudio/web/app.py+++ b/samples/apps/autogen-studio/autogenstudio/web/app.py@@ -5,7 +5,7 @@ from fastapi import FastAPIfrom fastapi.middleware.cors import CORSMiddlewarefrom fastapi.staticfiles import StaticFilesfrom fastapi import HTTPException-+from ..version import VERSIONfrom ..datamodel import (ChatWebRequestModel,@@ -37,15 +37,16 @@ app.add_middleware()-root_file_path = os.path.dirname(os.path.abspath(__file__))+root_file_path = os.environ.get("AUTOGENSTUDIO_APPDIR") or os.path.dirname(os.path.abspath(__file__))# init folders skills, workdir, static, files etcfolders = init_webserver_folders(root_file_path)+ui_folder_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ui")api = FastAPI(root_path="/api")# mount an api route such that the main route serves the ui and the /apiapp.mount("/api", api)-app.mount("/", StaticFiles(directory=folders["static_folder_root"], html=True), name="ui")+app.mount("/", StaticFiles(directory=ui_folder_path, html=True), name="ui")api.mount("/files", StaticFiles(directory=folders["files_static_root"], html=True), name="files")@@ -345,6 +346,66 @@ async def delete_user_agent(req: DBWebRequestModel):}[email protected]("/models")+async def get_user_models(user_id: str):+ try:+ models = dbutils.get_models(user_id, dbmanager=dbmanager)++ return {+ "status": True,+ "message": "Models retrieved successfully",+ "data": models,+ }+ except Exception as ex_error:+ print(ex_error)+ return {+ "status": False,+ "message": "Error occurred while retrieving models: " + str(ex_error),+ }++[email protected]("/models")+async def create_user_models(req: DBWebRequestModel):+ """Create a new model for a user"""++ try:+ models = dbutils.upsert_model(model=req.model, dbmanager=dbmanager)++ return {+ "status": True,+ "message": "Model created successfully",+ "data": models,+ }++ except Exception as ex_error:+ print(traceback.format_exc())+ return {+ "status": False,+ "message": "Error occurred while creating model: " + str(ex_error),+ }++[email protected]("/models/delete")+async def delete_user_model(req: DBWebRequestModel):+ """Delete a model for a user"""++ try:+ models = dbutils.delete_model(model=req.model, dbmanager=dbmanager)++ return {+ "status": True,+ "message": "Model deleted successfully",+ "data": models,+ }++ except Exception as ex_error:+ print(traceback.format_exc())+ return {+ "status": False,+ "message": "Error occurred while deleting model: " + str(ex_error),+ }++@api.get("/workflows")async def get_user_workflows(user_id: str):try:@@ -401,3 +462,12 @@ async def delete_user_workflow(req: DBWebRequestModel):"status": False,"message": "Error occurred while deleting workflow: " + str(ex_error),}++[email protected]("/version")+async def get_version():+ return {+ "status": True,+ "message": "Version retrieved successfully",+ "data": {"version": VERSION},+ }diff --git a/samples/apps/autogen-studio/autogenstudio/workflowmanager.py b/samples/apps/autogen-studio/autogenstudio/workflowmanager.pyindex a28bc9a7d..62c3b977c 100644--- a/samples/apps/autogen-studio/autogenstudio/workflowmanager.py+++ b/samples/apps/autogen-studio/autogenstudio/workflowmanager.py@@ -1,7 +1,7 @@from typing import List, Optionalfrom dataclasses import asdictimport autogen-from .datamodel import AgentFlowSpec, AgentWorkFlowConfig, Message+from .datamodel import AgentConfig, AgentFlowSpec, AgentWorkFlowConfig, GroupChatConfig, Messagefrom .utils import get_skills_from_prompt, clear_folderfrom datetime import datetime@@ -31,7 +31,9 @@ class AutoGenWorkFlowManager:if clear_work_dir:clear_folder(self.work_dir)+ # given the config, return an AutoGen agent objectself.sender = self.load(config.sender)+ # given the config, return an AutoGen agent objectself.receiver = self.load(config.receiver)self.agent_history = []@@ -42,10 +44,17 @@ class AutoGenWorkFlowManager:if "callback" in config and config["callback"] is not None:callback = config["callback"]callback(sender, recipient, messages[-1])+ last_message = messages[-1]++ sender = sender.name+ recipient = recipient.name+ if "name" in last_message:+ sender = last_message["name"]+iteration = {- "sender": sender.name,- "recipient": recipient.name,- "message": messages[-1],+ "recipient": recipient,+ "sender": sender,+ "message": last_message,"timestamp": datetime.now().isoformat(),}self.agent_history.append(iteration)@@ -102,7 +111,7 @@ class AutoGenWorkFlowManager:"""agent_spec.config.is_termination_msg = agent_spec.config.is_termination_msg or (- lambda x: "TERMINATE" in x.get("content", "").rstrip()+ lambda x: "TERMINATE" in x.get("content", "").rstrip()[-20:])skills_prompt = ""if agent_spec.skills:@@ -135,16 +144,41 @@ class AutoGenWorkFlowManager:Returns:An instance of the loaded agent."""- agent: autogen.Agent- agent_spec = self.sanitize_agent_spec(agent_spec)- if agent_spec.type == "assistant":- agent = autogen.AssistantAgent(**asdict(agent_spec.config))++ if agent_spec.type == "groupchat":+ agents = [+ self.load(self.sanitize_agent_spec(agent_config)) for agent_config in agent_spec.groupchat_config.agents+ ]+ group_chat_config = agent_spec.groupchat_config.dict()+ group_chat_config["agents"] = agents+ groupchat = autogen.GroupChat(**group_chat_config)+ manager = autogen.GroupChatManager(groupchat=groupchat, **agent_spec.config.dict())+ return manager++ else:+ agent_spec = self.sanitize_agent_spec(agent_spec)+ agent = self.load_agent_config(agent_spec.config, agent_spec.type)+ return agent++ def load_agent_config(self, agent_config: AgentConfig, agent_type: str) -> autogen.Agent:+ """+ Loads an agent based on the provided agent configuration.++ Args:+ agent_config: The configuration of the agent to be loaded.+ agent_type: The type of the agent to be loaded.++ Returns:+ An instance of the loaded agent.+ """+ if agent_type == "assistant":+ agent = autogen.AssistantAgent(**agent_config.dict())agent.register_reply([autogen.Agent, None], reply_func=self.process_reply, config={"callback": None})- elif agent_spec.type == "userproxy":- agent = autogen.UserProxyAgent(**asdict(agent_spec.config))+ elif agent_type == "userproxy":+ agent = autogen.UserProxyAgent(**agent_config.dict())agent.register_reply([autogen.Agent, None], reply_func=self.process_reply, config={"callback": None})else:- raise ValueError(f"Unknown agent type: {agent_spec.type}")+ raise ValueError(f"Unknown agent type: {agent_type}")return agentdef run(self, message: str, clear_history: bool = False) -> None:diff --git a/samples/apps/autogen-studio/frontend/gatsby-config.ts b/samples/apps/autogen-studio/frontend/gatsby-config.tsindex 047412b52..923e531f5 100644--- a/samples/apps/autogen-studio/frontend/gatsby-config.ts+++ b/samples/apps/autogen-studio/frontend/gatsby-config.ts@@ -7,7 +7,7 @@ require("dotenv").config({const config: GatsbyConfig = {pathPrefix: `${process.env.PREFIX_PATH_VALUE}`,siteMetadata: {- title: `AutoGen Studio`,+ title: `AutoGen Studio [Beta]`,description: `Build Multi-Agent Apps`,siteUrl: `http://tbd.place`,},diff --git a/samples/apps/autogen-studio/frontend/src/components/atoms.tsx b/samples/apps/autogen-studio/frontend/src/components/atoms.tsxindex 8cb0dd0ea..dfdc3b4bc 100644--- a/samples/apps/autogen-studio/frontend/src/components/atoms.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/atoms.tsx@@ -7,10 +7,23 @@ import {PlusIcon,ArrowPathIcon,ArrowDownRightIcon,+ PencilIcon,+ UserGroupIcon,+ UsersIcon,} from "@heroicons/react/24/outline";import React, { ReactNode, useEffect, useRef, useState } from "react";import Icon from "./icons";-import { Button, Input, Modal, Select, Slider, Tooltip, message } from "antd";+import {+ Button,+ Dropdown,+ Input,+ MenuProps,+ Modal,+ Select,+ Slider,+ Tooltip,+ message,+} from "antd";import remarkGfm from "remark-gfm";import ReactMarkdown from "react-markdown";import { atomDark } from "react-syntax-highlighter/dist/esm/styles/prism";@@ -19,6 +32,7 @@ import { fetchJSON, getServerUrl, truncateText } from "./utils";import {IAgentFlowSpec,IFlowConfig,+ IGroupChatFlowSpec,IModelConfig,ISkill,IStatus,@@ -27,6 +41,7 @@ import { ResizableBox } from "react-resizable";import debounce from "lodash.debounce";import TextArea from "antd/es/input/TextArea";import { appContext } from "../hooks/provider";+import Item from "antd/es/list/Item";interface CodeProps {node?: any;@@ -603,17 +618,27 @@ export const ModelSelector = ({null);const [editIndex, setEditIndex] = useState<number | null>(null);+ const [loading, setLoading] = useState(false);+ const [error, setError] = useState<string | null>(null);++ const [models, setModels] = useState<IModelConfig[]>([]);+ const serverUrl = getServerUrl();++ const { user } = React.useContext(appContext);+ const listModelsUrl = `${serverUrl}/models?user_id=${user?.email}`;const sanitizeModelConfig = (config: IModelConfig) => {const sanitizedConfig: IModelConfig = { model: config.model };if (config.api_key) sanitizedConfig.api_key = config.api_key;if (config.base_url) sanitizedConfig.base_url = config.base_url;if (config.api_type) sanitizedConfig.api_type = config.api_type;+ if (config.api_version) sanitizedConfig.api_version = config.api_version;return sanitizedConfig;};const handleRemoveConfig = (index: number) => {const updatedConfigs = configs.filter((_, i) => i !== index);+setConfigs(updatedConfigs);};@@ -623,6 +648,78 @@ export const ModelSelector = ({setIsModalVisible(true);};+ const fetchModels = () => {+ setError(null);+ setLoading(true);+ // const fetch;+ const payLoad = {+ method: "GET",+ headers: {+ "Content-Type": "application/json",+ },+ };++ const onSuccess = (data: any) => {+ if (data && data.status) {+ // message.success(data.message);+ setModels(data.data);+ } else {+ message.error(data.message);+ }+ setLoading(false);+ };+ const onError = (err: any) => {+ setError(err);+ message.error(err.message);+ setLoading(false);+ };+ fetchJSON(listModelsUrl, payLoad, onSuccess, onError);+ };++ useEffect(() => {+ fetchModels();+ }, []);++ const modelItems: MenuProps["items"] =+ models.length > 0+ ? models.map((model: IModelConfig, index: number) => ({+ key: index,+ label: model.model,+ value: index,+ }))+ : [+ {+ key: -1,+ label: "No models found",+ value: 0,+ },+ ];++ const modelOnClick: MenuProps["onClick"] = ({ key }) => {+ const selectedIndex = parseInt(key.toString());+ let selectedModel = models[selectedIndex];+ selectedModel = sanitizeModelConfig(selectedModel);+ const updatedConfigs = [...configs, selectedModel];+ setConfigs(updatedConfigs);+ };++ const AddModelsDropDown = () => {+ return (+ <Dropdown+ menu={{ items: modelItems, onClick: modelOnClick }}+ placement="bottomRight"+ trigger={["click"]}+ >+ <div+ className="inline-flex mr-1 mb-1 p-1 px-2 rounded border hover:border-accent duration-300 hover:text-accent"+ role="button"+ >+ add <PlusIcon className="w-4 h-4 inline-block mt-1" />+ </div>+ </Dropdown>+ );+ };+const handleOk = () => {if (newModelConfig?.model.trim()) {const sanitizedConfig = sanitizeModelConfig(newModelConfig);@@ -665,6 +762,7 @@ export const ModelSelector = ({return (<divkey={"modelrow_" + i}+ role="button"className="mr-1 mb-1 p-1 px-2 rounded border"onClick={() => showModal(config, i)}>@@ -692,18 +790,7 @@ export const ModelSelector = ({<div className={`${className}`}><div className="flex flex-wrap">{modelButtons}- <div- className="inline-flex mr-1 mb-1 p-1 px-2 rounded border hover:border-accent duration-300 hover:text-accent"- role="button"- onClick={() =>- showModal(- { model: "", api_key: "", base_url: "", api_type: "" },- null- )- }- >- add <PlusIcon className="w-4 h-4 inline-block mt-1" />- </div>+ <AddModelsDropDown /></div><Modaltitle={`${editIndex !== null ? "Edit" : "Add"} Model Configuration`}@@ -879,27 +966,26 @@ export const AgentFlowSpecView = ({// Event handlers for updating local state and propagating changesconst onControlChange = (value: any, key: string) => {+ if (key === "llm_config") {+ if (value.config_list.length === 0) {+ value = false;+ }+ }const updatedFlowSpec = {...localFlowSpec,config: { ...localFlowSpec.config, [key]: value },};+ console.log(updatedFlowSpec.config.llm_config);setLocalFlowSpec(updatedFlowSpec);setFlowSpec(updatedFlowSpec);};- const onDebouncedControlChange = React.useCallback(- debounce((value: any, key: string) => {- onControlChange(value, key);- }, 3000),- [onControlChange]- );-const llm_config = localFlowSpec.config.llm_config || { config_list: [] };return (<>- <div className="text-accent">{title}</div>- <GroupView title={flowSpec.config.name} className="mb-4">+ <div className="text-accent ">{title}</div>+ <GroupView title={flowSpec.config.name} className="mb-4 bg-primary "><ControlRowViewtitle="Agent Name"className="mt-4"@@ -950,7 +1036,7 @@ export const AgentFlowSpecView = ({max={30}defaultValue={flowSpec.config.max_consecutive_auto_reply}step={1}- onAfterChange={(value: any) => {+ onChange={(value: any) => {onControlChange(value, "max_consecutive_auto_reply");}}/>@@ -971,8 +1057,8 @@ export const AgentFlowSpecView = ({options={[{ label: "NEVER", value: "NEVER" },- { label: "TERMINATE", value: "TERMINATE" },- { label: "ALWAYS", value: "ALWAYS" },+ // { label: "TERMINATE", value: "TERMINATE" },+ // { label: "ALWAYS", value: "ALWAYS" },] as any}/>@@ -991,7 +1077,8 @@ export const AgentFlowSpecView = ({value={flowSpec.config.system_message}rows={3}onChange={(e) => {- onDebouncedControlChange(e.target.value, "system_message");+ // onDebouncedControlChange(e.target.value, "system_message");+ onControlChange(e.target.value, "system_message");}}/>}@@ -1262,6 +1349,341 @@ export const SkillLoader = ({);};+const GroupChatFlowSpecView = ({+ flowSpec,+ setFlowSpec,+ flowSpecs,+}: {+ flowSpec: IGroupChatFlowSpec | null;+ setFlowSpec: (flowSpec: IGroupChatFlowSpec | null) => void;+ flowSpecs: IAgentFlowSpec[];+}) => {+ const [showAgentModal, setShowAgentModal] = React.useState(false);+ const [selectedAgent, setSelectedAgent] = React.useState<number | null>(null);++ const handleRemoveAgent = (index: number) => {+ const updatedAgents = flowSpec?.groupchat_config.agents.filter(+ (_, i) => i !== index+ );+ if (flowSpec?.groupchat_config && updatedAgents) {+ setFlowSpec({+ ...flowSpec,+ groupchat_config: {+ ...flowSpec?.groupchat_config,+ agents: updatedAgents,+ },+ });+ }+ };++ const handleAddAgent = (agent: IAgentFlowSpec) => {+ if (flowSpec?.groupchat_config && flowSpec?.groupchat_config.agents) {+ const updatedAgents = [...flowSpec?.groupchat_config.agents, agent];+ if (flowSpec?.groupchat_config) {+ setFlowSpec({+ ...flowSpec,+ groupchat_config: {+ ...flowSpec?.groupchat_config,+ agents: updatedAgents,+ },+ });+ }+ }+ };++ const handleAgentUpdate = (updatedAgent: IAgentFlowSpec, index: number) => {+ const updatedAgents = flowSpec?.groupchat_config.agents.map((agent, i) => {+ if (i === index) {+ return updatedAgent;+ }+ return agent;+ });+ if (flowSpec?.groupchat_config && updatedAgents) {+ setFlowSpec({+ ...flowSpec,+ groupchat_config: {+ ...flowSpec?.groupchat_config,+ agents: updatedAgents,+ },+ });+ }+ };++ const agentItems: MenuProps["items"] = flowSpecs.map(+ (flowSpec: IAgentFlowSpec, index: number) => ({+ key: index,+ label: flowSpec.config.name,+ value: index,+ })+ );++ const agentOnClick: MenuProps["onClick"] = ({ key }) => {+ const selectedIndex = parseInt(key.toString());+ const selectedAgent = flowSpecs[selectedIndex];+ handleAddAgent(selectedAgent);+ };++ const AgentDropDown = () => {+ return (+ <Dropdown+ menu={{ items: agentItems, onClick: agentOnClick }}+ placement="bottomRight"+ trigger={["click"]}+ >+ <div+ className="inline-flex mr-1 mb-1 p-1 px-2 rounded border hover:border-accent duration-300 hover:text-accent"+ role="button"+ >+ add <PlusIcon className="w-4 h-4 inline-block mt-1" />+ </div>+ </Dropdown>+ );+ };++ const agentsView = flowSpec?.groupchat_config.agents.map(+ (flowSpec: IAgentFlowSpec, index: number) => {+ const tooltipText = `Agent: ${flowSpec?.config.name}`;+ return (+ <div+ key={"agent" + index}+ className="mr-1 mb-1 p-1 px-2 rounded border"+ role="button"+ onClick={() => {+ setSelectedAgent(index);+ // setShowAgentModal(true);+ }}+ >+ <div className="inline-flex">+ {" "}+ <Tooltip title={tooltipText}>+ <div className="">{flowSpec.config.name} </div>{" "}+ </Tooltip>+ <div+ role="button"+ onClick={(e) => {+ e.stopPropagation();+ handleRemoveAgent(index);+ }}+ className="ml-1 text-primary hover:text-accent duration-300"+ >+ <XMarkIcon className="w-4 h-4 inline-block" />+ </div>+ </div>+ </div>+ );+ }+ );++ useEffect(() => {+ if (selectedAgent !== null) {+ // showAgentModal = true;+ setShowAgentModal(true);+ }+ }, [selectedAgent]);++ return (+ <div className="mb-4">+ {showAgentModal &&+ selectedAgent !== null &&+ flowSpec?.groupchat_config && (+ <AgentModal+ agent={flowSpec?.groupchat_config.agents[selectedAgent]}+ showAgentModal={showAgentModal}+ setShowAgentModal={setShowAgentModal}+ handler={(agent: IAgentFlowSpec | null) => {+ if (agent) {+ handleAgentUpdate(agent, selectedAgent);+ console.log("updating agent at index", selectedAgent, agent);+ }+ setSelectedAgent(null);+ }}+ />+ )}+ <GroupView title="Group Chat Agents">+ <div className="flex flex-wrap mt-3">+ {agentsView}+ <AgentDropDown />+ </div>+ </GroupView>+ </div>+ );+};++const AgentModal = ({+ agent,+ showAgentModal,+ setShowAgentModal,+ handler,+}: {+ agent: IAgentFlowSpec | null;+ showAgentModal: boolean;+ setShowAgentModal: (show: boolean) => void;+ handler?: (agent: IAgentFlowSpec | null) => void;+}) => {+ const [localAgent, setLocalAgent] = React.useState<IAgentFlowSpec | null>(+ agent+ );+ const [selectedFlowSpec, setSelectedFlowSpec] = useState<number | null>(0);++ const serverUrl = getServerUrl();+ const { user } = React.useContext(appContext);+ const listAgentsUrl = `${serverUrl}/agents?user_id=${user?.email}`;++ const [flowSpecs, setFlowSpecs] = useState<IAgentFlowSpec[]>([]);+ useEffect(() => {+ fetchAgents();+ }, []);++ const fetchAgents = () => {+ const onSuccess = (data: any) => {+ if (data && data.status) {+ setFlowSpecs(data.data);+ }+ };+ const onError = (err: any) => {+ console.error(err);+ };+ const payLoad = {+ method: "GET",+ headers: {+ "Content-Type": "application/json",+ },+ };+ fetchJSON(listAgentsUrl, payLoad, onSuccess, onError);+ };++ const handleAgentChange = (value: any) => {+ setSelectedFlowSpec(value);+ setLocalAgent(flowSpecs[value]);+ };++ return (+ <Modal+ title={+ <>+ Agent Specification{" "}+ <span className="text-accent font-normal">{agent?.config.name}</span>{" "}+ </>+ }+ width={800}+ open={showAgentModal}+ onOk={() => {+ if (handler) {+ handler(localAgent);+ }+ setShowAgentModal(false);+ }}+ onCancel={() => {+ setShowAgentModal(false);+ }}+ >+ {agent && (+ <>+ {" "}+ <div className="text-sm text-secondary mt-2">+ Modify current agent{" "}+ </div>+ {localAgent && localAgent.type === "groupchat" && (+ <div>+ {" "}+ Group Chat+ <GroupChatFlowSpecView+ flowSpec={localAgent as IGroupChatFlowSpec}+ setFlowSpec={setLocalAgent}+ flowSpecs={flowSpecs}+ />+ </div>+ )}+ {localAgent && (+ <AgentFlowSpecView+ title=""+ flowSpec={localAgent}+ setFlowSpec={setLocalAgent}+ />+ )}+ </>+ )}++ {agent && agent.type !== "groupchat" && (+ <div>+ {" "}+ <div>+ <div className="text-sm text-secondary mt-2">+ Or replace with an existing agent{" "}+ </div>+ </div>+ <Select+ className="mt-2 w-full"+ defaultValue={selectedFlowSpec}+ value={selectedFlowSpec}+ onChange={handleAgentChange}+ options={flowSpecs.map((spec, index) => ({+ label: spec.config.name,+ value: index,+ }))}+ />+ </div>+ )}+ {/* {JSON.stringify(localAgent)} */}+ </Modal>+ );+};++export const AgentSelector = ({+ flowSpec,+ setFlowSpec,+}: {+ flowSpec: IAgentFlowSpec | null;+ setFlowSpec: (agent: IAgentFlowSpec | null) => void;+}) => {+ const [isModalVisible, setIsModalVisible] = useState(false);++ return (+ <div className=" ">+ <div+ role="button"+ onClick={() => setIsModalVisible(true)}+ className="hover:bg-secondary h-full duration-300 border border-dashed rounded p-2"+ >+ {flowSpec && (+ <div className=" ">+ {flowSpec.type === "groupchat" ? (+ <UserGroupIcon className="w-5 h-5 inline-block mr-2" />+ ) : (+ <UsersIcon className="w-5 h-5 inline-block mr-2" />+ )}+ {flowSpec.config.name}+ <div className="mt-2 text-secondary text-sm">+ {" "}+ {flowSpec.description || flowSpec.config.name}+ </div>+ <div className="mt-2 text-secondary text-sm">+ {" "}+ <span className="text-xs">+ {(flowSpec.skills && flowSpec.skills?.length) || 0} skills+ </span>+ <span className="text-xs mx-2 ">+ | max replies: {flowSpec.config.max_consecutive_auto_reply}+ </span>+ </div>+ </div>+ )}+ </div>+ {+ <>+ <AgentModal+ agent={flowSpec}+ showAgentModal={isModalVisible}+ setShowAgentModal={setIsModalVisible}+ handler={(agent: IAgentFlowSpec | null) => {+ setFlowSpec(agent);+ }}+ />+ </>+ }+ </div>+ );+};export const FlowConfigViewer = ({flowConfig,setFlowConfig,@@ -1270,25 +1692,28 @@ export const FlowConfigViewer = ({setFlowConfig: (newFlowConfig: IFlowConfig) => void;}) => {// Local state for sender and receiver FlowSpecs- const [senderFlowSpec, setSenderFlowSpec] = React.useState<IAgentFlowSpec>(- flowConfig.sender- );+ const [senderFlowSpec, setSenderFlowSpec] =+ React.useState<IAgentFlowSpec | null>(flowConfig.sender);const [localFlowConfig, setLocalFlowConfig] =React.useState<IFlowConfig>(flowConfig);const [receiverFlowSpec, setReceiverFlowSpec] =- React.useState<IAgentFlowSpec>(flowConfig.receiver);+ React.useState<IAgentFlowSpec | null>(flowConfig.receiver);// Update the local state and propagate changes to the parent component- const updateSenderFlowSpec = (newFlowSpec: IAgentFlowSpec) => {+ const updateSenderFlowSpec = (newFlowSpec: IAgentFlowSpec | null) => {setSenderFlowSpec(newFlowSpec);- setFlowConfig({ ...flowConfig, sender: newFlowSpec });+ if (newFlowSpec) {+ setFlowConfig({ ...flowConfig, sender: newFlowSpec });+ }};- const updateReceiverFlowSpec = (newFlowSpec: IAgentFlowSpec) => {+ const updateReceiverFlowSpec = (newFlowSpec: IAgentFlowSpec | null) => {setReceiverFlowSpec(newFlowSpec);- setFlowConfig({ ...flowConfig, receiver: newFlowSpec });+ if (newFlowSpec) {+ setFlowConfig({ ...flowConfig, receiver: newFlowSpec });+ }};const updateFlowConfigName = (newName: string) => {@@ -1365,19 +1790,17 @@ export const FlowConfigViewer = ({/>}/>- <div className="flex gap-3 ">- <div className="w-1/2">- <div className="">- <AgentFlowSpecView- title="Sender"- flowSpec={senderFlowSpec}- setFlowSpec={updateSenderFlowSpec}- />- </div>+ <div className="flex gap-3 mt-4">+ <div className="w-1/2 ">+ <div className="mb-2 ">Sender</div>+ <AgentSelector+ flowSpec={senderFlowSpec}+ setFlowSpec={updateSenderFlowSpec}+ /></div><div className="w-1/2">- <AgentFlowSpecView- title="Receiver"+ <div className="mb-2">Receiver</div>+ <AgentSelectorflowSpec={receiverFlowSpec}setFlowSpec={updateReceiverFlowSpec}/>diff --git a/samples/apps/autogen-studio/frontend/src/components/footer.tsx b/samples/apps/autogen-studio/frontend/src/components/footer.tsxindex 971b72563..9514470dc 100644--- a/samples/apps/autogen-studio/frontend/src/components/footer.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/footer.tsx@@ -1,14 +1,22 @@import * as React from "react";import Icon from "./icons";+import { useConfigStore } from "../hooks/store";+import { fetchVersion } from "./utils";const Footer = () => {+ const version = useConfigStore((state) => state.version);+ const setVersion = useConfigStore((state) => state.setVersion);++ React.useEffect(() => {+ if (version === null) {+ fetchVersion().then((data) => {+ setVersion(data.data.version);+ });+ }+ }, []);return (- <div className=" mt-4 text-primary p-3 border-t border-secondary ">- <div className="text-xs">- <span className="text-accent hidden inline-block mr-1 ">- {" "}- <Icon icon="app" size={8} />- </span>{" "}+ <div className=" mt-4 text-primary p-3 border-t border-secondary flex ">+ <div className="text-xs flex-1">Maintained by the AutoGen{" "}<atarget={"_blank"}@@ -20,6 +28,9 @@ const Footer = () => {Team.</a></div>+ {version && (+ <div className="text-xs ml-2 text-secondary"> v{version}</div>+ )}</div>);};diff --git a/samples/apps/autogen-studio/frontend/src/components/header.tsx b/samples/apps/autogen-studio/frontend/src/components/header.tsxindex dc9ae916f..8ec853269 100644--- a/samples/apps/autogen-studio/frontend/src/components/header.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/header.tsx@@ -95,7 +95,7 @@ const Header = ({ meta, link }: any) => {return (<divkey={index + "linkrow"}- className={`text-primary items-center hover:text-accent px-1 pt-1 block text-sm font-medium `}+ className={`text-primary items-center hover:text-accent px-1 pt-1 block text-sm font-medium `}><LinkclassName="hover:text-accent h-full flex flex-col"@@ -257,7 +257,7 @@ const Header = ({ meta, link }: any) => {as="a"href="#"onClick={() => logout()}- className="block px-4 py-2 text-base font-medium text-secondary hover:text-primary hover:bg-secondary"+ className="block px-4 py-2 text-base font-medium text-secondary hover:text-primary ">Sign out</Disclosure.Button>diff --git a/samples/apps/autogen-studio/frontend/src/components/types.ts b/samples/apps/autogen-studio/frontend/src/components/types.tsindex 4d22ddfef..91f9119b7 100644--- a/samples/apps/autogen-studio/frontend/src/components/types.ts+++ b/samples/apps/autogen-studio/frontend/src/components/types.ts@@ -52,14 +52,35 @@ export interface IAgentFlowSpec {user_id?: string;}+export interface IGroupChatConfig {+ agents: Array<IAgentFlowSpec>;+ admin_name: string;+ messages: Array<any>;+ max_round: number;+ speaker_selection_method: string;+ allow_repeat_speaker: boolean | Array<IAgentConfig>;+}++export interface IGroupChatFlowSpec {+ type: "groupchat";+ config: IAgentConfig;+ groupchat_config: IGroupChatConfig;+ id?: string;+ timestamp?: string;+ user_id?: string;+ description?: string;+}+export interface IFlowConfig {name: string;description: string;sender: IAgentFlowSpec;- receiver: IAgentFlowSpec;- type: "default" | "groupchat";+ receiver: IAgentFlowSpec | IGroupChatFlowSpec;+ type: "twoagents" | "groupchat";timestamp?: string;summary_method?: "none" | "last" | "llm";+ id?: string;+ user_id?: string;}export interface IModelConfig {@@ -68,6 +89,9 @@ export interface IModelConfig {api_version?: string;base_url?: string;api_type?: string;+ user_id?: string;+ timestamp?: string;+ description?: string;}export interface IMetadataFile {diff --git a/samples/apps/autogen-studio/frontend/src/components/utils.ts b/samples/apps/autogen-studio/frontend/src/components/utils.tsindex 73f41562c..caa475ff9 100644--- a/samples/apps/autogen-studio/frontend/src/components/utils.ts+++ b/samples/apps/autogen-studio/frontend/src/components/utils.ts@@ -2,6 +2,7 @@ import {IAgentConfig,IAgentFlowSpec,IFlowConfig,+ IGroupChatFlowSpec,ILLMConfig,IModelConfig,IStatus,@@ -222,7 +223,7 @@ export const formatDuration = (seconds: number) => {return parts.length > 0 ? parts.join(" ") : "0 sec";};-export const sampleWorkflowConfig = () => {+export const sampleWorkflowConfig = (type = "twoagents") => {const llm_model_config: IModelConfig[] = [{model: "gpt-4-1106-preview",@@ -271,9 +272,41 @@ export const sampleWorkflowConfig = () => {description: "Default Agent Workflow",sender: userProxyFlowSpec,receiver: assistantFlowSpec,- type: "default",+ type: "twoagents",};+ const groupChatAssistantConfig = Object.assign({}, assistantConfig);+ groupChatAssistantConfig.name = "groupchat_assistant";+ groupChatAssistantConfig.system_message =+ "You are a helpful assistant skilled at cordinating a group of other assistants to solve a task. ";++ const groupChatFlowSpec: IGroupChatFlowSpec = {+ type: "groupchat",+ config: groupChatAssistantConfig,+ groupchat_config: {+ agents: [assistantFlowSpec, assistantFlowSpec],+ admin_name: "groupchat_assistant",+ messages: [],+ max_round: 10,+ speaker_selection_method: "auto",+ allow_repeat_speaker: false,+ },+ description: "Default Group Workflow",+ };++ const groupChatWorkFlowConfig: IFlowConfig = {+ name: "Default Group Workflow",+ description: "Default Group Workflow",+ sender: userProxyFlowSpec,+ receiver: groupChatFlowSpec,+ type: "groupchat",+ };++ if (type === "twoagents") {+ return workFlowConfig;+ } else if (type === "groupchat") {+ return groupChatWorkFlowConfig;+ }return workFlowConfig;};@@ -383,7 +416,7 @@ export const examplePrompts = [{title: "Stock Price",prompt:- "Plot a chart of NVDA and TESLA stock price YTD. Save the result to a file named nvda_tesla.png",+ "Plot a chart of NVDA and TESLA stock price for 2023. Save the result to a file named nvda_tesla.png",},{title: "Sine Wave",@@ -401,3 +434,16 @@ export const examplePrompts = ["paint a picture of a glass of ethiopian coffee, freshly brewed in a tall glass cup, on a table right in front of a lush green forest scenery",},];++export const fetchVersion = () => {+ const versionUrl = getServerUrl() + "/version";+ return fetch(versionUrl)+ .then((response) => response.json())+ .then((data) => {+ return data;+ })+ .catch((error) => {+ console.error("Error:", error);+ return null;+ });+};diff --git a/samples/apps/autogen-studio/frontend/src/components/views/builder/agents.tsx b/samples/apps/autogen-studio/frontend/src/components/views/builder/agents.tsxindex 87d005f51..8ee6a7a97 100644--- a/samples/apps/autogen-studio/frontend/src/components/views/builder/agents.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/views/builder/agents.tsx@@ -10,8 +10,10 @@ import { appContext } from "../../../hooks/provider";import { fetchJSON, getServerUrl, timeAgo, truncateText } from "../../utils";import {AgentFlowSpecView,+ BounceLoader,Card,LaunchButton,+ LoadBox,LoadingOverlay,} from "../../atoms";@@ -94,10 +96,9 @@ const AgentsView = ({}: any) => {fetchJSON(deleteAgentUrl, payLoad, onSuccess, onError);};- const fetchAgent = () => {+ const fetchAgents = () => {setError(null);setLoading(true);- // const fetch;const payLoad = {method: "GET",headers: {@@ -107,8 +108,8 @@ const AgentsView = ({}: any) => {const onSuccess = (data: any) => {if (data && data.status) {- message.success(data.message);- console.log("agents", data.data);+ // message.success(data.message);+setAgents(data.data);} else {message.error(data.message);@@ -127,6 +128,7 @@ const AgentsView = ({}: any) => {setError(null);setLoading(true);// const fetch;+const payLoad = {method: "POST",headers: {@@ -161,35 +163,25 @@ const AgentsView = ({}: any) => {React.useEffect(() => {if (user) {// console.log("fetching messages", messages);- fetchAgent();+ fetchAgents();}}, []);- React.useEffect(() => {- if (selectedAgent) {- console.log("selected agent", selectedAgent);- }- }, [selectedAgent]);-- React.useEffect(() => {- if (newAgent) {- console.log("new agent", newAgent);- }- }, [newAgent]);-const agentRows = (agents || []).map((agent: IAgentFlowSpec, i: number) => {return (<div key={"agentrow" + i} className=" " style={{ width: "200px" }}>- <div className="h-full">+ <div className=""><CardclassName="h-full p-2 cursor-pointer"- title={agent.config.name}+ title={+ <div className=" ">{truncateText(agent.config.name, 25)}</div>+ }onClick={() => {setSelectedAgent(agent);setShowAgentModal(true);}}>- <div className="my-2">+ <div style={{ minHeight: "65px" }} className="my-2 break-words">{" "}{truncateText(agent.description || "", 70)}</div>@@ -266,7 +258,7 @@ const AgentsView = ({}: any) => {};return (- <div className=" ">+ <div className="text-primary "><AgentModalagent={selectedAgent}setAgent={setSelectedAgent}@@ -322,12 +314,20 @@ const AgentsView = ({}: any) => {</div>)}- {agents && agents.length === 0 && (+ {agents && agents.length === 0 && !loading && (<div className="text-sm border mt-4 rounded text-secondary p-2"><InformationCircleIcon className="h-4 w-4 inline mr-1" />No agents found. Please create a new agent.</div>)}++ {loading && (+ <div className=" w-full text-center">+ {" "}+ <BounceLoader />{" "}+ <span className="inline-block"> loading .. </span>+ </div>+ )}</div></div></div>diff --git a/samples/apps/autogen-studio/frontend/src/components/views/builder/build.tsx b/samples/apps/autogen-studio/frontend/src/components/views/builder/build.tsxindex bea90d3c2..c7569ca05 100644--- a/samples/apps/autogen-studio/frontend/src/components/views/builder/build.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/views/builder/build.tsx@@ -5,9 +5,11 @@ import WorkflowView from "./workflow";import { Tabs } from "antd";import {BugAntIcon,+ CpuChipIcon,Square2StackIcon,Square3Stack3DIcon,} from "@heroicons/react/24/outline";+import ModelsView from "./models";const BuildView = () => {return (@@ -18,11 +20,11 @@ const BuildView = () => {Create skills, agents and workflows for building multiagent capabilities{" "}</div>- <div className="mb-4">+ <div className="mb-4 text-primary">{" "}<TabstabBarStyle={{ paddingLeft: 0, marginLeft: 0 }}- defaultActiveKey="3"+ defaultActiveKey="4"tabPosition="left"items={[{@@ -36,6 +38,17 @@ const BuildView = () => {key: "1",children: <SkillsView />,},+ {+ label: (+ <div className="w-full ">+ {" "}+ <CpuChipIcon className="h-4 w-4 inline-block mr-1" />+ Models+ </div>+ ),+ key: "2",+ children: <ModelsView />,+ },{label: (<>@@ -43,7 +56,7 @@ const BuildView = () => {Agents</>),- key: "2",+ key: "3",children: <AgentsView />,},{@@ -53,7 +66,7 @@ const BuildView = () => {Workflows</>),- key: "3",+ key: "4",children: <WorkflowView />,},]}diff --git a/samples/apps/autogen-studio/frontend/src/components/views/builder/models.tsx b/samples/apps/autogen-studio/frontend/src/components/views/builder/models.tsxnew file mode 100644index 000000000..8344c54ec--- /dev/null+++ b/samples/apps/autogen-studio/frontend/src/components/views/builder/models.tsx@@ -0,0 +1,380 @@+import {+ InformationCircleIcon,+ PlusIcon,+ TrashIcon,+} from "@heroicons/react/24/outline";+import { Input, Modal, message } from "antd";+import * as React from "react";+import { IAgentFlowSpec, IModelConfig, IStatus } from "../../types";+import { appContext } from "../../../hooks/provider";+import { fetchJSON, getServerUrl, timeAgo, truncateText } from "../../utils";+import {+ AgentFlowSpecView,+ BounceLoader,+ Card,+ LaunchButton,+ LoadBox,+ LoadingOverlay,+} from "../../atoms";+import TextArea from "antd/es/input/TextArea";++const ModelsView = ({}: any) => {+ const [loading, setLoading] = React.useState(false);+ const [error, setError] = React.useState<IStatus | null>({+ status: true,+ message: "All good",+ });++ const { user } = React.useContext(appContext);+ const serverUrl = getServerUrl();+ const listModelsUrl = `${serverUrl}/models?user_id=${user?.email}`;+ const saveModelsUrl = `${serverUrl}/models`;+ const deleteModelUrl = `${serverUrl}/models/delete`;++ const defaultModel: IModelConfig = {+ model: "gpt-4-1106-preview",+ description: "Sample model",+ user_id: user?.email,+ };++ const [models, setModels] = React.useState<IModelConfig[] | null>([]);+ const [selectedModel, setSelectedModel] = React.useState<IModelConfig | null>(+ null+ );+ const [newModel, setNewModel] = React.useState<IModelConfig | null>(+ defaultModel+ );++ const [showNewModelModal, setShowNewModelModal] = React.useState(false);++ const [showModelModal, setShowModelModal] = React.useState(false);++ const deleteModel = (model: IModelConfig) => {+ setError(null);+ setLoading(true);+ // const fetch;+ const payLoad = {+ method: "DELETE",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ user_id: user?.email,+ model: model,+ }),+ };++ const onSuccess = (data: any) => {+ if (data && data.status) {+ message.success(data.message);+ setModels(data.data);+ } else {+ message.error(data.message);+ }+ setLoading(false);+ };+ const onError = (err: any) => {+ setError(err);+ message.error(err.message);+ setLoading(false);+ };+ fetchJSON(deleteModelUrl, payLoad, onSuccess, onError);+ };++ const fetchModels = () => {+ setError(null);+ setLoading(true);+ const payLoad = {+ method: "GET",+ headers: {+ "Content-Type": "application/json",+ },+ };++ const onSuccess = (data: any) => {+ if (data && data.status) {+ setModels(data.data);+ } else {+ message.error(data.message);+ }+ setLoading(false);+ };+ const onError = (err: any) => {+ setError(err);+ message.error(err.message);+ setLoading(false);+ };+ fetchJSON(listModelsUrl, payLoad, onSuccess, onError);+ };++ const saveModel = (model: IModelConfig) => {+ setError(null);+ setLoading(true);++ const payLoad = {+ method: "POST",+ headers: {+ Accept: "application/json",+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ user_id: user?.email,+ model: model,+ }),+ };++ const onSuccess = (data: any) => {+ if (data && data.status) {+ message.success(data.message);+ // console.log("models", data.data);+ setModels(data.data);+ } else {+ message.error(data.message);+ }+ setLoading(false);+ };+ const onError = (err: any) => {+ setError(err);+ message.error(err.message);+ setLoading(false);+ };+ fetchJSON(saveModelsUrl, payLoad, onSuccess, onError);+ };++ React.useEffect(() => {+ if (user) {+ // console.log("fetching messages", messages);+ fetchModels();+ }+ }, []);++ React.useEffect(() => {+ if (selectedModel) {+ console.log("selected agent", selectedModel);+ }+ }, [selectedModel]);++ const modelRows = (models || []).map((model: IModelConfig, i: number) => {+ return (+ <div key={"modelrow" + i} className=" " style={{ width: "200px" }}>+ <div className="">+ <Card+ className="h-full p-2 cursor-pointer"+ title={+ <div className=" ">{truncateText(model.model || "", 25)}</div>+ }+ onClick={() => {+ setSelectedModel(model);+ setShowModelModal(true);+ }}+ >+ <div style={{ minHeight: "65px" }} className="my-2 break-words">+ {" "}+ {truncateText(model.description || model.model || "", 70)}+ </div>+ <div className="text-xs">{timeAgo(model.timestamp || "")}</div>+ </Card>+ <div className="text-right mt-2">+ <div+ role="button"+ className="text-accent text-xs inline-block"+ onClick={() => {+ deleteModel(model);+ }}+ >+ <TrashIcon className=" w-5, h-5 cursor-pointer inline-block" />+ <span className="text-xs"> delete</span>+ </div>+ </div>+ </div>+ </div>+ );+ });++ const ModelModal = ({+ model,+ setModel,+ showModelModal,+ setShowModelModal,+ handler,+ }: {+ model: IModelConfig | null;+ setModel: (model: IModelConfig | null) => void;+ showModelModal: boolean;+ setShowModelModal: (show: boolean) => void;+ handler?: (agent: IModelConfig) => void;+ }) => {+ const [localModel, setLocalModel] = React.useState<IModelConfig | null>(+ model+ );++ return (+ <Modal+ title={+ <>+ Model Specification{" "}+ <span className="text-accent font-normal">{model?.model}</span>{" "}+ </>+ }+ width={800}+ open={showModelModal}+ onOk={() => {+ setModel(null);+ setShowModelModal(false);+ if (handler) {+ if (localModel) {+ handler(localModel);+ }+ }+ }}+ onCancel={() => {+ setModel(null);+ setShowModelModal(false);+ }}+ >+ <div className="text-sm my-2">Enter parameters for your model.</div>+ <Input+ placeholder="Model Name"+ value={localModel?.model}+ onChange={(e) => {+ setLocalModel({ ...localModel, model: e.target.value });+ }}+ />+ <Input.Password+ className="mt-2"+ placeholder="API Key"+ value={localModel?.api_key}+ onChange={(e) => {+ if (localModel) {+ setLocalModel({ ...localModel, api_key: e.target.value });+ }+ }}+ />+ <Input+ className="mt-2"+ placeholder="Base URL"+ value={localModel?.base_url}+ onChange={(e) => {+ if (localModel) {+ setLocalModel({ ...localModel, base_url: e.target.value });+ }+ }}+ />+ <Input+ className="mt-2"+ placeholder="API Type (e.g. azure)"+ value={localModel?.api_type}+ onChange={(e) => {+ if (localModel) {+ setLocalModel({ ...localModel, api_type: e.target.value });+ }+ }}+ />+ <Input+ className="mt-2"+ placeholder="API Version (optional)"+ value={localModel?.api_version}+ onChange={(e) => {+ if (localModel) {+ setLocalModel({ ...localModel, api_version: e.target.value });+ }+ }}+ />+ <TextArea+ className="mt-2"+ placeholder="Description"+ value={localModel?.description}+ onChange={(e) => {+ if (localModel) {+ setLocalModel({ ...localModel, description: e.target.value });+ }+ }}+ />++ {localModel?.api_type === "azure" && (+ <div className="mt-4 text-xs">+ Note: For Azure OAI models, you will need to specify all fields.+ </div>+ )}+ </Modal>+ );+ };++ return (+ <div className="text-primary ">+ <ModelModal+ model={selectedModel}+ setModel={setSelectedModel}+ setShowModelModal={setShowModelModal}+ showModelModal={showModelModal}+ handler={(model: IModelConfig | null) => {+ if (model) {+ saveModel(model);+ }+ }}+ />++ <ModelModal+ model={defaultModel}+ setModel={setNewModel}+ setShowModelModal={setShowNewModelModal}+ showModelModal={showNewModelModal}+ handler={(model: IModelConfig | null) => {+ if (model) {+ saveModel(model);+ }+ }}+ />++ <div className="mb-2 relative">+ <div className=" rounded ">+ <div className="flex mt-2 pb-2 mb-2 border-b">+ <div className="flex-1 font-semibold mb-2 ">+ {" "}+ Models ({modelRows.length}){" "}+ </div>+ <LaunchButton+ className="text-sm p-2 px-3"+ onClick={() => {+ setShowNewModelModal(true);+ }}+ >+ {" "}+ <PlusIcon className="w-5 h-5 inline-block mr-1" />+ New Model+ </LaunchButton>+ </div>++ <div className="text-xs mb-2 pb-1 ">+ {" "}+ Create model configurations that can be reused in your agents and+ workflows. {selectedModel?.model}+ </div>+ {models && models.length > 0 && (+ <div className="w-full relative">+ <LoadingOverlay loading={loading} />+ <div className=" flex flex-wrap gap-3">{modelRows}</div>+ </div>+ )}++ {models && models.length === 0 && !loading && (+ <div className="text-sm border mt-4 rounded text-secondary p-2">+ <InformationCircleIcon className="h-4 w-4 inline mr-1" />+ No models found. Please create a new agent.+ </div>+ )}++ {loading && (+ <div className=" w-full text-center">+ {" "}+ <BounceLoader />{" "}+ <span className="inline-block"> loading .. </span>+ </div>+ )}+ </div>+ </div>+ </div>+ );+};++export default ModelsView;diff --git a/samples/apps/autogen-studio/frontend/src/components/views/builder/skills.tsx b/samples/apps/autogen-studio/frontend/src/components/views/builder/skills.tsxindex df8d3aa51..6117d9055 100644--- a/samples/apps/autogen-studio/frontend/src/components/views/builder/skills.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/views/builder/skills.tsx@@ -14,7 +14,13 @@ import {timeAgo,truncateText,} from "../../utils";-import { Card, CodeBlock, LaunchButton, LoadingOverlay } from "../../atoms";+import {+ BounceLoader,+ Card,+ CodeBlock,+ LaunchButton,+ LoadingOverlay,+} from "../../atoms";import { useConfigStore } from "../../../hooks/store";import TextArea from "antd/es/input/TextArea";@@ -87,7 +93,7 @@ const SkillsView = ({}: any) => {const onSuccess = (data: any) => {if (data && data.status) {- message.success(data.message);+ // message.success(data.message);// console.log("skills", data.data);setSkills(data.data);} else {@@ -162,28 +168,33 @@ const SkillsView = ({}: any) => {const skillRows = (skills || []).map((skill: ISkill, i: number) => {return (<div key={"skillrow" + i} className=" " style={{ width: "200px" }}>- <Card- className="h-full p-2 cursor-pointer"- title={skill.title}- onClick={() => {- setSelectedSkill(skill);- setShowSkillModal(true);- }}- >- <div className="my-2"> {truncateText(skill.content, 70)}</div>- <div className="text-xs">{timeAgo(skill.timestamp || "")}</div>- </Card>-- <div className="text-right mt-2">- <div- role="button"- className="text-accent text-xs inline-block"+ <div>+ {" "}+ <Card+ className="h-full p-2 cursor-pointer"+ title={truncateText(skill.title, 25)}onClick={() => {- deleteSkill(skill);+ setSelectedSkill(skill);+ setShowSkillModal(true);}}>- <TrashIcon className=" w-5, h-5 cursor-pointer inline-block" />- <span className="text-xs"> delete</span>+ <div style={{ minHeight: "65px" }} className="my-2 break-words">+ {" "}+ {truncateText(skill.content, 70)}+ </div>+ <div className="text-xs">{timeAgo(skill.timestamp || "")}</div>+ </Card>+ <div className="text-right mt-2">+ <div+ role="button"+ className="text-accent text-xs inline-block"+ onClick={() => {+ deleteSkill(skill);+ }}+ >+ <TrashIcon className=" w-5, h-5 cursor-pointer inline-block" />+ <span className="text-xs"> delete</span>+ </div></div></div></div>@@ -191,7 +202,7 @@ const SkillsView = ({}: any) => {});return (- <div className=" ">+ <div className=" text-primary "><Modaltitle={selectedSkill?.name}width={800}@@ -205,7 +216,7 @@ const SkillsView = ({}: any) => {>{selectedSkill && (<div>- <div className="mb-2">{selectedSkill.file_name}</div>+ <div className="mb-2">{selectedSkill.title}</div><CodeBlock code={selectedSkill?.content} language="python" /></div>@@ -281,12 +292,19 @@ const SkillsView = ({}: any) => {</div>)}- {skills && skills.length === 0 && (+ {skills && skills.length === 0 && !loading && (<div className="text-sm border mt-4 rounded text-secondary p-2"><InformationCircleIcon className="h-4 w-4 inline mr-1" />No skills found. Please create a new skill.</div>)}+ {loading && (+ <div className=" w-full text-center">+ {" "}+ <BounceLoader />{" "}+ <span className="inline-block"> loading .. </span>+ </div>+ )}</div></div></div>diff --git a/samples/apps/autogen-studio/frontend/src/components/views/builder/workflow.tsx b/samples/apps/autogen-studio/frontend/src/components/views/builder/workflow.tsxindex 52eda8d55..3282d02b8 100644--- a/samples/apps/autogen-studio/frontend/src/components/views/builder/workflow.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/views/builder/workflow.tsx@@ -2,8 +2,10 @@ import {InformationCircleIcon,PlusIcon,TrashIcon,+ UserGroupIcon,+ UsersIcon,} from "@heroicons/react/24/outline";-import { Button, Modal, message } from "antd";+import { Button, Dropdown, MenuProps, Modal, message } from "antd";import * as React from "react";import { IFlowConfig, IStatus } from "../../types";import { appContext } from "../../../hooks/provider";@@ -15,6 +17,7 @@ import {truncateText,} from "../../utils";import {+ BounceLoader,Card,FlowConfigViewer,LaunchButton,@@ -38,7 +41,9 @@ const WorkflowView = ({}: any) => {React.useState<IFlowConfig | null>(null);const defaultConfig = sampleWorkflowConfig();- const [newWorkflow] = React.useState<IFlowConfig | null>(defaultConfig);+ const [newWorkflow, setNewWorkflow] = React.useState<IFlowConfig | null>(+ defaultConfig+ );const [showWorkflowModal, setShowWorkflowModal] = React.useState(false);const [showNewWorkflowModal, setShowNewWorkflowModal] = React.useState(false);@@ -56,8 +61,8 @@ const WorkflowView = ({}: any) => {const onSuccess = (data: any) => {if (data && data.status) {- message.success(data.message);- console.log("workflows", data.data);+ // message.success(data.message);+setWorkflows(data.data);} else {message.error(data.message);@@ -154,17 +159,26 @@ const WorkflowView = ({}: any) => {const workflowRows = (workflows || []).map((workflow: IFlowConfig, i: number) => {return (- <div key={"workflowrow" + i} className=" " style={{ width: "200px" }}>- <div className="h-full ">+ <div+ key={"workflowrow" + i}+ className="block h-full"+ style={{ width: "200px" }}+ >+ <div className=" block">{" "}<Card- className="h-full block p-2 cursor-pointer"- title={workflow.name}+ className=" block p-2 cursor-pointer"+ title={+ <div className=" ">{truncateText(workflow.name, 25)}</div>+ }onClick={() => {setSelectedWorkflow(workflow);}}>- <div className="my-2"> {truncateText(workflow.name, 70)}</div>+ <div style={{ minHeight: "65px" }} className="break-words my-2">+ {" "}+ {truncateText(workflow.name, 70)}+ </div><div className="text-xs">{timeAgo(workflow.timestamp || "")}</div></Card><div className="text-right mt-2">@@ -234,8 +248,37 @@ const WorkflowView = ({}: any) => {);};+ const workflowTypes: MenuProps["items"] = [+ {+ key: "twoagents",+ label: (+ <div>+ {" "}+ <UsersIcon className="w-5 h-5 inline-block mr-2" />+ Two Agents+ </div>+ ),+ },+ {+ key: "groupchat",+ label: (+ <div>+ <UserGroupIcon className="w-5 h-5 inline-block mr-2" />+ Group Chat+ </div>+ ),+ },+ ];++ const workflowTypesOnClick: MenuProps["onClick"] = ({ key }) => {+ const newConfig = sampleWorkflowConfig(key);++ setNewWorkflow(newConfig);+ setShowNewWorkflowModal(true);+ };+return (- <div className=" ">+ <div className=" text-primary "><WorkflowModalworkflow={selectedWorkflow}setWorkflow={setSelectedWorkflow}@@ -260,22 +303,32 @@ const WorkflowView = ({}: any) => {<div className="mb-2 relative"><div className=" rounded "><div className="flex mt-2 pb-2 mb-2 border-b">- <div className="flex-1 font-semibold mb-2 ">+ <div className="flex-1 font-semibold mb-2 ">{" "}Workflows ({workflowRows.length}){" "}</div>- <LaunchButton- className="-mt-2 text-sm p-2 px-3"- onClick={() => {- setShowNewWorkflowModal(true);- }}- >- {" "}- <PlusIcon className="w-5 h-5 inline-block mr-1" />- New Workflow- </LaunchButton>+ <div className=" ">+ <Dropdown+ menu={{ items: workflowTypes, onClick: workflowTypesOnClick }}+ placement="bottomRight"+ trigger={["click"]}+ >+ <div+ className="inline-flex rounded hover:border-accent duration-300 hover:text-accent"+ role="button"+ onClick={(e) => {+ // add agent to flowSpec?.groupchat_config.agents+ }}+ >+ <LaunchButton className=" text-sm p-2 px-3">+ {" "}+ <PlusIcon className="w-5 h-5 inline-block mr-1" />+ New Workflow+ </LaunchButton>+ </div>+ </Dropdown>+ </div></div>-<div className="text-xs mb-2 pb-1 ">{" "}Configure an agent workflow that can be used to handle tasks.@@ -289,13 +342,19 @@ const WorkflowView = ({}: any) => {<div className="flex flex-wrap gap-3">{workflowRows}</div></div>)}-- {workflows && workflows.length === 0 && (+ {workflows && workflows.length === 0 && !loading && (<div className="text-sm border mt-4 rounded text-secondary p-2"><InformationCircleIcon className="h-4 w-4 inline mr-1" />No workflows found. Please create a new workflow.</div>)}+ {loading && (+ <div className=" w-full text-center">+ {" "}+ <BounceLoader />{" "}+ <span className="inline-block"> loading .. </span>+ </div>+ )}</div></div></div>diff --git a/samples/apps/autogen-studio/frontend/src/components/views/gallery/gallery.tsx b/samples/apps/autogen-studio/frontend/src/components/views/gallery/gallery.tsxindex 5e5bd4483..53f1be444 100644--- a/samples/apps/autogen-studio/frontend/src/components/views/gallery/gallery.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/views/gallery/gallery.tsx@@ -58,9 +58,8 @@ const GalleryView = ({ location }: any) => {};const onSuccess = (data: any) => {- console.log(data);if (data && data.status) {- message.success(data.message);+ // message.success(data.message);console.log("gallery", data);if (galleryId) {// Set the currently viewed gallery item@@ -121,11 +120,11 @@ const GalleryView = ({ location }: any) => {navigate(`/gallery?id=${item.id}`);}}className="h-full p-2 cursor-pointer"- title={truncateText(item.messages[0].content, 20)}+ title={truncateText(item.messages[0]?.content || "", 20)}><div className="my-2">{" "}- {truncateText(item.messages[0].content, 80)}+ {truncateText(item.messages[0]?.content || "", 80)}</div><div className="text-xs">{" "}diff --git a/samples/apps/autogen-studio/frontend/src/components/views/playground/chatbox.tsx b/samples/apps/autogen-studio/frontend/src/components/views/playground/chatbox.tsxindex fb100c549..2164a57e8 100644--- a/samples/apps/autogen-studio/frontend/src/components/views/playground/chatbox.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/views/playground/chatbox.tsx@@ -79,44 +79,6 @@ const ChatBox = ({setMessages(initMsgs);}, [initMessages]);- const deleteMessage = (messageId: string) => {- setError(null);- setLoading(true);- // const fetch;- const payLoad = {- method: "POST",- headers: {- "Content-Type": "application/json",- },- body: JSON.stringify({- user_id: user?.email,- msg_id: messageId,- session_id: session?.id,- }),- };-- const onSuccess = (data: any) => {- console.log(data);- if (data && data.status) {- message.success(data.message);- setMessages(parseMessages(data.data));-- console.log("updated profile", data);- } else {- message.error(data.message);- }- setLoading(false);- };-- const onError = (err: any) => {- setError(err);-- message.error(err.message);- setLoading(false);- };- fetchJSON(deleteMsgUrl, payLoad, onSuccess, onError);- };-const promptButtons = examplePrompts.map((prompt, i) => {return (<Button@@ -220,17 +182,19 @@ const ChatBox = ({</span>)} */}</div>- <div className="font-semibold text-secondary text-sm w-14">{`${- isUser ? "USER" : "AGENT"+ <div className="font-semibold text-secondary text-sm w-16">{`${+ isUser ? "USER" : "AGENTS"}`}</div><div// style={{ minWidth: "70%" }}- className={`inline-block relative ${+ className={`inline-block group relative ${isUser ? "" : " w-full "} p-2 rounded ${css}`}>{" "}- {items.length > 0 && editable && <div className=" ">{menu}</div>}+ {items.length > 0 && editable && (+ <div className=" group-hover:opacity-100 opacity-0 ">{menu}</div>+ )}{isUser && (<><div className="inline-block">{message.text}</div>@@ -342,7 +306,6 @@ const ChatBox = ({if (res.status === 200) {res.json().then((data) => {if (data && data.status) {- console.log("******* response received ", data);const botMesage: IChatMessage = {text: data.message,sender: "bot",@@ -396,6 +359,13 @@ const ChatBox = ({return (<div className="text-primary relative h-full rounded ">+ <div+ style={{ zIndex: 100 }}+ className=" absolute right-0 text-secondary -top-8 rounded p-2"+ >+ {" "}+ <div className="text-xs"> {session?.flow_config.name}</div>+ </div><divref={messageBoxInputRef}className="flex h-full flex-col rounded scroll pr-2 overflow-auto "diff --git a/samples/apps/autogen-studio/frontend/src/components/views/playground/ra.tsx b/samples/apps/autogen-studio/frontend/src/components/views/playground/ra.tsxindex 2d50a2ab1..c17f8899d 100644--- a/samples/apps/autogen-studio/frontend/src/components/views/playground/ra.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/views/playground/ra.tsx@@ -6,6 +6,10 @@ import { appContext } from "../../../hooks/provider";import { message } from "antd";import SideBarView from "./sidebar";import { useConfigStore } from "../../../hooks/store";+import SessionsView from "./sessions";+import AgentsWorkflowView from "./workflows";+import { Square3Stack3DIcon } from "@heroicons/react/24/outline";+import Icon from "../../icons";const RAView = () => {const session: IChatSession | null = useConfigStore((state) => state.session);@@ -32,6 +36,7 @@ const RAView = () => {const { user } = React.useContext(appContext);const serverUrl = getServerUrl();const fetchMessagesUrl = `${serverUrl}/messages?user_id=${user?.email}&session_id=${session?.id}`;+ const workflowConfig = useConfigStore((state) => state.workflowConfig);const fetchMessages = () => {setError(null);@@ -49,7 +54,7 @@ const RAView = () => {// console.log(data);if (data && data.status) {setMessages(data.data);- message.success(data.message);+ // message.success(data.message);} else {message.error(data.message);}@@ -77,8 +82,26 @@ const RAView = () => {<SideBarView /></div><div className=" flex-1 ">- {" "}- <ChatBox initMessages={messages} />+ {!session && (+ <div className=" w-full h-full flex items-center justify-center">+ {/* {JSON.stringify(workflowConfig)} */}+ <div className="w-2/3" id="middle">+ <div className="w-full text-center">+ {" "}+ <img+ src="/images/svgs/welcome.svg"+ alt="welcome"+ className="text-accent inline-block object-cover w-56"+ />+ </div>+ <SessionsView />+ </div>+ </div>+ )}++ {workflowConfig !== null && session !== null && (+ <ChatBox initMessages={messages} />+ )}</div></div></div>diff --git a/samples/apps/autogen-studio/frontend/src/components/views/playground/sessions.tsx b/samples/apps/autogen-studio/frontend/src/components/views/playground/sessions.tsxindex b200cbd80..c30d58b19 100644--- a/samples/apps/autogen-studio/frontend/src/components/views/playground/sessions.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/views/playground/sessions.tsx@@ -4,13 +4,14 @@ import {Square3Stack3DIcon,TrashIcon,} from "@heroicons/react/24/outline";-import { message } from "antd";+import { Button, Modal, message } from "antd";import * as React from "react";import { IChatSession, IStatus } from "../../types";import { appContext } from "../../../hooks/provider";import { fetchJSON, getServerUrl, timeAgo, truncateText } from "../../utils";import { LaunchButton, LoadingOverlay } from "../../atoms";import { useConfigStore } from "../../../hooks/store";+import AgentsWorkflowView from "./workflows";const SessionsView = ({}: any) => {const [loading, setLoading] = React.useState(false);@@ -33,7 +34,7 @@ const SessionsView = ({}: any) => {// React.useState<IChatSession | null>(null);const session = useConfigStore((state) => state.session);const setSession = useConfigStore((state) => state.setSession);-+ const setWorkflowConfig = useConfigStore((state) => state.setWorkflowConfig);const deleteSession = (session: IChatSession) => {setError(null);setLoading(true);@@ -53,6 +54,9 @@ const SessionsView = ({}: any) => {if (data && data.status) {message.success(data.message);setSessions(data.data);+ if (data.data && data.data.length > 0) {+ setSession(data.data[0]);+ }} else {message.error(data.message);}@@ -66,6 +70,9 @@ const SessionsView = ({}: any) => {fetchJSON(deleteSessionUrl, payLoad, onSuccess, onError);};+ const [newSessionModalVisible, setNewSessionModalVisible] =+ React.useState(false);+const fetchSessions = () => {setError(null);setLoading(true);@@ -79,12 +86,9 @@ const SessionsView = ({}: any) => {const onSuccess = (data: any) => {if (data && data.status) {- message.success(data.message);+ // message.success(data.message);// console.log("sessions", data);setSessions(data.data);- if (data.data && data.data.length === 0) {- createSession();- }} else {message.error(data.message);}@@ -135,7 +139,11 @@ const SessionsView = ({}: any) => {React.useEffect(() => {if (sessions && sessions.length > 0) {- setSession(sessions[0]);+ const firstSession = sessions[0];+ setSession(firstSession);+ setWorkflowConfig(firstSession?.flow_config);+ } else {+ setSession(null);}}, [sessions]);@@ -145,14 +153,11 @@ const SessionsView = ({}: any) => {const body = {user_id: user?.email,- session:- session === null- ? {- user_id: user?.email,- flow_config: workflowConfig,- session_id: null,- }- : session,+ session: {+ user_id: user?.email,+ flow_config: workflowConfig,+ session_id: null,+ },};// const fetch;const payLoad = {@@ -163,10 +168,13 @@ const SessionsView = ({}: any) => {body: JSON.stringify(body),};+ console.log("createSession", payLoad);+const onSuccess = (data: any) => {if (data && data.status) {message.success(data.message);setSessions(data.data);+ setWorkflowConfig(data.data[0]?.workflow_config);} else {message.error(data.message);}@@ -202,9 +210,11 @@ const SessionsView = ({}: any) => {role="button"onClick={() => {setSession(data);+ setWorkflowConfig(data.flow_config);}}><div className="text-xs">{truncateText(data.id, 27)}</div>+ <div className="text-xs">{data.flow_config.name}</div><div className="text-xs text-right ">{timeAgo(data.timestamp)} </div></div><div className="flex mt-2 text-secondary">@@ -244,16 +254,50 @@ const SessionsView = ({}: any) => {return (<div className=" ">+ <Modal+ title={+ <div className="font-semibold mb-2 pb-1 border-b">+ <Square3Stack3DIcon className="h-5 w-5 inline-block mr-1" />+ New Sessions{" "}+ </div>+ }+ open={newSessionModalVisible}+ footer={[+ <Button+ key="back"+ onClick={() => {+ setNewSessionModalVisible(false);+ }}+ >+ Cancel+ </Button>,+ <Button+ key="submit"+ type="primary"+ disabled={!workflowConfig}+ onClick={() => {+ setNewSessionModalVisible(false);+ createSession();+ }}+ >+ Create+ </Button>,+ ]}+ >+ <AgentsWorkflowView />+ </Modal><div className="mb-2 relative"><div className=""><div className="font-semibold mb-2 pb-1 border-b"><Square3Stack3DIcon className="h-5 w-5 inline-block mr-1" />Sessions{" "}</div>- <div className="text-xs mb-2 pb-1 ">- {" "}- Create a new session or select an existing session to view chat.- </div>+ {sessions && sessions.length > 0 && (+ <div className="text-xs mb-2 pb-1 ">+ {" "}+ Create a new session or select an existing session to view chat.+ </div>+ )}<divstyle={{maxHeight: "300px",@@ -263,7 +307,7 @@ const SessionsView = ({}: any) => {<LoadingOverlay loading={loading} />{sessionRows}</div>- {(!sessions || sessions.length == 0) && (+ {(!sessions || sessions.length == 0) && !loading && (<div className="text-xs text-gray-500">No sessions found. Create a new session to get started.</div>@@ -274,7 +318,12 @@ const SessionsView = ({}: any) => {<LaunchButtonclassName="text-sm p-2 px-3"onClick={() => {- createSession();+ if (sessions && sessions.length > 0) {+ setWorkflowConfig(sessions[0]?.flow_config);+ } else {+ setWorkflowConfig(null);+ }+ setNewSessionModalVisible(true);}}>{" "}diff --git a/samples/apps/autogen-studio/frontend/src/components/views/playground/sidebar.tsx b/samples/apps/autogen-studio/frontend/src/components/views/playground/sidebar.tsxindex 3d7a84856..3dd875cc5 100644--- a/samples/apps/autogen-studio/frontend/src/components/views/playground/sidebar.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/views/playground/sidebar.tsx@@ -27,8 +27,8 @@ const SideBarView = () => {><div className=" transition overflow-hidden duration-300 flex flex-col h-full p-2 overflow-y-scroll scroll rounded "><div className={`${isOpen ? "" : "hidden"} `}>- <AgentsView />- {workflowConfig && <SessionsView />}+ {/* <AgentsView /> */}+ {<SessionsView />}</div></div><divdiff --git a/samples/apps/autogen-studio/frontend/src/components/views/playground/workflows.tsx b/samples/apps/autogen-studio/frontend/src/components/views/playground/workflows.tsxindex 000e4d1c6..fff3a3852 100644--- a/samples/apps/autogen-studio/frontend/src/components/views/playground/workflows.tsx+++ b/samples/apps/autogen-studio/frontend/src/components/views/playground/workflows.tsx@@ -41,7 +41,7 @@ const AgentsWorkflowView = () => {const onSuccess = (data: any) => {if (data && data.status) {- message.success(data.message);+ // message.success(data.message);setWorkflowConfigs(data.data);if (data.data.length > 0) {@@ -69,13 +69,13 @@ const AgentsWorkflowView = () => {return (<div className=" mb-4 relative">- <div className="font-semibold pb-2 border-b">+ {/* <div className="font-semibold pb-2 border-b"><Square2StackIcon className="h-5 w-5 inline-block mr-1" />- Workflow{" "}- </div>- <div className="text-xs mt-2 mb-2 pb-1 ">+ Agents Workflow{" "}+ </div> */}+ <div className="text-sm mt-2 mb-2 pb-1 ">{" "}- Select or create an agent workflow.{" "}+ Please select an agent workflow to begin.{" "}</div><div className="relative mt-2 ">@@ -98,7 +98,7 @@ const AgentsWorkflowView = () => {)}<div className="mt-2 text-xs">{" "}- Create new workflows{" "}+ View all workflows{" "}<span className="text-accent">{" "}<Link to="/build">here</Link>diff --git a/samples/apps/autogen-studio/frontend/src/hooks/store.tsx b/samples/apps/autogen-studio/frontend/src/hooks/store.tsxindex fc42eeeeb..372dde263 100644--- a/samples/apps/autogen-studio/frontend/src/hooks/store.tsx+++ b/samples/apps/autogen-studio/frontend/src/hooks/store.tsx@@ -4,13 +4,15 @@ import { IChatMessage, IChatSession, IFlowConfig } from "../components/types";interface ConfigState {workflowConfig: IFlowConfig | null;- setWorkflowConfig: (flowConfig: IFlowConfig) => void;+ setWorkflowConfig: (flowConfig: IFlowConfig | null) => void;messages: IChatMessage[] | null;setMessages: (messages: IChatMessage[]) => void;session: IChatSession | null;- setSession: (session: IChatSession) => void;+ setSession: (session: IChatSession | null) => void;sessions: IChatSession[];setSessions: (sessions: IChatSession[]) => void;+ version: string | null;+ setVersion: (version: string) => void;}export const useConfigStore = create<ConfigState>()((set) => ({@@ -22,4 +24,6 @@ export const useConfigStore = create<ConfigState>()((set) => ({setSession: (session) => set({ session }),sessions: [],setSessions: (sessions) => set({ sessions }),+ version: null,+ setVersion: (version) => set({ version }),}));diff --git a/samples/apps/autogen-studio/frontend/static/images/svgs/welcome.svg b/samples/apps/autogen-studio/frontend/static/images/svgs/welcome.svgnew file mode 100644index 000000000..a8e3c9560--- /dev/null+++ b/samples/apps/autogen-studio/frontend/static/images/svgs/welcome.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" width="613.35286" height="700.56123" viewBox="0 0 613.35286 700.56123" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M587.667,756.93133l-.78168-17.57606q-.12187-.06468-.24405-.12879c-8.37606-4.39513-17.97576,3.561-15.3004,12.63392,2.51722,8.5366,4.20846,17.73958,8.81613,25.21162a34.14441,34.14441,0,0,0,25.03847,15.77861l10.64166,6.51555a57.21525,57.21525,0,0,0-12.05953-46.36368,55.2668,55.2668,0,0,0-10.157-9.4375C591.07189,750.28541,587.667,756.93133,587.667,756.93133Z" transform="translate(-293.32357 -99.71938)" fill="#f2f2f2"/><path d="M492.3909,578.56387c-20.48783-21.12931-50.17767-33.24712-81.45666-33.24712l-1.20652.00324a116.3146,116.3146,0,0,1-58.63546-15.83485l-1.85205-1.07912,1.49167-1.537a113.37272,113.37272,0,0,0,19.99317-28.30616,34.28239,34.28239,0,0,1-27.66751,8.93789,35.10416,35.10416,0,0,1-25.77016-16.50626c-10.93231-17.73787-23.96381-42.90658-23.96381-62.0803a116.66888,116.66888,0,0,1,38.0631-86.091,72.65143,72.65143,0,0,0,23.99981-54.17137l-.00607-1.45284a164.77416,164.77416,0,0,1,4.8908-39.87268l.33005-1.31694,1.355.04732a111.39121,111.39121,0,0,0,26.04681-2.1821,87.918,87.918,0,0,1-23.35954-6.213l-1.45769-.58971.4947-1.4937C397.78172,214.464,474.7579,225.398,519.43718,123.17462,555.666,40.28535,683.49348,196.75549,683.49348,287.199c0,9.2287-9.13324,21.42423-2.29615,27.52391,73.90979,65.93827,22.91308,108.27972,6.83466,150.88534-3.81479,10.10871,4.45682,21.20613,4.45682,32.14249,0,1.85569-.04732,3.77124-.14076,5.69327l-.14237,2.955-2.46441-1.63971a81.62563,81.62563,0,0,1-13.47964-11.05649,71.13531,71.13531,0,0,1-2.25612,61.41172c-7.74552,14.619-15.23907,25.085-22.27193,31.10507a116.2904,116.2904,0,0,1-159.34268-7.65574Z" transform="translate(-293.32357 -99.71938)" fill="#e6e6e6"/><path d="M616.13152,798.499a2.09333,2.09333,0,0,0,2.06993-1.79837c.08893-.62489,8.80049-63.45379.97652-146.956-7.22548-77.11632-30.4294-188.191-99.9393-279.41478a2.0935,2.0935,0,1,0-3.33028,2.53775c68.90954,90.436,91.9264,200.69567,99.10094,277.2675,7.77849,83.01636-.86476,145.3553-.953,145.97542a2.09519,2.09519,0,0,0,2.0752,2.38851Z" transform="translate(-293.32357 -99.71938)" fill="#3f3d56"/><path d="M559.40732,499.0052a2.09343,2.09343,0,0,0,1.23242-3.78686c-.25231-.18331-25.681-18.50562-63.69657-32.425-35.14253-12.86589-88.582-24.5297-143.597-7.02036a2.0932,2.0932,0,1,0,1.26956,3.98925c53.88785-17.14953,106.35862-5.67858,140.88784,6.96312,37.47293,13.72044,62.427,31.7,62.67472,31.87988A2.08515,2.08515,0,0,0,559.40732,499.0052Z" transform="translate(-293.32357 -99.71938)" fill="#3f3d56"/><path d="M655.2196,260.37275a2.09343,2.09343,0,0,0-3.68827-1.50192c-.201.23845-20.307,24.28166-36.928,61.19609-15.36327,34.12475-30.84523,86.58548-17.34326,142.71855a2.09319,2.09319,0,1,0,4.07031-.979c-13.22427-54.983,1.99558-106.49141,17.09108-140.02058,16.38342-36.38756,36.11335-59.982,36.31062-60.21616A2.0852,2.0852,0,0,0,655.2196,260.37275Z" transform="translate(-293.32357 -99.71938)" fill="#3f3d56"/><path d="M652.38648,368.31675c1.76623,14.25037,11.64059,26,26,26a26,26,0,0,0,26-26c0-14.3594-11.70215-24.67241-26-26C663.21558,340.90809,650.11884,350.02107,652.38648,368.31675Z" transform="translate(-293.32357 -99.71938)" fill="#2f2e41"/><polygon points="397.105 687.328 407.006 687.327 411.716 649.137 397.103 649.138 397.105 687.328" fill="#ffb6b6"/><path d="M690.08055,797.37579l30.447-.00116v-.385A11.85149,11.85149,0,0,0,708.67674,785.139H708.676l-5.56152-4.21923-10.37659,4.21991-2.65783.00006Z" transform="translate(-293.32357 -99.71938)" fill="#2f2e41"/><polygon points="358.105 687.328 368.006 687.327 372.716 649.137 358.103 649.138 358.105 687.328" fill="#ffb6b6"/><path d="M651.08055,797.37579l30.447-.00116v-.385A11.85149,11.85149,0,0,0,669.67674,785.139H669.676l-5.56152-4.21923-10.37659,4.21991-2.65783.00006Z" transform="translate(-293.32357 -99.71938)" fill="#2f2e41"/><path d="M724.50065,547.85614l7,24L723.25419,673.501s4.24646,6.35511,1.24646,6.35511-6.84686,1.40942-4.4234,5.20471-5.86,17.4209-5.86,17.4209l-11.71661,72.37439-14.92914-.22046s-7.59009-4.22833-3.3305-8.504,7.25958-4.27557,3.25958-8.27557-4-2.79529-4-5.89765-4.00751-41.01574,5.49628-55.559l-2.86365-59.29529-6.74457,58.16144-13.888,77.59052-14.38171-.11847s-6.64276-6.40271-6.6305-11.14209,4.10419-5.13312,1.05823-7.93628-3.046-45.86615,5.954-69.80316c0,0,5.09108-13.37393-.01155-17.95666s-.00631-9.82652-.00631-9.82652,8.08172-2.92145-.0073-11.33883-.04369-67.94913-.04369-67.94913-8.84271-24.03067.1131-33.47977S724.50065,547.85614,724.50065,547.85614Z" transform="translate(-293.32357 -99.71938)" fill="#2f2e41"/><path d="M599.82611,589.20574l12.48925-30.1823,9.84,5.46667-5.94253,30.70307a10.93464,10.93464,0,1,1-16.38671-5.98744Z" transform="translate(-293.32357 -99.71938)" fill="#ffb6b6"/><path d="M809.4002,350.535l-19.00315,26.56751-8.34544-7.554,12.7447-28.5581A10.93464,10.93464,0,1,1,809.4002,350.535Z" transform="translate(-293.32357 -99.71938)" fill="#ffb6b6"/><path d="M726.38648,550.31675c12.32568,19.11831-49.63137,43.38055-73.40448,33.64-4.1628-1.7056-18.48212-7.33918-8.69439-15.14958s-1.1348-8.90952-1.393-13.99392c-.1726-3.39918,2.45917-10.85592-.28674-10.5362s-5.95975-4.3811.0205-6.404.06411-3.86767.11651-5.78787c.57186-20.95538,16.64979-54.2869,16.64979-54.2869l-28.971,74.05682s.214,12.81223-3.48049,8.897-3.42565,8.75675-3.42565,8.75675-5.49354,3.83389-2.33452,5.9676-3.401,8.6937-3.401,8.6937l-15.30666-1.09334s.23964-11.37068,2.85315-13.88533,1.32975-6.47144,1.32975-6.47144,6.80457-6.02348,2.24268-10.91429c-5.86712-6.29013,15.52417-112.52993,22.90637-111.47784a28.12048,28.12048,0,0,1,20.08017-21.45161l16.53221-4.55191,2.93564-11.64749h23.27852l4.0548,7.65333,17.69783,7.98657c3.33362-4.70352,5.82477-9.65991,19.47546-11.26657,0,0,36.78255-33.46683,34.98668-36.08s3.906-8.73109,3.906-8.73109,4.86956-1.59377,2.12179-2.44467,2.446-2.81826,2.446-2.81826,4.81028-1.264,2.54157-2.92832,7.57128-2.75765,7.57128-2.75765l12.767,10.4168-2.58037,4.37541s1.5733,5.958-.48,3.78289-2.43983,4.1371-2.43983,4.1371-1.0486,6.912-7.26682,8.99446S778.502,404.8635,778.502,404.8635c-14.6648,19.0673-31.97132,33.9415-52.48,43.73331C734.01483,457.77113,726.38648,550.31675,726.38648,550.31675Z" transform="translate(-293.32357 -99.71938)" fill="#22c55e"/><circle cx="387.93692" cy="273.08556" r="23.0557" fill="#ffb6b6"/><path d="M657.38648,375.31675c.73,5.01,5,12,4,12s-8.11-20.65332-1-22c5.15722-.97681,6.31-.12,11.13-2.21l-.68.64c3.19,2.32,7.63.89,11.27-.62,3.65-1.5,8.08-2.93,11.28-.62,2.01,1.45,2.86,3.97,4.11,6.11,1.25,2.15,3.56,4.18,5.94,3.52,1.91-.53,3.01-2.67005,3-4.65s-2.58825-3.86355-1.72-5.64c2.57319-5.26444.25916-8.85275-5.35-11.33q-3.06-.465-6.12-.95a17.35842,17.35842,0,0,1,3.84-3.86,8.77436,8.77436,0,0,0-3.1-3.97c-1.63-.97-3.65-.9-5.54-.8q-6.33.33-12.65.66c-3.12.16-6.35.35-9.13995,1.78-3.48,1.79-5.76,5.28-7.42005,8.83C655.51648,360.18675,656.10645,366.60679,657.38648,375.31675Z" transform="translate(-293.32357 -99.71938)" fill="#2f2e41"/><path d="M561.476,799.97328l226.75.30734a1.19068,1.19068,0,1,0,0-2.38137l-226.75-.30733a1.19068,1.19068,0,0,0,0,2.38136Z" transform="translate(-293.32357 -99.71938)" fill="#cacaca"/><ellipse cx="471.98821" cy="695.09416" rx="5.25681" ry="7.55666" transform="translate(-577.14417 962.36498) rotate(-81.72174)" fill="#e6e6e6"/><ellipse cx="521.15973" cy="690.29611" rx="5.2568" ry="7.55666" transform="translate(-530.30434 1006.91693) rotate(-81.72174)" fill="#3f3d56"/><ellipse cx="458.5236" cy="655.286" rx="5.25681" ry="7.55666" transform="translate(-549.27676 914.96411) rotate(-81.72174)" fill="#ff6584"/><ellipse cx="441.31304" cy="640.04291" rx="4.77581" ry="3.3223" transform="translate(-495.37215 976.78425) rotate(-89.56675)" fill="#e6e6e6"/><ellipse cx="434.06731" cy="609.6713" rx="4.77581" ry="3.3223" transform="translate(-472.19234 939.39678) rotate(-89.56675)" fill="#3f3d56"/><ellipse cx="490.41248" cy="663.12322" rx="4.77581" ry="3.3223" transform="translate(-469.72363 1048.78806) rotate(-89.56675)" fill="#e6e6e6"/><ellipse cx="466.65067" cy="674.98721" rx="4.77581" ry="3.3223" transform="translate(-505.16941 1036.80122) rotate(-89.56675)" fill="#ff6584"/><ellipse cx="499.72794" cy="696.91495" rx="4.77581" ry="3.3223" transform="translate(-494.26937 1091.63947) rotate(-89.56675)" fill="#3f3d56"/><ellipse cx="849.98821" cy="541.09416" rx="5.25681" ry="7.55666" transform="translate(-101.17347 1204.59943) rotate(-81.72174)" fill="#e6e6e6"/><ellipse cx="899.15973" cy="536.29611" rx="5.2568" ry="7.55666" transform="translate(-54.33364 1249.15138) rotate(-81.72174)" fill="#3f3d56"/><ellipse cx="836.5236" cy="501.286" rx="5.25681" ry="7.55666" transform="matrix(0.14398, -0.98958, 0.98958, 0.14398, -73.30606, 1157.19856)" fill="#ff6584"/><ellipse cx="819.31304" cy="486.04292" rx="4.77581" ry="3.3223" transform="translate(33.76519 1201.93792) rotate(-89.56675)" fill="#e6e6e6"/><ellipse cx="812.06731" cy="455.6713" rx="4.77581" ry="3.3223" transform="translate(56.94499 1164.55045) rotate(-89.56675)" fill="#3f3d56"/><ellipse cx="868.41248" cy="509.12322" rx="4.77581" ry="3.3223" transform="translate(59.41371 1273.94173) rotate(-89.56675)" fill="#e6e6e6"/><ellipse cx="844.65067" cy="520.98721" rx="4.77581" ry="3.3223" transform="translate(23.96793 1261.95489) rotate(-89.56675)" fill="#ff6584"/><ellipse cx="877.72794" cy="542.91495" rx="4.77581" ry="3.3223" transform="translate(34.86796 1316.79314) rotate(-89.56675)" fill="#3f3d56"/><ellipse cx="666.98821" cy="256.09416" rx="5.25681" ry="7.55666" transform="translate(24.20544 779.54069) rotate(-81.72174)" fill="#fff"/><ellipse cx="716.15973" cy="251.29611" rx="5.2568" ry="7.55666" transform="translate(71.04527 824.09264) rotate(-81.72174)" fill="#3f3d56"/><ellipse cx="653.5236" cy="216.286" rx="5.25681" ry="7.55666" transform="translate(52.07285 732.13983) rotate(-81.72174)" fill="#ff6584"/><ellipse cx="636.31304" cy="201.04292" rx="4.77581" ry="3.3223" transform="translate(137.1408 736.09819) rotate(-89.56675)" fill="#e6e6e6"/><ellipse cx="629.06731" cy="170.6713" rx="4.77581" ry="3.3223" transform="translate(160.32061 698.71071) rotate(-89.56675)" fill="#3f3d56"/><ellipse cx="685.41248" cy="224.12322" rx="4.77581" ry="3.3223" transform="translate(162.78933 808.102) rotate(-89.56675)" fill="#e6e6e6"/><ellipse cx="661.65067" cy="235.98721" rx="4.77581" ry="3.3223" transform="translate(127.34354 796.11516) rotate(-89.56675)" fill="#ff6584"/><ellipse cx="694.72794" cy="257.91495" rx="4.77581" ry="3.3223" transform="translate(138.24358 850.95341) rotate(-89.56675)" fill="#3f3d56"/></svg>diff --git a/samples/apps/autogen-studio/notebooks/agent_spec.json b/samples/apps/autogen-studio/notebooks/agent_spec.jsonindex 873aac6da..bcd795532 100644--- a/samples/apps/autogen-studio/notebooks/agent_spec.json+++ b/samples/apps/autogen-studio/notebooks/agent_spec.json@@ -34,7 +34,7 @@],"temperature": 0.1,"timeout": 600,- "cache_seed": null+ "cache_seed": 42},"human_input_mode": "NEVER","max_consecutive_auto_reply": 8,diff --git a/samples/apps/autogen-studio/notebooks/groupchat_spec.json b/samples/apps/autogen-studio/notebooks/groupchat_spec.jsonnew file mode 100644index 000000000..21cced713--- /dev/null+++ b/samples/apps/autogen-studio/notebooks/groupchat_spec.json@@ -0,0 +1,103 @@+{+ "name": "Travel Agent Group Chat Workflow",+ "description": "A group chat workflow",+ "type": "groupchat",+ "sender": {+ "type": "userproxy",+ "config": {+ "name": "userproxy",+ "human_input_mode": "NEVER",+ "max_consecutive_auto_reply": 5,+ "system_message": "",+ "llm_config": false,+ "code_execution_config": {+ "work_dir": null,+ "use_docker": false+ }+ }+ },+ "receiver": {+ "type": "groupchat",+ "description": "A group chat workflow",+ "config": {+ "name": "group_chat_manager",+ "llm_config": {+ "config_list": [+ {+ "model": "gpt-4-1106-preview"+ }+ ],+ "temperature": 0.1,+ "timeout": 600,+ "cache_seed": 42+ },+ "human_input_mode": "NEVER",+ "system_message": "Group chat manager"+ },+ "groupchat_config": {+ "admin_name": "Admin",+ "max_round": 10,+ "speaker_selection_method": "auto",++ "agents": [+ {+ "type": "assistant",+ "config": {+ "name": "primary_assistant",+ "llm_config": {+ "config_list": [+ {+ "model": "gpt-4-1106-preview"+ }+ ],+ "temperature": 0.1,+ "timeout": 600,+ "cache_seed": 42+ },+ "human_input_mode": "NEVER",+ "max_consecutive_auto_reply": 8,+ "system_message": "You are a helpful assistant that can suggest a travel itinerary for a user. You are the primary cordinator who will receive suggestions or advice from other agents (local_assistant, language_assistant). You must ensure that the finally plan integrates the suggestions from other agents or team members. YOUR FINAL RESPONSE MUST BE THE COMPLETE PLAN that ends with the word TERMINATE. "+ }+ },+ {+ "type": "assistant",+ "config": {+ "name": "local_assistant",+ "llm_config": {+ "config_list": [+ {+ "model": "gpt-4-1106-preview"+ }+ ],+ "temperature": 0.1,+ "timeout": 600,+ "cache_seed": 42+ },+ "human_input_mode": "NEVER",+ "max_consecutive_auto_reply": 8,+ "system_message": "You are a helpful assistant that can review travel plans, providing critical feedback on how the trip can be enriched for enjoyment of the local culture. If the plan already includes local experiences, you can mention that the plan is satisfactory, with rationale."+ }+ },+ {+ "type": "assistant",+ "config": {+ "name": "language_assistant",+ "llm_config": {+ "config_list": [+ {+ "model": "gpt-4-1106-preview"+ }+ ],+ "temperature": 0.1,+ "timeout": 600,+ "cache_seed": 42+ },+ "human_input_mode": "NEVER",+ "max_consecutive_auto_reply": 8,+ "system_message": "You are a helpful assistant that can review travel plans, providing feedback on important/critical tips about how best to address language or communication challenges for the given destination. If the plan already includes language tips, you can mention that the plan is satisfactory, with rationale."+ }+ }+ ]+ }+ }+}diff --git a/samples/apps/autogen-studio/notebooks/tutorial.ipynb b/samples/apps/autogen-studio/notebooks/tutorial.ipynbindex 36951bd32..fddaa4d24 100644--- a/samples/apps/autogen-studio/notebooks/tutorial.ipynb+++ b/samples/apps/autogen-studio/notebooks/tutorial.ipynb@@ -1,5 +1,16 @@{"cells": [+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {},+ "outputs": [],+ "source": [+ "import json\n",+ "\n",+ "from autogenstudio import AgentWorkFlowConfig, AutoGenWorkFlowManager"+ ]+ },{"cell_type": "markdown","metadata": {},@@ -24,24 +35,20 @@"name": "stdout","output_type": "stream","text": [- "work_dir work_dir\n","userproxy (to primary_assistant):\n","\n",- "What is the height of the Eiffel Tower?\n",+ "What is the height of the Eiffel Tower?. Dont write code, just respond to the question.\n","\n","--------------------------------------------------------------------------------\n","primary_assistant (to userproxy):\n","\n",- "The Eiffel Tower, located in Paris, France, has a height of approximately 300 meters (984 feet) to the tip. Its height can vary slightly due to temperature changes which cause the metal to expand and contract. Including antennas, the total height of the Eiffel Tower is about 330 meters (1,083 feet). TERMINATE\n",+ "The Eiffel Tower is approximately 300 meters tall, not including antennas. With antennas, it reaches a height of about 330 meters. TERMINATE\n","\n","--------------------------------------------------------------------------------\n"]}],"source": [- "import json\n",- "\n",- "from autogenstudio import AgentWorkFlowConfig, AutoGenWorkFlowManager\n","\n","# load an agent specification in JSON\n","agent_spec = json.load(open(\"agent_spec.json\"))\n",@@ -49,14 +56,247 @@"# Creat a An AutoGen Workflow Configuration from the agent specification\n","agent_work_flow_config = AgentWorkFlowConfig(**agent_spec)\n","\n",- "# Create a Workflow from the configuration\n",+ "# # Create a Workflow from the configuration\n","agent_work_flow = AutoGenWorkFlowManager(agent_work_flow_config)\n","\n",- "# Run the workflow on a task\n",- "task_query = \"What is the height of the Eiffel Tower?\"\n",+ "# # Run the workflow on a task\n",+ "task_query = \"What is the height of the Eiffel Tower?. Dont write code, just respond to the question.\"\n","agent_work_flow.run(message=task_query)"]},+ {+ "cell_type": "code",+ "execution_count": 2,+ "metadata": {},+ "outputs": [+ {+ "data": {+ "text/plain": [+ "[{'recipient': 'primary_assistant',\n",+ " 'sender': 'userproxy',\n",+ " 'message': {'content': 'What is the height of the Eiffel Tower?. Dont write code, just respond to the question.',\n",+ " 'role': 'user'},\n",+ " 'timestamp': '2024-01-02T21:38:35.131849'},\n",+ " {'recipient': 'userproxy',\n",+ " 'sender': 'primary_assistant',\n",+ " 'message': {'content': 'The Eiffel Tower is approximately 300 meters tall, not including antennas. With antennas, it reaches a height of about 330 meters. TERMINATE',\n",+ " 'role': 'user'},\n",+ " 'timestamp': '2024-01-02T21:38:35.136795'}]"+ ]+ },+ "execution_count": 2,+ "metadata": {},+ "output_type": "execute_result"+ }+ ],+ "source": [+ "agent_work_flow.agent_history"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "## Group Chat Agent"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": 5,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "userproxy (to group_chat_manager):\n",+ "\n",+ "plan a two day trip to Maui hawaii\n",+ "\n",+ "--------------------------------------------------------------------------------\n",+ "local_assistant (to group_chat_manager):\n",+ "\n",+ "To plan a two-day trip to Maui, Hawaii, we'll need to consider a variety of activities that allow you to experience the island's natural beauty, culture, and cuisine. Here's a suggested itinerary:\n",+ "\n",+ "**Day 1: Exploring the Natural Beauty of Maui**\n",+ "\n",+ "- **Morning:**\n",+ " - Start your day with a sunrise visit to Haleakalā National Park. Witnessing the sunrise from the summit of Haleakalā is a breathtaking experience. Remember to make a reservation in advance as it's required for sunrise viewing.\n",+ " - After the sunrise, take a short hike in the park to explore the unique volcanic landscapes.\n",+ "\n",+ "- **Afternoon:**\n",+ " - Head to the town of Paia for lunch. Paia is known for its laid-back atmosphere and has several local restaurants where you can try Hawaiian specialties.\n",+ " - Visit Ho'okipa Beach Park to watch windsurfers and surfers, or if you're adventurous, take a surf lesson.\n",+ "\n",+ "- **Evening:**\n",+ " - Drive to Lahaina, a historic whaling village, and stroll along Front Street. Here you can shop for local crafts and art.\n",+ " - Have dinner at a traditional Hawaiian luau, where you can enjoy local food, music, and dance.\n",+ "\n",+ "**Day 2: Cultural and Relaxation Experience**\n",+ "\n",+ "- **Morning:**\n",+ " - Visit Iao Valley State Park to see the Iao Needle and learn about the historical significance of this area to Hawaiian culture.\n",+ " - Explore the Maui Tropical Plantation and take a tram tour to learn about the island's agriculture and taste some fresh tropical fruits.\n",+ "\n",+ "- **Afternoon:**\n",+ " - Relax at one of Maui's beautiful beaches, such as Ka'anapali Beach or Wailea Beach. Take the opportunity to snorkel and see the vibrant marine life.\n",+ " - Consider a visit to a local farm or a coffee plantation to learn more about the local produce.\n",+ "\n",+ "- **Evening:**\n",+ " - Enjoy a sunset dinner cruise off the coast of Maui for a memorable end to your trip. This is a great way to see the island from a different perspective and often includes entertainment.\n",+ "\n",+ "Remember to book accommodations in advance, rent a car for easier travel around the island, and check for any travel restrictions or requirements. Also, be respectful of the local environment and culture, and try to participate in activities that support the local economy and conservation efforts.\n",+ "\n",+ "This plan includes a mix of natural, cultural, and relaxation activities that should give you a well-rounded experience of Maui in two days. If you have specific interests or preferences, the itinerary can be adjusted accordingly.\n",+ "\n",+ "--------------------------------------------------------------------------------\n",+ "language_assistant (to group_chat_manager):\n",+ "\n",+ "Regarding language or communication challenges, Hawaii is a part of the United States, so the primary language spoken is English. However, the Hawaiian language is also an official language of the state, and you will likely encounter Hawaiian words and place names during your visit.\n",+ "\n",+ "Here are some tips to address potential language or communication challenges in Maui:\n",+ "\n",+ "1. **Learn Basic Hawaiian Phrases**: While not necessary, learning a few basic Hawaiian phrases can be a sign of respect for the local culture. For example:\n",+ " - Aloha - Hello/Goodbye\n",+ " - Mahalo - Thank you\n",+ " - 'Aina - Land\n",+ " - Kai - Sea\n",+ "\n",+ "2. **Use Translation Apps**: If you come across Hawaiian words or phrases that you don't understand, you can use translation apps on your smartphone to help you understand their meanings.\n",+ "\n",+ "3. **Cultural Understanding**: Take some time to learn about Hawaiian culture and customs before your trip. This will help you communicate more effectively and respectfully with locals.\n",+ "\n",+ "4. **Ask for Help**: If you're unsure about pronunciation or meaning, don't hesitate to ask locals. People in Hawaii are generally friendly and willing to help.\n",+ "\n",+ "5. **Be Patient and Respectful**: Always be patient and respectful in your interactions. Remember that you are a guest in Hawaii, and showing respect for the local culture and language is important.\n",+ "\n",+ "Your travel plan should include these language tips to ensure smooth communication during your trip. If your plan already includes these tips, then it is satisfactory. If not, consider incorporating them to enhance your travel experience.\n",+ "\n",+ "--------------------------------------------------------------------------------\n",+ "primary_assistant (to group_chat_manager):\n",+ "\n",+ "Based on the suggestions from the local and language assistants, here is the complete two-day travel itinerary for Maui, Hawaii:\n",+ "\n",+ "**Day 1: Exploring the Natural Beauty of Maui**\n",+ "\n",+ "- **Morning:**\n",+ " - Experience the sunrise at Haleakalā National Park (make a reservation in advance).\n",+ " - Enjoy a short hike in the park to see the volcanic landscapes.\n",+ "\n",+ "- **Afternoon:**\n",+ " - Have lunch in Paia and enjoy Hawaiian specialties.\n",+ " - Visit Ho'okipa Beach Park for surfing or to watch the surfers.\n",+ "\n",+ "- **Evening:**\n",+ " - Explore Lahaina and shop along Front Street.\n",+ " - Attend a traditional Hawaiian luau for dinner with music and dance.\n",+ "\n",+ "**Day 2: Cultural and Relaxation Experience**\n",+ "\n",+ "- **Morning:**\n",+ " - Visit Iao Valley State Park to see the Iao Needle.\n",+ " - Take a tram tour at Maui Tropical Plantation and taste fresh tropical fruits.\n",+ "\n",+ "- **Afternoon:**\n",+ " - Relax at Ka'anapali Beach or Wailea Beach and go snorkeling.\n",+ " - Optionally, visit a local farm or coffee plantation.\n",+ "\n",+ "- **Evening:**\n",+ " - Enjoy a sunset dinner cruise with entertainment.\n",+ "\n",+ "**Language and Communication Tips:**\n",+ "\n",+ "- Learn basic Hawaiian phrases such as \"Aloha\" (Hello/Goodbye) and \"Mahalo\" (Thank you).\n",+ "- Use translation apps for any unfamiliar Hawaiian words or phrases.\n",+ "- Educate yourself about Hawaiian culture and customs to communicate respectfully.\n",+ "- Ask locals for help if you're unsure about pronunciation or meaning.\n",+ "- Be patient and respectful in all interactions, honoring local culture and language.\n",+ "\n",+ "**Additional Travel Tips:**\n",+ "\n",+ "- Book accommodations and a car rental in advance.\n",+ "- Check for any travel restrictions or requirements.\n",+ "- Support local economy and conservation efforts.\n",+ "- Be mindful of the environment and cultural sites.\n",+ "\n",+ "This itinerary provides a balanced mix of activities that showcase Maui's natural beauty, culture, and opportunities for relaxation. Remember to be respectful of the local environment and culture, and enjoy your two-day adventure in Maui, Hawaii.\n",+ "\n",+ "TERMINATE\n",+ "\n",+ "--------------------------------------------------------------------------------\n"+ ]+ }+ ],+ "source": [+ "# load an agent specification in JSON\n",+ "agent_spec = json.load(open(\"groupchat_spec.json\"))\n",+ "\n",+ "# Creat a An AutoGen Workflow Configuration from the agent specification\n",+ "agent_work_flow_config = AgentWorkFlowConfig(**agent_spec)\n",+ "\n",+ "# Create a Workflow from the configuration\n",+ "group_agent_work_flow = AutoGenWorkFlowManager(agent_work_flow_config)\n",+ "\n",+ "# Run the workflow on a task\n",+ "task_query = \"plan a two day trip to Maui hawaii\"\n",+ "group_agent_work_flow.run(message=task_query)"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": 6,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "4 agent messages were involved in the conversation\n"+ ]+ },+ {+ "data": {+ "text/plain": [+ "[{'recipient': 'local_assistant',\n",+ " 'sender': 'group_chat_manager',\n",+ " 'message': {'content': 'plan a two day trip to Maui hawaii',\n",+ " 'name': 'userproxy',\n",+ " 'role': 'user'},\n",+ " 'timestamp': '2024-01-02T21:38:42.433093'},\n",+ " {'recipient': 'language_assistant',\n",+ " 'sender': 'group_chat_manager',\n",+ " 'message': {'content': \"To plan a two-day trip to Maui, Hawaii, we'll need to consider a variety of activities that allow you to experience the island's natural beauty, culture, and cuisine. Here's a suggested itinerary:\\n\\n**Day 1: Exploring the Natural Beauty of Maui**\\n\\n- **Morning:**\\n - Start your day with a sunrise visit to Haleakalā National Park. Witnessing the sunrise from the summit of Haleakalā is a breathtaking experience. Remember to make a reservation in advance as it's required for sunrise viewing.\\n - After the sunrise, take a short hike in the park to explore the unique volcanic landscapes.\\n\\n- **Afternoon:**\\n - Head to the town of Paia for lunch. Paia is known for its laid-back atmosphere and has several local restaurants where you can try Hawaiian specialties.\\n - Visit Ho'okipa Beach Park to watch windsurfers and surfers, or if you're adventurous, take a surf lesson.\\n\\n- **Evening:**\\n - Drive to Lahaina, a historic whaling village, and stroll along Front Street. Here you can shop for local crafts and art.\\n - Have dinner at a traditional Hawaiian luau, where you can enjoy local food, music, and dance.\\n\\n**Day 2: Cultural and Relaxation Experience**\\n\\n- **Morning:**\\n - Visit Iao Valley State Park to see the Iao Needle and learn about the historical significance of this area to Hawaiian culture.\\n - Explore the Maui Tropical Plantation and take a tram tour to learn about the island's agriculture and taste some fresh tropical fruits.\\n\\n- **Afternoon:**\\n - Relax at one of Maui's beautiful beaches, such as Ka'anapali Beach or Wailea Beach. Take the opportunity to snorkel and see the vibrant marine life.\\n - Consider a visit to a local farm or a coffee plantation to learn more about the local produce.\\n\\n- **Evening:**\\n - Enjoy a sunset dinner cruise off the coast of Maui for a memorable end to your trip. This is a great way to see the island from a different perspective and often includes entertainment.\\n\\nRemember to book accommodations in advance, rent a car for easier travel around the island, and check for any travel restrictions or requirements. Also, be respectful of the local environment and culture, and try to participate in activities that support the local economy and conservation efforts.\\n\\nThis plan includes a mix of natural, cultural, and relaxation activities that should give you a well-rounded experience of Maui in two days. If you have specific interests or preferences, the itinerary can be adjusted accordingly.\",\n",+ " 'name': 'local_assistant',\n",+ " 'role': 'user'},\n",+ " 'timestamp': '2024-01-02T21:39:33.989518'},\n",+ " {'recipient': 'primary_assistant',\n",+ " 'sender': 'group_chat_manager',\n",+ " 'message': {'content': \"Regarding language or communication challenges, Hawaii is a part of the United States, so the primary language spoken is English. However, the Hawaiian language is also an official language of the state, and you will likely encounter Hawaiian words and place names during your visit.\\n\\nHere are some tips to address potential language or communication challenges in Maui:\\n\\n1. **Learn Basic Hawaiian Phrases**: While not necessary, learning a few basic Hawaiian phrases can be a sign of respect for the local culture. For example:\\n - Aloha - Hello/Goodbye\\n - Mahalo - Thank you\\n - 'Aina - Land\\n - Kai - Sea\\n\\n2. **Use Translation Apps**: If you come across Hawaiian words or phrases that you don't understand, you can use translation apps on your smartphone to help you understand their meanings.\\n\\n3. **Cultural Understanding**: Take some time to learn about Hawaiian culture and customs before your trip. This will help you communicate more effectively and respectfully with locals.\\n\\n4. **Ask for Help**: If you're unsure about pronunciation or meaning, don't hesitate to ask locals. People in Hawaii are generally friendly and willing to help.\\n\\n5. **Be Patient and Respectful**: Always be patient and respectful in your interactions. Remember that you are a guest in Hawaii, and showing respect for the local culture and language is important.\\n\\nYour travel plan should include these language tips to ensure smooth communication during your trip. If your plan already includes these tips, then it is satisfactory. If not, consider incorporating them to enhance your travel experience.\",\n",+ " 'name': 'language_assistant',\n",+ " 'role': 'user'},\n",+ " 'timestamp': '2024-01-02T21:39:58.874159'},\n",+ " {'recipient': 'primary_assistant',\n",+ " 'sender': 'group_chat_manager',\n",+ " 'message': {'content': 'Based on the suggestions from the local and language assistants, here is the complete two-day travel itinerary for Maui, Hawaii:\\n\\n**Day 1: Exploring the Natural Beauty of Maui**\\n\\n- **Morning:**\\n - Experience the sunrise at Haleakalā National Park (make a reservation in advance).\\n - Enjoy a short hike in the park to see the volcanic landscapes.\\n\\n- **Afternoon:**\\n - Have lunch in Paia and enjoy Hawaiian specialties.\\n - Visit Ho\\'okipa Beach Park for surfing or to watch the surfers.\\n\\n- **Evening:**\\n - Explore Lahaina and shop along Front Street.\\n - Attend a traditional Hawaiian luau for dinner with music and dance.\\n\\n**Day 2: Cultural and Relaxation Experience**\\n\\n- **Morning:**\\n - Visit Iao Valley State Park to see the Iao Needle.\\n - Take a tram tour at Maui Tropical Plantation and taste fresh tropical fruits.\\n\\n- **Afternoon:**\\n - Relax at Ka\\'anapali Beach or Wailea Beach and go snorkeling.\\n - Optionally, visit a local farm or coffee plantation.\\n\\n- **Evening:**\\n - Enjoy a sunset dinner cruise with entertainment.\\n\\n**Language and Communication Tips:**\\n\\n- Learn basic Hawaiian phrases such as \"Aloha\" (Hello/Goodbye) and \"Mahalo\" (Thank you).\\n- Use translation apps for any unfamiliar Hawaiian words or phrases.\\n- Educate yourself about Hawaiian culture and customs to communicate respectfully.\\n- Ask locals for help if you\\'re unsure about pronunciation or meaning.\\n- Be patient and respectful in all interactions, honoring local culture and language.\\n\\n**Additional Travel Tips:**\\n\\n- Book accommodations and a car rental in advance.\\n- Check for any travel restrictions or requirements.\\n- Support local economy and conservation efforts.\\n- Be mindful of the environment and cultural sites.\\n\\nThis itinerary provides a balanced mix of activities that showcase Maui\\'s natural beauty, culture, and opportunities for relaxation. Remember to be respectful of the local environment and culture, and enjoy your two-day adventure in Maui, Hawaii.\\n\\nTERMINATE',\n",+ " 'role': 'assistant'},\n",+ " 'timestamp': '2024-01-02T21:40:30.240153'}]"+ ]+ },+ "execution_count": 6,+ "metadata": {},+ "output_type": "execute_result"+ }+ ],+ "source": [+ "print(len(group_agent_work_flow.agent_history), \"agent messages were involved in the conversation\")\n",+ "group_agent_work_flow.agent_history"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": []+ },{"cell_type": "code","execution_count": null,diff --git a/samples/apps/autogen-studio/pyproject.toml b/samples/apps/autogen-studio/pyproject.tomlindex 7224dd4a5..8be4e5e26 100644--- a/samples/apps/autogen-studio/pyproject.toml+++ b/samples/apps/autogen-studio/pyproject.toml@@ -24,7 +24,7 @@ dependencies = ["typer","uvicorn","arxiv",- "pyautogen==0.2.0"+ "pyautogen>=0.2.0"]optional-dependencies = {web = ["fastapi", "uvicorn"]}diff --git a/website/blog/2023-12-01-AutoGenStudio/index.mdx b/website/blog/2023-12-01-AutoGenStudio/index.mdxindex e4c817e59..e79a5b1f4 100644--- a/website/blog/2023-12-01-AutoGenStudio/index.mdx+++ b/website/blog/2023-12-01-AutoGenStudio/index.mdx@@ -70,6 +70,8 @@ llm_config = LLMConfig(### Installation+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:@@ -189,6 +191,21 @@ As we continue to develop and refine AutoGen Studio, the road map below outlines- **Expansion of Agent Skills**: We will work towards improving the workflow for authoring, composing and reusing agent skills.- **Community Features**: Facilitation of sharing and collaboration within AutoGen Studio user community is a key goal. We're exploring options for sharing sessions and results more easily among users and contributing to a shared repository of skills, agents, and agent workflows.+++## Contribution Guide++We welcome contributions to AutoGen Studio. We recommend the following general steps to contribute to the project:++- Review the overall AutoGen project [contribution guide](https://github.com/microsoft/autogen?tab=readme-ov-file#contributing).+- Please review the AutoGen Studio [roadmap](https://github.com/microsoft/autogen/issues/737) to get a sense of the current priorities for the project. Help is appreciated especially with Studio issues tagged with `help-wanted`.+- Please initiate a discussion on the roadmap issue or a new issue to discuss your proposed contribution.+- Please review the autogenstudio dev branch here [dev branch].(https://github.com/microsoft/autogen/tree/autogenstudio) and use as a base for your contribution. This way, your contribution will be aligned with the latest changes in the AutoGen Studio project.+- Submit a pull request with your contribution!+- If you are modifying AutoGen Studio in vscode, it has its own devcontainer. See instructions in `.devcontainer/README.md` to use it.+- Please use the tag `studio` for any issues, questions, and PRs related to Studio.++### FAQ**Q: Where can I adjust the default skills, agent and workflow configurations?**@@ -203,5 +220,9 @@ A: Yes, you can view the generated messages in the debug console of the web UI,**Q: Where can I find documentation and support for AutoGen Studio?**A: We are constantly working to improve AutoGen Studio. For the latest updates, please refer to the [AutoGen Studio Readme](https://github.com/microsoft/autogen/tree/main/samples/apps/autogen-studio). For additional support, please open an issue on [GitHub](https://github.com/microsoft/autogen) or ask questions on [Discord](https://discord.gg/pAbnFJrkgZ).+**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".+For other OSS models, we recommend using a server such as vllm to instantiate an openai compliant endpoint.+<br />