From 7558711915e1f0c758a66b9f7f97cff570395f3e Mon Sep 17 00:00:00 2001 From: TransformerOptimus Date: Thu, 17 Aug 2023 21:21:34 +0530 Subject: [PATCH 01/31] fixing the toolkit config in iteration workflow --- superagi/agent/agent_tool_step_handler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/superagi/agent/agent_tool_step_handler.py b/superagi/agent/agent_tool_step_handler.py index 673eb8fc2..eccfaedec 100644 --- a/superagi/agent/agent_tool_step_handler.py +++ b/superagi/agent/agent_tool_step_handler.py @@ -16,11 +16,12 @@ from superagi.models.agent_execution_feed import AgentExecutionFeed from superagi.models.agent_execution_permission import AgentExecutionPermission from superagi.models.tool import Tool +from superagi.models.toolkit import Toolkit from superagi.models.workflows.agent_workflow_step import AgentWorkflowStep from superagi.models.workflows.agent_workflow_step_tool import AgentWorkflowStepTool from superagi.resource_manager.resource_summary import ResourceSummarizer from superagi.tools.base_tool import BaseTool - +from sqlalchemy import and_ class AgentToolStepHandler: """Handles the tools steps in the agent workflow""" @@ -116,7 +117,9 @@ def _build_tool_obj(self, agent_config, agent_execution_config, tool_name: str): resource_summary = ResourceSummarizer(session=self.session, agent_id=self.agent_id).fetch_or_create_agent_resource_summary( default_summary=agent_config.get("resource_summary")) - tool = self.session.query(Tool).filter(Tool.name == tool_name).first() + + organisation = Agent.find_org_by_agent_id(self.session, self.agent_id) + tool = self.session.query(Tool).join(Toolkit, and_(Tool.toolkit_id == Toolkit.id, Toolkit.organisation_id == organisation.id, Tool.name == tool_name)).first() tool_obj = tool_builder.build_tool(tool) tool_obj = tool_builder.set_default_params_tool(tool_obj, agent_config, agent_execution_config, model_api_key, resource_summary) From 3d5c8fecf700f0168fc4db7fd1aad2a75a60eb07 Mon Sep 17 00:00:00 2001 From: Abhijeet <129729795+luciferlinx101@users.noreply.github.com> Date: Thu, 17 Aug 2023 22:21:28 +0530 Subject: [PATCH 02/31] List File S3 (#1075) * List File S3 * Unit Test Added --- superagi/helper/s3_helper.py | 36 +++++++++++++++-------- superagi/tools/file/list_files.py | 5 ++++ tests/unit_tests/helper/test_s3_helper.py | 26 ++++++++++++++++ 3 files changed, 55 insertions(+), 12 deletions(-) diff --git a/superagi/helper/s3_helper.py b/superagi/helper/s3_helper.py index 2669b77ed..27738b1e9 100644 --- a/superagi/helper/s3_helper.py +++ b/superagi/helper/s3_helper.py @@ -8,8 +8,9 @@ from urllib.parse import unquote import json + class S3Helper: - def __init__(self, bucket_name = get_config("BUCKET_NAME")): + def __init__(self, bucket_name=get_config("BUCKET_NAME")): """ Initialize the S3Helper class. Using the AWS credentials from the configuration file, create a boto3 client. @@ -83,7 +84,7 @@ def get_json_file(self, path): """ try: obj = self.s3.get_object(Bucket=self.bucket_name, Key=path) - s3_response = obj['Body'].read().decode('utf-8') + s3_response = obj['Body'].read().decode('utf-8') return json.loads(s3_response) except: raise HTTPException(status_code=500, detail="AWS credentials not found. Check your configuration.") @@ -107,32 +108,43 @@ def delete_file(self, path): logger.info("File deleted from S3 successfully!") except: raise HTTPException(status_code=500, detail="AWS credentials not found. Check your configuration.") - + def upload_file_content(self, content, file_path): try: self.s3.put_object(Bucket=self.bucket_name, Key=file_path, Body=content) except: raise HTTPException(status_code=500, detail="AWS credentials not found. Check your configuration.") - - def get_download_url_of_resources(self,db_resources_arr): + + def get_download_url_of_resources(self, db_resources_arr): s3 = boto3.client( 's3', aws_access_key_id=get_config("AWS_ACCESS_KEY_ID"), aws_secret_access_key=get_config("AWS_SECRET_ACCESS_KEY"), ) - response_obj={} + response_obj = {} for db_resource in db_resources_arr: response = self.s3.get_object(Bucket=get_config("BUCKET_NAME"), Key=db_resource.path) content = response["Body"].read() bucket_name = get_config("INSTAGRAM_TOOL_BUCKET_NAME") - file_name=db_resource.path.split('/')[-1] - file_name=''.join(char for char in file_name if char != "`") - object_key=f"public_resources/run_id{db_resource.agent_execution_id}/{file_name}" + file_name = db_resource.path.split('/')[-1] + file_name = ''.join(char for char in file_name if char != "`") + object_key = f"public_resources/run_id{db_resource.agent_execution_id}/{file_name}" s3.put_object(Bucket=bucket_name, Key=object_key, Body=content) file_url = f"https://{bucket_name}.s3.amazonaws.com/{object_key}" - resource_execution_id=db_resource.agent_execution_id + resource_execution_id = db_resource.agent_execution_id if resource_execution_id in response_obj: response_obj[resource_execution_id].append(file_url) else: - response_obj[resource_execution_id]=[file_url] - return response_obj \ No newline at end of file + response_obj[resource_execution_id] = [file_url] + return response_obj + + def list_files_from_s3(self, file_path): + file_path = "resources" + file_path + logger.info(f"Listing files from s3 with prefix: {file_path}") + response = self.s3.list_objects_v2(Bucket=get_config("BUCKET_NAME"), Prefix=file_path) + + if 'Contents' in response: + file_list = [obj['Key'] for obj in response['Contents']] + return file_list + + raise Exception(f"Error listing files from s3") diff --git a/superagi/tools/file/list_files.py b/superagi/tools/file/list_files.py index 5f2414329..7290e53db 100644 --- a/superagi/tools/file/list_files.py +++ b/superagi/tools/file/list_files.py @@ -4,8 +4,11 @@ from pydantic import BaseModel, Field from superagi.helper.resource_helper import ResourceHelper +from superagi.helper.s3_helper import S3Helper from superagi.tools.base_tool import BaseTool from superagi.models.agent import Agent +from superagi.types.storage_types import StorageType +from superagi.config.config import get_config class ListFileInput(BaseModel): @@ -52,6 +55,8 @@ def _execute(self): return input_files #+ output_files def list_files(self, directory): + if StorageType.get_storage_type(get_config("STORAGE_TYPE", StorageType.FILE.value)) == StorageType.S3: + return S3Helper().list_files_from_s3(directory) found_files = [] for root, dirs, files in os.walk(directory): for file in files: diff --git a/tests/unit_tests/helper/test_s3_helper.py b/tests/unit_tests/helper/test_s3_helper.py index bceb5d67f..d476c7a7c 100644 --- a/tests/unit_tests/helper/test_s3_helper.py +++ b/tests/unit_tests/helper/test_s3_helper.py @@ -102,3 +102,29 @@ def test_delete_file_fail(s3helper_object): s3helper_object.s3.delete_object = MagicMock(side_effect=Exception()) with pytest.raises(HTTPException): s3helper_object.delete_file('path') + + +def test_list_files_from_s3(s3helper_object): + s3helper_object.s3.list_objects_v2 = MagicMock(return_value={ + 'Contents': [{'Key': 'path/to/file1.txt'}, {'Key': 'path/to/file2.jpg'}] + }) + + file_list = s3helper_object.list_files_from_s3('path/to/') + + assert len(file_list) == 2 + assert 'path/to/file1.txt' in file_list + assert 'path/to/file2.jpg' in file_list + + +def test_list_files_from_s3_no_contents(s3helper_object): + s3helper_object.s3.list_objects_v2 = MagicMock(return_value={}) + + with pytest.raises(Exception): + s3helper_object.list_files_from_s3('path/to/') + + +def test_list_files_from_s3_raises_exception(s3helper_object): + s3helper_object.s3.list_objects_v2 = MagicMock(side_effect=Exception("An error occurred")) + + with pytest.raises(Exception): + s3helper_object.list_files_from_s3('path/to/') From 9db16b356a96bf9abf7709b9ca16270b32bd9e3e Mon Sep 17 00:00:00 2001 From: Fluder-Paradyne <121793617+Fluder-Paradyne@users.noreply.github.com> Date: Fri, 18 Aug 2023 13:29:26 +0530 Subject: [PATCH 03/31] frontend fixes (#1078) --- gui/pages/Content/APM/ApmDashboard.js | 4 ++-- gui/pages/Content/Toolkits/ToolkitWorkspace.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gui/pages/Content/APM/ApmDashboard.js b/gui/pages/Content/APM/ApmDashboard.js index bd2dd50cb..314ddc915 100644 --- a/gui/pages/Content/APM/ApmDashboard.js +++ b/gui/pages/Content/APM/ApmDashboard.js @@ -294,7 +294,7 @@ export default function ApmDashboard() {
{(showToolTip && toolTipIndex === i) &&
{run.tools_used.slice(3).map((tool,index) => -
{tool}
+
{tool}
)}
}
setToolTipState(true,i)} onMouseLeave={() => setToolTipState(false,i)}> @@ -420,4 +420,4 @@ export default function ApmDashboard() {
); -} \ No newline at end of file +} diff --git a/gui/pages/Content/Toolkits/ToolkitWorkspace.js b/gui/pages/Content/Toolkits/ToolkitWorkspace.js index 104add0a0..8356a1eb6 100644 --- a/gui/pages/Content/Toolkits/ToolkitWorkspace.js +++ b/gui/pages/Content/Toolkits/ToolkitWorkspace.js @@ -116,7 +116,6 @@ export default function ToolkitWorkspace({env, toolkitDetails, internalId}) { }, [internalId]); return (<> - '
From 10abe9e43deed57b04a92f53fd5b36c90d5e9461 Mon Sep 17 00:00:00 2001 From: Maverick-F35 <138012351+Maverick-F35@users.noreply.github.com> Date: Fri, 18 Aug 2023 13:34:51 +0530 Subject: [PATCH 04/31] fixed api_bug (#1081) --- superagi/controllers/api/agent.py | 8 +++++--- superagi/worker.py | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/superagi/controllers/api/agent.py b/superagi/controllers/api/agent.py index a71e60a8f..4f4da0843 100644 --- a/superagi/controllers/api/agent.py +++ b/superagi/controllers/api/agent.py @@ -168,9 +168,9 @@ def update_agent(agent_id: int, agent_with_config: AgentConfigUpdateExtInput,api if project.organisation_id!=organisation.id: raise HTTPException(status_code=404, detail="Agent not found") - db_execution=AgentExecution.get_execution_by_agent_id_and_status(db.session, agent_id, "RUNNING") - if db_execution is not None: - raise HTTPException(status_code=409, detail="Agent is already running,please pause and then update") + # db_execution=AgentExecution.get_execution_by_agent_id_and_status(db.session, agent_id, "RUNNING") + # if db_execution is not None: + # raise HTTPException(status_code=409, detail="Agent is already running,please pause and then update") db_schedule=AgentSchedule.find_by_agent_id(db.session, agent_id) if db_schedule is not None: @@ -295,9 +295,11 @@ def resume_agent_runs(agent_id:int,execution_state_change_input:ExecutionStateCh db_execution_arr=AgentExecution.get_all_executions_by_status_and_agent_id(db.session, agent.id, execution_state_change_input, "PAUSED") for ind_execution in db_execution_arr: ind_execution.status="RUNNING" + execute_agent.delay(ind_execution.id, datetime.now()) db.session.commit() db.session.flush() + return { "result":"success" } diff --git a/superagi/worker.py b/superagi/worker.py index b6e5ea231..bf5e43e29 100644 --- a/superagi/worker.py +++ b/superagi/worker.py @@ -36,10 +36,10 @@ } app.conf.beat_schedule = beat_schedule -@event.listens_for(AgentExecution.status, "set") -def agent_status_change(target, val,old_val,initiator): - if get_config("IN_TESTING",False): - webhook_callback.delay(target.id,val,old_val) +# @event.listens_for(AgentExecution.status, "set") +# def agent_status_change(target, val,old_val,initiator): +# if not get_config("IN_TESTING",False): +# webhook_callback.delay(target.id,val,old_val) @app.task(name="initialize-schedule-agent", autoretry_for=(Exception,), retry_backoff=2, max_retries=5) From 303a65b349b88d747006935ecf6c1cc41565af82 Mon Sep 17 00:00:00 2001 From: BoundlessAsura <122777244+boundless-asura@users.noreply.github.com> Date: Fri, 18 Aug 2023 18:22:36 +0530 Subject: [PATCH 05/31] fix (#1085) --- superagi/controllers/api/agent.py | 4 ++-- superagi/models/toolkit.py | 4 ++-- tests/unit_tests/models/test_toolkit.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/superagi/controllers/api/agent.py b/superagi/controllers/api/agent.py index 4f4da0843..5230a2776 100644 --- a/superagi/controllers/api/agent.py +++ b/superagi/controllers/api/agent.py @@ -57,7 +57,7 @@ def create_agent_with_config(agent_with_config: AgentConfigExtInput, api_key: str = Security(validate_api_key), organisation:Organisation = Depends(get_organisation_from_api_key)): project=Project.find_by_org_id(db.session, organisation.id) try: - tools_arr=Toolkit.get_tool_and_toolkit_arr(db.session,agent_with_config.tools) + tools_arr=Toolkit.get_tool_and_toolkit_arr(db.session,organisation.id,agent_with_config.tools) except Exception as e: raise HTTPException(status_code=404, detail=str(e)) @@ -177,7 +177,7 @@ def update_agent(agent_id: int, agent_with_config: AgentConfigUpdateExtInput,api raise HTTPException(status_code=409, detail="Agent is already scheduled,cannot update") try: - tools_arr=Toolkit.get_tool_and_toolkit_arr(db.session,agent_with_config.tools) + tools_arr=Toolkit.get_tool_and_toolkit_arr(db.session,organisation.id,agent_with_config.tools) except Exception as e: raise HTTPException(status_code=404,detail=str(e)) diff --git a/superagi/models/toolkit.py b/superagi/models/toolkit.py index 5a9c0a0e9..9246111a1 100644 --- a/superagi/models/toolkit.py +++ b/superagi/models/toolkit.py @@ -140,12 +140,12 @@ def fetch_tool_ids_from_toolkit(cls, session, toolkit_ids): return agent_toolkit_tools @classmethod - def get_tool_and_toolkit_arr(cls, session, agent_config_tools_arr: list): + def get_tool_and_toolkit_arr(cls, session, organisation_id :int,agent_config_tools_arr: list): from superagi.models.tool import Tool toolkits_arr= set() tools_arr= set() for tool_obj in agent_config_tools_arr: - toolkit=session.query(Toolkit).filter(Toolkit.name == tool_obj["name"].strip()).first() + toolkit=session.query(Toolkit).filter(Toolkit.name == tool_obj["name"].strip(), Toolkit.organisation_id == organisation_id).first() if toolkit is None: raise Exception("One or more of the Tool(s)/Toolkit(s) does not exist.") toolkits_arr.add(toolkit.id) diff --git a/tests/unit_tests/models/test_toolkit.py b/tests/unit_tests/models/test_toolkit.py index 339c970c9..297ef8716 100644 --- a/tests/unit_tests/models/test_toolkit.py +++ b/tests/unit_tests/models/test_toolkit.py @@ -259,7 +259,7 @@ def test_get_tool_and_toolkit_arr_with_nonexistent_toolkit(): # Use a context manager to capture the raised exception and its message with pytest.raises(Exception) as exc_info: - Toolkit.get_tool_and_toolkit_arr(session, agent_config_tools_arr) + Toolkit.get_tool_and_toolkit_arr(session,1, agent_config_tools_arr) # Assert that the expected error message is contained within the raised exception message expected_error_message = "One or more of the Tool(s)/Toolkit(s) does not exist." From 5227806f7cbb273f9a8c7852381da7bd4512781c Mon Sep 17 00:00:00 2001 From: Fluder-Paradyne <121793617+Fluder-Paradyne@users.noreply.github.com> Date: Fri, 18 Aug 2023 19:54:25 +0530 Subject: [PATCH 06/31] api fix (#1086) --- superagi/models/toolkit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/superagi/models/toolkit.py b/superagi/models/toolkit.py index 9246111a1..1707d9810 100644 --- a/superagi/models/toolkit.py +++ b/superagi/models/toolkit.py @@ -151,7 +151,8 @@ def get_tool_and_toolkit_arr(cls, session, organisation_id :int,agent_config_too toolkits_arr.add(toolkit.id) if tool_obj.get("tools"): for tool_name_str in tool_obj["tools"]: - tool_db_obj=session.query(Tool).filter(Tool.name == tool_name_str.strip()).first() + tool_db_obj = session.query(Tool).filter(Tool.name == tool_name_str.strip(), + Tool.toolkit_id == toolkit.id).first() if tool_db_obj is None: raise Exception("One or more of the Tool(s)/Toolkit(s) does not exist.") From ccc108ff6815879ce6423bd45ed5cc5724b28446 Mon Sep 17 00:00:00 2001 From: Akshat Jain <92881074+Akki-jain@users.noreply.github.com> Date: Fri, 18 Aug 2023 20:10:08 +0530 Subject: [PATCH 07/31] Added docs, video, new contributors (#1089) --- README.MD | 48 ++++++++++++++++++------------------------------ 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/README.MD b/README.MD index b11a7b514..16bb5a6f5 100644 --- a/README.MD +++ b/README.MD @@ -12,9 +12,10 @@

- + - + +

@@ -75,14 +76,15 @@


-## 📽 Demo Video Showcasing SuperCoder (A SuperAGI agent template) +## 📽 Setting Up SuperAGI using Docker Hub -[Demo Video](https://github.com/Akki-jain/test/assets/92881074/bb18407a-b6b2-4a9f-9419-ec73ffacd2f8) +

+ +

-This video demonstrates how SuperCoder can be used to create simple applications like a personal finance calculator.

-
Not sure how to setup? Learn here +
Not sure how to setup? Learn here

@@ -94,31 +96,18 @@ This video demonstrates how SuperCoder can be used to create simple applications - Graphical User Interface - Action Console - Multiple Vector DBs -- Multi-Modal Agents - Agent Trajectory Fine-Tuning -- Performance Telemetry -- Optimized Token Usage +- Performance Monitoring - Agent Memory Storage -- Looping Detection Heuristics -- Concurrent Agents - Resource Manager ## 🛠 Tools -Slack Email Twitter Jira File Manager Google Search Dall-E Github Web Interaction Zapier Instagram Trello Google Analytics Duckduckgo Discord +Twitter Coding Tool Instagram Knowledge Search Email Jira File Manager Google Search Dall-E Github Web Interaction Duckduckgo Google Calendar Google Calendar Serp API Searx Web Scraper Notion Apollo ## 💻 Screenshots -[//]: # (**CLI View**) - -[//]: # (![CLI](https://superagi.co/wp-content/uploads/2023/05/CLI.png)) - -**GUI** -

- - SuperAGI logo - SuperAGI logo @@ -126,7 +115,7 @@ This video demonstrates how SuperCoder can be used to create simple applications ## 🛣 Roadmap -[Click here to checkout the latest roadmap 🔗](https://github.com/users/TransformerOptimus/projects/1) +[Click here to checkout the latest roadmap 🔗](https://github.com/users/TransformerOptimus/projects/5/views/1) @@ -187,14 +176,6 @@ This video demonstrates how SuperCoder can be used to create simple applications ## ⚠️ Under Development! This project is under active development and may still have issues. We appreciate your understanding and patience. If you encounter any problems, please first check the open issues. If your issue is not listed, kindly create a new issue detailing the error or problem you experienced. Thank you for your support! -## 📽 Curated Videos - -|-| -|--| -|[GitHub Codespaces](https://youtu.be/iSPHZ1onQ44)| -|[Windows/MacOS/Linux](https://youtu.be/Unj5NLNTkLY)| -[GUI Walkthrough](https://youtu.be/7FXESG6BOgw)| -[Research Usecase](https://youtu.be/LfZ6T8XP-Q0)| ## 👩‍💻 Contributors [![TransformerOptimus](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/133493246?v=4&w=50&h=50&mask=circle)](https://github.com/TransformerOptimus) [![Cptsnowcrasher](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/133322218?v=4&w=50&h=50&mask=circle)](https://github.com/Cptsnowcrasher) [![vectorcrow](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/133646556?v=4&w=50&h=50&mask=circle)](https://github.com/vectorcrow) [![Akki-jain](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/92881074?v=4&w=50&h=50&mask=circle)](https://github.com/Akki-jain) [![Autocop-Agent](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/129729746?v=4&w=50&h=50&mask=circle)](https://github.com/Autocop-Agent)[![COLONAYUSH](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/60507126?v=4&w=50&h=50&mask=circle)](https://github.com/COLONAYUSH)[![luciferlinx101](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/129729795?v=4&w=50&h=50&mask=circle)](https://github.com/luciferlinx101)[![mukundans89](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/101278493?v=4&w=50&h=50&mask=circle)](https://github.com/mukundans89)[![Fluder-Paradyne](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/121793617?v=4&w=50&h=50&mask=circle)](https://github.com/Fluder-Paradyne)[![nborthy](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/101320057?v=4&w=50&h=50&mask=circle)](https://github.com/nborthy)[![nihirr](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/122777244?v=4&w=50&h=50&mask=circle)](https://github.com/nihirr)[![Tarraann](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/97586318?v=4&w=50&h=50&mask=circle)](https://github.com/Tarraann)[![neelayan7](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/43145646?v=4&w=50&h=50&mask=circle)](https://github.com/neelayan7)[![Arkajit-Datta](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/61142632?v=4&w=50&h=50&mask=circle)](https://github.com/Arkajit-Datta)[![guangchen811](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/103159823?v=4&w=50&h=50&mask=circle)](https://github.com/guangchen811)[![juanfpo96](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/14787156?v=4&w=50&h=50&mask=circle)](https://github.com/juanfpo96)[![iskandarreza](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/32027019?v=4&w=50&h=50&mask=circle)](https://github.com/iskandarreza)[![jpenalbae](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/8380459?v=4&w=50&h=50&mask=circle)](https://github.com/jpenalbae)[![pallasite99](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/26508636?v=4&w=50&h=50&mask=circle)](https://github.com/pallasite99)[![xutpuu](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/11964505?v=4&w=50&h=50&mask=circle)](https://github.com/xutpuu)[![alexkreidler](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/11166947?v=4&w=50&h=50&mask=circle)](https://github.com/alexkreidler)[![hanhyalex123](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/100895608?v=4&w=50&h=50&mask=circle)](https://github.com/hanhyalex123)[![ps4vs](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/91535358?v=4&w=50&h=50&mask=circle)](https://github.com/ps4vs)[![eltociear](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/22633385?v=4&w=50&h=50&mask=circle)](https://github.com/eltociear) @@ -214,6 +195,13 @@ This project is under active development and may still have issues. We appreciat [![JPDucky](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/34105363?v=4&w=50&h=50&mask=circle)](https://github.com/JPDucky) [![Vibhusha22](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/128478691?v=4&w=50&h=50&mask=circle)](https://github.com/Vibhusha22) [![ai-akuma](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/7444521?v=4&w=50&h=50&mask=circle)](https://github.com/ai-akuma) +[![rounak610](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/81288115?v=4&w=50&h=50&mask=circle)](https://github.com/rounak610) +[![AdarshJha619](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/53672264?v=4&w=50&h=50&mask=circle)](https://github.com/AdarshJha619) +[![ResoluteStoic](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/105219157?v=4&w=50&h=50&mask=circle)](https://github.com/ResoluteStoic) +[![JohnHunt999](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/137149331?v=4&w=50&h=50&mask=circle)](https://github.com/JohnHunt999) +[![Maverick-F35](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/138012351?v=4&w=50&h=50&mask=circle)](https://github.com/Maverick-F359) +[![PaulRBerg](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/8782666?v=4&w=50&h=50&mask=circle)](https://github.com/PaulRBerg) +[![jorgectf](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/46056498?v=4&w=50&h=50&mask=circle)](https://github.com/jorgectf)

Back to top

From c990e167cdd8033aa910ae0a2f0d728aed4c819c Mon Sep 17 00:00:00 2001 From: sayan1101 <139119661+sayan1101@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:07:26 +0530 Subject: [PATCH 08/31] Toolmarketplace (#1098) * fixed toolconfig update when installed from marketplace * toolconfig and toolkit test fix --- superagi/controllers/toolkit.py | 4 ++-- tests/unit_tests/controllers/test_toolkit.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/superagi/controllers/toolkit.py b/superagi/controllers/toolkit.py index a61677bef..214a5b059 100644 --- a/superagi/controllers/toolkit.py +++ b/superagi/controllers/toolkit.py @@ -157,7 +157,7 @@ def install_toolkit_from_marketplace(toolkit_name: str, folder_name=tool['folder_name'], class_name=tool['class_name'], file_name=tool['file_name'], toolkit_id=db_toolkit.id) for config in toolkit['configs']: - ToolConfig.add_or_update(session=db.session, toolkit_id=db_toolkit.id, key=config['key'], value=config['value']) + ToolConfig.add_or_update(session=db.session, toolkit_id=db_toolkit.id, key=config['key'], value=config['value'], key_type = config['key_type'], is_secret = config['is_secret'], is_required = config['is_required']) return {"message": "ToolKit installed successfully"} @@ -364,4 +364,4 @@ def update_toolkit(toolkit_name: str, organisation: Organisation = Depends(get_u for tool_config_key in marketplace_toolkit["configs"]: ToolConfig.add_or_update(db.session, toolkit_id=update_toolkit.id, - key=tool_config_key["key"]) + key=tool_config_key["key"], key_type = tool_config_key['key_type'], is_secret = tool_config_key['is_secret'], is_required = tool_config_key['is_required']) diff --git a/tests/unit_tests/controllers/test_toolkit.py b/tests/unit_tests/controllers/test_toolkit.py index 0694c7666..68aef8c88 100644 --- a/tests/unit_tests/controllers/test_toolkit.py +++ b/tests/unit_tests/controllers/test_toolkit.py @@ -7,6 +7,7 @@ from superagi.models.organisation import Organisation from superagi.models.tool import Tool from superagi.models.tool_config import ToolConfig +from superagi.types.key_type import ToolConfigKeyType from superagi.models.toolkit import Toolkit client = TestClient(app) @@ -86,11 +87,18 @@ def mock_toolkit_details(): "configs": [ { "key": "config_key_1", - "value": "config_value_1" + "value": "config_value_1", + 'key_type': ToolConfigKeyType.STRING, + 'is_secret': True, + 'is_required': False }, { "key": "config_key_2", - "value": "config_value_2" + "value": "config_value_2", + 'key_type': ToolConfigKeyType.FILE, + 'is_secret': True, + 'is_required': False + } ] } From f558f09c41babd29b7201498f5c3d41edad20ee5 Mon Sep 17 00:00:00 2001 From: Rounak Bhatia Date: Wed, 23 Aug 2023 17:03:30 +0530 Subject: [PATCH 09/31] schedule agent fix (#1105) * schedule agent fix --------- Co-authored-by: Rounak Bhatia --- superagi/agent/tool_builder.py | 6 +++--- superagi/jobs/scheduling_executor.py | 15 +++++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/superagi/agent/tool_builder.py b/superagi/agent/tool_builder.py index eb2194468..0d35f5591 100644 --- a/superagi/agent/tool_builder.py +++ b/superagi/agent/tool_builder.py @@ -81,7 +81,7 @@ def build_tool(self, tool: Tool): return new_object def set_default_params_tool(self, tool, agent_config, agent_execution_config, model_api_key: str, - resource_summary: str = ""): + resource_summary: str = "",memory=None): """ Set the default parameters for the tools. @@ -113,9 +113,9 @@ def set_default_params_tool(self, tool, agent_config, agent_execution_config, mo agent_execution_id=self.agent_execution_id) if hasattr(tool, 'tool_response_manager'): tool.tool_response_manager = ToolResponseQueryManager(session=self.session, - agent_execution_id=self.agent_execution_id) + agent_execution_id=self.agent_execution_id,memory=memory) if tool.name == "QueryResourceTool": tool.description = tool.description.replace("{summary}", resource_summary) - return tool + return tool \ No newline at end of file diff --git a/superagi/jobs/scheduling_executor.py b/superagi/jobs/scheduling_executor.py index e0025725f..2267beb6a 100644 --- a/superagi/jobs/scheduling_executor.py +++ b/superagi/jobs/scheduling_executor.py @@ -49,16 +49,11 @@ def execute_scheduled_agent(self, agent_id: int, name: str): session.add(db_agent_execution) session.commit() - goal_value = session.query(AgentConfiguration.value).filter(AgentConfiguration.agent_id == agent_id).filter(AgentConfiguration.key == 'goal').first()[0] - instruction_value = session.query(AgentConfiguration.value).filter(AgentConfiguration.agent_id == agent_id).filter(AgentConfiguration.key == 'instruction').first()[0] - - agent_execution_configs = { - "goal": goal_value, - "instruction": instruction_value - } - - - AgentExecutionConfiguration.add_or_update_agent_execution_config(session= session, execution=db_agent_execution,agent_execution_configs=agent_execution_configs) + agent_execution_id = db_agent_execution.id + agent_configurations = session.query(AgentConfiguration).filter(AgentConfiguration.agent_id == agent_id).all() + for agent_config in agent_configurations: + agent_execution_config = AgentExecutionConfiguration(agent_execution_id=agent_execution_id, key=agent_config.key, value=agent_config.value) + session.add(agent_execution_config) organisation = agent.get_agent_organisation(session) From 9da77f19de3068f5ebcb2fe392acce20087cee4a Mon Sep 17 00:00:00 2001 From: Fluder-Paradyne <121793617+Fluder-Paradyne@users.noreply.github.com> Date: Thu, 24 Aug 2023 12:43:52 +0530 Subject: [PATCH 10/31] partial revert 1105 (#1110) --- superagi/agent/tool_builder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superagi/agent/tool_builder.py b/superagi/agent/tool_builder.py index 0d35f5591..633ac65ee 100644 --- a/superagi/agent/tool_builder.py +++ b/superagi/agent/tool_builder.py @@ -81,7 +81,7 @@ def build_tool(self, tool: Tool): return new_object def set_default_params_tool(self, tool, agent_config, agent_execution_config, model_api_key: str, - resource_summary: str = "",memory=None): + resource_summary: str = ""): """ Set the default parameters for the tools. @@ -113,7 +113,7 @@ def set_default_params_tool(self, tool, agent_config, agent_execution_config, mo agent_execution_id=self.agent_execution_id) if hasattr(tool, 'tool_response_manager'): tool.tool_response_manager = ToolResponseQueryManager(session=self.session, - agent_execution_id=self.agent_execution_id,memory=memory) + agent_execution_id=self.agent_execution_id) if tool.name == "QueryResourceTool": tool.description = tool.description.replace("{summary}", resource_summary) From 65f3e5381998d82cbc590a858aa3d1f1b955c40a Mon Sep 17 00:00:00 2001 From: Abhijeet <129729795+luciferlinx101@users.noreply.github.com> Date: Thu, 24 Aug 2023 17:24:37 +0530 Subject: [PATCH 11/31] Delay change (#1107) * Delay Changed * Updated Feed Polling Time --- gui/pages/Content/Agents/ActivityFeed.js | 2 +- superagi/jobs/agent_executor.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/pages/Content/Agents/ActivityFeed.js b/gui/pages/Content/Agents/ActivityFeed.js index 4dbfb24f5..02bfb44e9 100644 --- a/gui/pages/Content/Agents/ActivityFeed.js +++ b/gui/pages/Content/Agents/ActivityFeed.js @@ -19,7 +19,7 @@ export default function ActivityFeed({selectedRunId, selectedView, setFetchedDat useEffect(() => { const interval = window.setInterval(function () { fetchFeeds(); - }, 10000); + }, 5000); return () => clearInterval(interval); }, [selectedRunId]); diff --git a/superagi/jobs/agent_executor.py b/superagi/jobs/agent_executor.py index e5ea17e09..8cc019aae 100644 --- a/superagi/jobs/agent_executor.py +++ b/superagi/jobs/agent_executor.py @@ -87,7 +87,7 @@ def execute_next_step(self, agent_execution_id): logger.info("Agent Execution is completed or waiting for permission") session.close() return - superagi.worker.execute_agent.apply_async((agent_execution_id, datetime.now()), countdown=10) + superagi.worker.execute_agent.apply_async((agent_execution_id, datetime.now()), countdown=2) # superagi.worker.execute_agent.delay(agent_execution_id, datetime.now()) finally: session.close() From dff037f92d1333a03a43ad40fe26c78415ffd012 Mon Sep 17 00:00:00 2001 From: Fluder-Paradyne <121793617+Fluder-Paradyne@users.noreply.github.com> Date: Thu, 24 Aug 2023 18:17:55 +0530 Subject: [PATCH 12/31] added expose 8001 (#1116) --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 250f94a12..420f68cad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,3 +33,5 @@ COPY --from=compile-image /app /app COPY --from=compile-image /root/nltk_data /root/nltk_data ENV PATH="/opt/venv/bin:$PATH" + +EXPOSE 8001 \ No newline at end of file From 447a2509ba63539b891048bd952dff4f14db8e67 Mon Sep 17 00:00:00 2001 From: Kalki <97698934+jedan2506@users.noreply.github.com> Date: Fri, 25 Aug 2023 13:54:41 +0530 Subject: [PATCH 13/31] Models Frontend Changes (#1119) --- gui/public/images/google_analytics_logo.png | Bin 0 -> 19215 bytes gui/utils/utils.js | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 gui/public/images/google_analytics_logo.png diff --git a/gui/public/images/google_analytics_logo.png b/gui/public/images/google_analytics_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..d06bf018a3d60396c95cef70ec6227e1ec75c79e GIT binary patch literal 19215 zcmeFYXIv9q*Ec$Vic&;HL_t76iXcU)f)JD@Af3=5AiaxpfdnrF1O%iDNbkM(5(KG& z^xmX*LJuY7op{~PbDsBi&UrtbkLN=sGm|}gufEoQ%}$V-iaaG59T@-slnSq8Gys4Y zJS7IMUID+3JV(yKuWN5#>A3&^IW^%!1SEXF3*IDh(U5-$6#u@z0bX3PdZGLR0LsG2 zF{YORKrvH6=7p9g(a!9(@8&i}s~2k$94zljvg|hU=QcJiHypJmZ_-`5bn~uS$Dnte z0NhYbzTJD2h}46j^Vo%ffp6vogPWY%jjsWwc8Nt6HrBCo=-tht6P}9lcOjo$=Dg<7 z-#>rp>8Z2}`us(74eb!w6Wp8M^Cil8ZVih}EDHkwsXQ5wk1T1Bw$x8o!DI9dA^`Ba z#R8tHy}Se-6+eRqscSdEBPTO~XEqt|@c$3~|3(`5R{{P9h2Batd}ZdnbW9?OZTJR} zElC}v-K6@9s)f0s6;-<@#VJh4!|4~3;^i$xw@JNrn!D~Wsk=8sywJ%45XM4FS`tf-0@DCA4Tr*!87 zW9Z#st!!uA(D)MD{XHFXD#$|@%#+cCi4Gk?Mj`|$EXOl;+aA5+C*bqOChkd198E%Z_PaTQ8&5*Mr`52nJT##>gIr(yUTe6^s*zpf(q2;!7lIf z0)LVejd%F@p8JiH67GUbS6)>xA`gEEFMCI$alx%J}i^{a=t zA&kobatKQ|Y0qW496*!4nz^||s}$Gt(ku=M-Tyf}!=Y-4nCQR5|Ip7=9`ttjwHOze zn#aDpDjPEw?%?G-X+`75q zmj=cUKe&S7!t8xFHk_)>LKvDW=`5fl>ixP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CFDhre`?FI+FNHd85_6`MExn~(*JxsFg_77i?8BiR{Pxf7;4n^<4D-?}}Y4@0&M$=A59?B(IA%(r(^5W^nuVlBs{PH!QCa zT=uuMbjc3mA952c=RQ~4!?!lxuplPTYWgS7#@_^PN#0 zSlC#9W$K4)=@{pIksGuBoSnhVbhR@_-7WrJ{{Pcyz4}`7j~^`6m0@CVI&X9OhwSo_ z_DTDA%fD}V?5idsup0xJuk0m`PR~zkn zGW*%us_KrVo6Gk{iEo&EQcLvWseVbRu6HL^Rqop~t);VNpVSj|)@KiO&PsiLv(o&b z!lEs)u?4nOw^tpQ*?0EvH4X+16DEdROP^kAT03=V^xRLo-?#~GJ$=5?fBx^|4w3sN ztu+Pq3;XB&`g!X3C*Oa<7k6D-w)yG1iu$!|e|_YSOP*++d-i(6tguZ{svTSH@80+( z(|he#&$Z<<`Wl_4a5FM!tSHXR3D5Qq^ZS?e^~?XI8{^x`*v@{Mx>a^!KSO|@D5J)b zd3Vo6Z~j@Nz3R{Mnpd74EX)h8{(i1BMV1k`@%Kz-&4-@Z6GR^}{@r$sRe@)Upfdw# qA9A}nGx9dl(PN6J9vT<^v)zw7w0}bUqCLP6XYh3Ob6Mw<&;$VMlc{L{ literal 0 HcmV?d00001 diff --git a/gui/utils/utils.js b/gui/utils/utils.js index a957ede64..b03e17698 100644 --- a/gui/utils/utils.js +++ b/gui/utils/utils.js @@ -25,7 +25,8 @@ const toolkitData = { 'Instagram Toolkit': '/images/instagram.png', 'Knowledge Search Toolkit': '/images/knowledeg_logo.png', 'Notion Toolkit': '/images/notion_logo.png', - 'ApolloToolkit': '/images/apollo_logo.png' + 'ApolloToolkit': '/images/apollo_logo.png', + 'Google Analytics Toolkit': '/images/google_analytics_logo.png' }; export const getUserTimezone = () => { From 83d65b24c81cff2f878ebf263503eb1dd7f0ea52 Mon Sep 17 00:00:00 2001 From: Fluder-Paradyne <121793617+Fluder-Paradyne@users.noreply.github.com> Date: Mon, 28 Aug 2023 13:38:34 +0530 Subject: [PATCH 14/31] latest safetensors breaking in macs (#1135) --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 53df4c440..5b1bcf00a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -111,6 +111,7 @@ requests-html==0.10.0 requests-oauthlib==1.3.1 requests-toolbelt==1.0.0 s3transfer==0.6.1 +safetensors==0.3.2 sgmllib3k==1.0.0 six==1.16.0 sniffio==1.3.0 From 7118e795e5bbce6d1b684e4843d30aa06a65623a Mon Sep 17 00:00:00 2001 From: Fluder-Paradyne <121793617+Fluder-Paradyne@users.noreply.github.com> Date: Tue, 29 Aug 2023 19:20:19 +0530 Subject: [PATCH 15/31] Release11 (#1144) Merged Dev -> Main Released v11 - Models Marketplace - SuperAGI APIs - Support for Weaviate DB - Tool Memory LTM - Google Analytics as External Tool - JSON support for Tool Configuration - Bug Fixes and Minor Enhancements. --- config_template.yaml | 2 + gui/pages/Content/APM/ApmDashboard.js | 2 +- gui/pages/Content/Agents/AgentCreate.js | 54 ++-- .../Content/Agents/AgentTemplatesList.js | 6 +- gui/pages/Content/Agents/AgentWorkspace.js | 2 +- gui/pages/Content/Marketplace/Market.js | 50 ++-- .../Content/Marketplace/Market.module.css | 2 +- gui/pages/Content/Marketplace/MarketAgent.js | 5 +- .../Content/Marketplace/MarketKnowledge.js | 4 +- gui/pages/Content/Marketplace/MarketTools.js | 5 +- gui/pages/Content/Models/AddModel.js | 17 ++ .../Content/Models/AddModelMarketPlace.js | 116 +++++++++ gui/pages/Content/Models/MarketModels.js | 57 +++++ gui/pages/Content/Models/ModelDetails.js | 41 +++ gui/pages/Content/Models/ModelForm.js | 177 +++++++++++++ gui/pages/Content/Models/ModelInfo.js | 33 +++ gui/pages/Content/Models/ModelMetrics.js | 91 +++++++ gui/pages/Content/Models/ModelTemplate.js | 48 ++++ gui/pages/Content/Models/Models.js | 36 +++ gui/pages/Content/Toolkits/AddTool.js | 1 - gui/pages/Dashboard/Content.js | 28 ++- gui/pages/Dashboard/Settings/Model.js | 218 +++++++--------- gui/pages/Dashboard/Settings/Settings.js | 41 ++- gui/pages/Dashboard/SideBar.js | 1 + gui/pages/_app.css | 195 +++++++++++++-- gui/pages/api/DashboardService.js | 47 +++- gui/public/images/google_palm_logo.svg | 9 + gui/public/images/huggingface_logo.svg | 9 + gui/public/images/icon_error.svg | 8 + gui/public/images/icon_info.svg | 8 + gui/public/images/marketplace_download.svg | 10 + gui/public/images/marketplace_logo.png | Bin 0 -> 707 bytes gui/public/images/models.svg | 3 + gui/public/images/open_in_new.svg | 3 + gui/public/images/openai_logo.svg | 9 + gui/public/images/plus.png | Bin 0 -> 344 bytes gui/public/images/replicate_logo.svg | 9 + gui/utils/utils.js | 20 ++ main.py | 8 + .../520aa6776347_create_models_config.py | 36 +++ .../5d5f801f28e7_create_model_table.py | 42 ++++ .../be1d922bf2ad_create_call_logs_table.py | 39 +++ requirements.txt | 1 + .../agent/agent_iteration_step_handler.py | 42 ++-- superagi/agent/agent_message_builder.py | 15 +- superagi/agent/agent_tool_step_handler.py | 19 +- superagi/agent/output_handler.py | 51 +++- superagi/agent/output_parser.py | 6 +- superagi/agent/prompts/initialize_tasks.txt | 1 - superagi/agent/queue_step_handler.py | 7 +- superagi/agent/tool_builder.py | 10 +- superagi/agent/workflow_seed.py | 9 +- superagi/apm/analytics_helper.py | 1 - superagi/apm/call_log_helper.py | 82 ++++++ superagi/controllers/agent_template.py | 53 ++-- superagi/controllers/api/agent.py | 16 +- superagi/controllers/models_controller.py | 131 ++++++++++ superagi/controllers/toolkit.py | 4 +- superagi/helper/github_helper.py | 5 +- superagi/helper/models_helper.py | 19 ++ superagi/helper/token_counter.py | 15 +- superagi/jobs/agent_executor.py | 33 ++- superagi/jobs/scheduling_executor.py | 2 + superagi/llms/hugging_face.py | 111 +++++++++ superagi/llms/llm_model_factory.py | 62 +++-- superagi/llms/replicate.py | 113 +++++++++ superagi/llms/utils/__init__.py | 0 .../llms/utils/huggingface_utils/__init__.py | 0 .../huggingface_utils/public_endpoints.py | 1 + .../llms/utils/huggingface_utils/tasks.py | 85 +++++++ superagi/models/agent.py | 3 +- superagi/models/agent_config.py | 29 +-- superagi/models/agent_execution_config.py | 3 +- superagi/models/call_logs.py | 36 +++ superagi/models/configuration.py | 29 ++- superagi/models/models.py | 230 +++++++++++++++++ superagi/models/models_config.py | 132 ++++++++++ .../workflows/iteration_workflow_step.py | 2 +- superagi/resource_manager/resource_manager.py | 2 +- superagi/resource_manager/resource_summary.py | 11 +- superagi/tools/code/write_code.py | 6 +- superagi/tools/code/write_spec.py | 6 +- superagi/tools/code/write_test.py | 6 +- superagi/tools/email/send_email.py | 9 +- superagi/tools/email/send_email_attachment.py | 6 +- superagi/tools/thinking/prompts/thinking.txt | 3 + superagi/tools/thinking/tools.py | 4 + superagi/tools/tool_response_query_manager.py | 12 +- superagi/types/model_source_types.py | 4 + superagi/vector_store/embedding/openai.py | 12 + superagi/vector_store/redis.py | 169 +++++++++++++ superagi/vector_store/vector_factory.py | 9 +- superagi/worker.py | 8 +- .../test_agent_iteration_step_handler.py | 4 +- .../agent/test_agent_message_builder.py | 12 +- .../agent/test_agent_tool_step_handler.py | 4 +- tests/unit_tests/agent/test_output_handler.py | 35 ++- tests/unit_tests/apm/test_call_log_helper.py | 79 ++++++ .../unit_tests/controllers/api/test_agent.py | 2 +- .../controllers/test_models_controller.py | 102 ++++++++ tests/unit_tests/helper/test_token_counter.py | 53 +++- tests/unit_tests/llms/test_hugging_face.py | 77 ++++++ tests/unit_tests/llms/test_model_factory.py | 89 ++++--- tests/unit_tests/llms/test_replicate.py | 63 +++++ .../models/test_agent_execution_config.py | 5 +- tests/unit_tests/models/test_call_logs.py | 44 ++++ tests/unit_tests/models/test_models.py | 234 ++++++++++++++++++ tests/unit_tests/models/test_models_config.py | 126 ++++++++++ .../unit_tests/tools/code/test_write_code.py | 3 + .../unit_tests/tools/code/test_write_spec.py | 3 + .../unit_tests/tools/code/test_write_test.py | 5 +- tests/unit_tests/vector_store/test_redis.py | 42 ++++ tools.json | 6 +- 113 files changed, 3634 insertions(+), 471 deletions(-) create mode 100644 gui/pages/Content/Models/AddModel.js create mode 100644 gui/pages/Content/Models/AddModelMarketPlace.js create mode 100644 gui/pages/Content/Models/MarketModels.js create mode 100644 gui/pages/Content/Models/ModelDetails.js create mode 100644 gui/pages/Content/Models/ModelForm.js create mode 100644 gui/pages/Content/Models/ModelInfo.js create mode 100644 gui/pages/Content/Models/ModelMetrics.js create mode 100644 gui/pages/Content/Models/ModelTemplate.js create mode 100644 gui/pages/Content/Models/Models.js create mode 100644 gui/public/images/google_palm_logo.svg create mode 100644 gui/public/images/huggingface_logo.svg create mode 100644 gui/public/images/icon_error.svg create mode 100644 gui/public/images/icon_info.svg create mode 100644 gui/public/images/marketplace_download.svg create mode 100644 gui/public/images/marketplace_logo.png create mode 100644 gui/public/images/models.svg create mode 100644 gui/public/images/open_in_new.svg create mode 100644 gui/public/images/openai_logo.svg create mode 100644 gui/public/images/plus.png create mode 100644 gui/public/images/replicate_logo.svg create mode 100644 migrations/versions/520aa6776347_create_models_config.py create mode 100644 migrations/versions/5d5f801f28e7_create_model_table.py create mode 100644 migrations/versions/be1d922bf2ad_create_call_logs_table.py create mode 100644 superagi/apm/call_log_helper.py create mode 100644 superagi/controllers/models_controller.py create mode 100644 superagi/helper/models_helper.py create mode 100644 superagi/llms/hugging_face.py create mode 100644 superagi/llms/replicate.py create mode 100644 superagi/llms/utils/__init__.py create mode 100644 superagi/llms/utils/huggingface_utils/__init__.py create mode 100644 superagi/llms/utils/huggingface_utils/public_endpoints.py create mode 100644 superagi/llms/utils/huggingface_utils/tasks.py create mode 100644 superagi/models/call_logs.py create mode 100644 superagi/models/models.py create mode 100644 superagi/models/models_config.py create mode 100644 tests/unit_tests/apm/test_call_log_helper.py create mode 100644 tests/unit_tests/controllers/test_models_controller.py create mode 100644 tests/unit_tests/llms/test_hugging_face.py create mode 100644 tests/unit_tests/llms/test_replicate.py create mode 100644 tests/unit_tests/models/test_call_logs.py create mode 100644 tests/unit_tests/models/test_models.py create mode 100644 tests/unit_tests/models/test_models_config.py create mode 100644 tests/unit_tests/vector_store/test_redis.py diff --git a/config_template.yaml b/config_template.yaml index fedd3b642..51c090dec 100644 --- a/config_template.yaml +++ b/config_template.yaml @@ -4,6 +4,8 @@ PINECONE_ENVIRONMENT: YOUR_PINECONE_ENVIRONMENT OPENAI_API_KEY: YOUR_OPEN_API_KEY PALM_API_KEY: YOUR_PALM_API_KEY +REPLICATE_API_TOKEN: YOUR_REPLICATE_API_TOKEN +HUGGING_API_TOKEN: YOUR_HUGGING_FACE_API_TOKEN # For locally hosted LLMs comment out the next line and uncomment the one after # to configure a local llm point your browser to 127.0.0.1:7860 and click on the model tab in text generation web ui. diff --git a/gui/pages/Content/APM/ApmDashboard.js b/gui/pages/Content/APM/ApmDashboard.js index 314ddc915..d56f12466 100644 --- a/gui/pages/Content/APM/ApmDashboard.js +++ b/gui/pages/Content/APM/ApmDashboard.js @@ -75,7 +75,7 @@ export default function ApmDashboard() { const fetchData = async () => { try { const [metricsResponse, agentsResponse, activeRunsResponse, toolsUsageResponse] = await Promise.all([getMetrics(), getAllAgents(), getActiveRuns(), getToolsUsage()]); - const models = ['gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-4-32k', 'google-palm-bison-001']; + const models = ['gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-4-32k', 'google-palm-bison-001', 'replicate-llama13b-v2-chat']; assignDefaultDataPerModel(metricsResponse.data.agent_details.model_metrics, models); assignDefaultDataPerModel(metricsResponse.data.tokens_details.model_metrics, models); diff --git a/gui/pages/Content/Agents/AgentCreate.js b/gui/pages/Content/Agents/AgentCreate.js index 3f7f62b30..4d2849042 100644 --- a/gui/pages/Content/Agents/AgentCreate.js +++ b/gui/pages/Content/Agents/AgentCreate.js @@ -10,8 +10,8 @@ import { getLlmModels, updateExecution, uploadFile, - getAgentDetails, addAgentRun, - getAgentWorkflows + getAgentDetails, addAgentRun, fetchModels, + getAgentWorkflows, validateOrAddModels } from "@/pages/api/DashboardService"; import { formatBytes, @@ -56,6 +56,7 @@ export default function AgentCreate({ const [searchValue, setSearchValue] = useState(''); const [showButton, setShowButton] = useState(false); const [showPlaceholder, setShowPlaceholder] = useState(true); + const [modelsArray, setModelsArray] = useState(['gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k']); const constraintsArray = [ "If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.", @@ -68,8 +69,8 @@ export default function AgentCreate({ const [goals, setGoals] = useState(['Describe the agent goals here']); const [instructions, setInstructions] = useState(['']); - const [modelsArray, setModelsArray] = useState([]); - const [model, setModel] = useState(''); + const models = ['gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k'] + const [model, setModel] = useState(models[1]); const modelRef = useRef(null); const [modelDropdown, setModelDropdown] = useState(false); @@ -150,9 +151,9 @@ export default function AgentCreate({ }, [toolNames]); useEffect(() => { - getLlmModels() + fetchModels() .then((response) => { - const models = response.data || []; + const models = response.data.map(model => model.name) || []; const selected_model = localStorage.getItem("agent_model_" + String(internalId)) || ''; setModelsArray(models); if (models.length > 0 && !selected_model) { @@ -160,6 +161,7 @@ export default function AgentCreate({ } else { setModel(selected_model); } + console.log(response) }) .catch((error) => { console.error('Error fetching models:', error); @@ -350,8 +352,8 @@ export default function AgentCreate({ const handleModelSelect = (index) => { setLocalStorageValue("agent_model_" + String(internalId), modelsArray[index], setModel); - if (modelsArray[index] === "google-palm-bison-001") { - setAgentWorkflow("Fixed Task Queue") + if (modelsArray[index] === "google-palm-bison-001" || modelsArray[index] === "replicate-llama13b-v2-chat") { + setAgentType("Fixed Task Queue") } setModelDropdown(false); }; @@ -492,7 +494,7 @@ export default function AgentCreate({ return true; } - const handleAddAgent = () => { + const handleAddAgent = async () => { if (!validateAgentData(true)) { return; } @@ -869,6 +871,11 @@ export default function AgentCreate({ return false; } + const openModelMarket = () => { + openNewTab(-4, "Marketplace", "Marketplace", false); + localStorage.setItem('marketplace_tab', 'market_models'); + } + return (<>

@@ -941,13 +948,28 @@ export default function AgentCreate({ alt="expand-icon"/>
- {modelDropdown &&
- {modelsArray?.map((model, index) => ( -
handleModelSelect(index)} - style={{padding: '12px 14px', maxWidth: '100%'}}> - {model} -
))} -
} + {modelDropdown && ( +
+
+ {modelsArray?.map((model, index) => ( +
handleModelSelect(index)} + style={{padding: '12px 14px', maxWidth: '100%'}}> + {model} +
+ ))} +
+
+
openModelMarket()} className="custom_select_option horizontal_container mxw_100 padding_12_14 gap_6 bt_white"> + marketplace_logo + Browse models from marketplace +
+
openNewTab(-5, "new model", "Add_Model", false)} className="custom_select_option horizontal_container mxw_100 padding_12_14 gap_6 bt_white"> + plus_image + Add new custom model +
+
+
+ )}
diff --git a/gui/pages/Content/Agents/AgentTemplatesList.js b/gui/pages/Content/Agents/AgentTemplatesList.js index 0dedde4b2..797383b04 100644 --- a/gui/pages/Content/Agents/AgentTemplatesList.js +++ b/gui/pages/Content/Agents/AgentTemplatesList.js @@ -74,9 +74,9 @@ export default function AgentTemplatesList({
- {agentTemplates.length > 0 ?
+ {agentTemplates.length > 0 ?
{agentTemplates.map((item) => ( -
handleTemplateClick(item)}>
{item.name}
@@ -84,7 +84,7 @@ export default function AgentTemplatesList({
))} -
diff --git a/gui/pages/Content/Agents/AgentWorkspace.js b/gui/pages/Content/Agents/AgentWorkspace.js index 898bf6efb..736ac6f50 100644 --- a/gui/pages/Content/Agents/AgentWorkspace.js +++ b/gui/pages/Content/Agents/AgentWorkspace.js @@ -290,7 +290,7 @@ export default function AgentWorkspace({env, agentId, agentName, selectedView, a // } function saveAgentTemplate() { - saveAgentAsTemplate(selectedRun?.id) + saveAgentAsTemplate(agentId, selectedRun?.id ? selectedRun?.id : -1) .then((response) => { toast.success("Agent saved as template successfully", {autoClose: 1800}); }) diff --git a/gui/pages/Content/Marketplace/Market.js b/gui/pages/Content/Marketplace/Market.js index 55d89fe90..9ab03a4ed 100644 --- a/gui/pages/Content/Marketplace/Market.js +++ b/gui/pages/Content/Marketplace/Market.js @@ -4,7 +4,9 @@ import styles from './Market.module.css'; import MarketKnowledge from './MarketKnowledge'; import MarketAgent from './MarketAgent'; import MarketTools from './MarketTools'; +import MarketModels from '../Models/MarketModels'; import ToolkitTemplate from './ToolkitTemplate'; +import ModelTemplate from "../Models/ModelTemplate"; import {EventBus} from "@/utils/eventBus"; import AgentTemplate from "./AgentTemplate"; import KnowledgeTemplate from "./KnowledgeTemplate"; @@ -64,48 +66,36 @@ export default function Market({env}) {
-
- -
-
- -
-
- -
+ + + +
{activeTab === 'market_tools' && } {activeTab === 'market_knowledge' && } {activeTab === 'market_agents' && } + {activeTab === 'market_models' && }
:
{detailType === 'agent_template' && } {detailType === 'knowledge_template' && } {detailType === 'tool_template' && } + {detailType === 'model_template' && }
}
); diff --git a/gui/pages/Content/Marketplace/Market.module.css b/gui/pages/Content/Marketplace/Market.module.css index 4bd162ade..c309f41cd 100644 --- a/gui/pages/Content/Marketplace/Market.module.css +++ b/gui/pages/Content/Marketplace/Market.module.css @@ -290,7 +290,7 @@ display: flex; justify-content: flex-start; flex-wrap: wrap; - gap: 0.3vw; + gap: 6px; } .agent_resources { diff --git a/gui/pages/Content/Marketplace/MarketAgent.js b/gui/pages/Content/Marketplace/MarketAgent.js index 53fa3f34f..3055ebd27 100644 --- a/gui/pages/Content/Marketplace/MarketAgent.js +++ b/gui/pages/Content/Marketplace/MarketAgent.js @@ -1,6 +1,5 @@ import React, {useEffect, useState} from "react"; import Image from "next/image"; -import styles from './Market.module.css'; import {fetchAgentTemplateList} from "@/pages/api/DashboardService"; import {EventBus} from "@/utils/eventBus"; import {loadingTextEffect} from "@/utils/utils"; @@ -48,8 +47,8 @@ export default function MarketAgent() {
{!isLoading ?
- {agentTemplates.length > 0 ?
{agentTemplates.map((item, index) => ( -
handleTemplateClick(item)}> + {agentTemplates.length > 0 ?
{agentTemplates.map((item, index) => ( +
handleTemplateClick(item)}>
{item.name}
by SuperAgi 
{!isLoading ?
- {knowledgeTemplates.length > 0 ?
{knowledgeTemplates.map((item, index) => ( -
0 ?
{knowledgeTemplates.map((item, index) => ( +
handleTemplateClick(item)}>
diff --git a/gui/pages/Content/Marketplace/MarketTools.js b/gui/pages/Content/Marketplace/MarketTools.js index 87a140d4e..90d1cbccd 100644 --- a/gui/pages/Content/Marketplace/MarketTools.js +++ b/gui/pages/Content/Marketplace/MarketTools.js @@ -1,6 +1,5 @@ import React, {useEffect, useState} from "react"; import Image from "next/image"; -import styles from './Market.module.css'; import {fetchToolTemplateList} from "@/pages/api/DashboardService"; import {EventBus} from "@/utils/eventBus"; import {loadingTextEffect, excludedToolkits, returnToolkitIcon} from "@/utils/utils"; @@ -50,8 +49,8 @@ export default function MarketTools() {
{!isLoading ?
- {toolTemplates.length > 0 ?
{toolTemplates.map((item) => ( -
handleTemplateClick(item)}> + {toolTemplates.length > 0 ?
{toolTemplates.map((item) => ( +
handleTemplateClick(item)}>
tool-icon
diff --git a/gui/pages/Content/Models/AddModel.js b/gui/pages/Content/Models/AddModel.js new file mode 100644 index 000000000..e596cb80c --- /dev/null +++ b/gui/pages/Content/Models/AddModel.js @@ -0,0 +1,17 @@ +import React, {useEffect, useState} from "react"; +import ModelForm from "./ModelForm"; + +export default function AddModel({internalId, getModels, sendModelData}){ + + return( +
+
+
+
+ +
+
+
+
+ ) +} \ No newline at end of file diff --git a/gui/pages/Content/Models/AddModelMarketPlace.js b/gui/pages/Content/Models/AddModelMarketPlace.js new file mode 100644 index 000000000..6365c06ba --- /dev/null +++ b/gui/pages/Content/Models/AddModelMarketPlace.js @@ -0,0 +1,116 @@ +import React, {useState, useEffect} from "react"; +import Image from "next/image"; +import {openNewTab, modelIcon} from "@/utils/utils"; +import {fetchApiKey, storeModel} from "@/pages/api/DashboardService"; +import {toast} from "react-toastify"; + +export default function AddModelMarketPlace(template){ + const [modelTokenLimit, setModelTokenLimit] = useState(4096); + const [modelVersion, setModelVersion] = useState(''); + const [modelEndpoint, setModelEndpoint] = useState(''); + const [tokenError, setTokenError] = useState(false); + const [templateData, setTemplateData] = useState(template.template); + const [isLoading, setIsLoading] = useState(false); + const [providerId, setProviderId] = useState(1); + const [disableInstall, setDisableInstall] = useState(false); + + useEffect(() => { + if(modelVersion === '' && modelEndpoint === '') + setDisableInstall(true) + else + setDisableInstall(false) + },[modelVersion, modelEndpoint]) + + useEffect(()=>{ + console.log(templateData) + checkModelProvider().then().catch(); + },[]) + + const checkModelProvider = async () => { + const response = await fetchApiKey(templateData.provider); + console.log(response.data) + if(response.data.length === 0) { + setTokenError(true) + return true + } + else { + setTokenError(false) + setProviderId(response.data[0].id) + return false + } + } + + const storeModelDetails = () => { + storeModel(templateData.model_name, templateData.description, modelEndpoint, providerId, modelTokenLimit, "Marketplace", modelVersion).then((response) =>{ + setIsLoading(false) + console.log(response) + if (response.data.error) { + toast.error(response.data.error,{autoClose: 1800}); + } else if (response.data.success) { + toast.success(response.data.success,{autoClose: 1800}); + } + }).catch((error) => { + console.log("SORRY, There was an error storing the model details" + error); + setIsLoading(false) + }); + } + + return( +
+
+
+
+ Add Model + +
+ {templateData.model_name} +
+ By {templateData.provider} ·  + logo-icon + {templateData.provider} +
+
+ {templateData.provider === 'Hugging Face' &&
+ {templateData.provider} Model Endpoint + setModelEndpoint(event.target.value)}/> +
} + + {templateData.provider === 'Replicate' &&
+ {templateData.provider} Version + setModelVersion(event.target.value)}/> +
} + + Token Limit + setModelTokenLimit(+event.target.value)} /> + + {tokenError &&
+ error-icon +
+ The {templateData.provider} auth token is not added to your settings. In order to start using the model, you need to add the auth token to your settings. You can find the auth token in the {templateData.provider} dashboard. +
+ + +
+
+
} + + {templateData.provider === 'Hugging Face' &&
+ error-icon +
+ In order to get the endpoint for this model, you will need to deploy it on your Replicate dashboard. Once you have deployed your model on Hugging Face, you will be able to access the endpoint through the Hugging Face dashboard. The endpoint is a URL that you can use to send requests to your model. + +
+
} + + +
+
+
+
+ ) +} \ No newline at end of file diff --git a/gui/pages/Content/Models/MarketModels.js b/gui/pages/Content/Models/MarketModels.js new file mode 100644 index 000000000..5b864febf --- /dev/null +++ b/gui/pages/Content/Models/MarketModels.js @@ -0,0 +1,57 @@ +import React, {useState, useEffect} from "react"; +import styles from "@/pages/Content/Marketplace/Market.module.css"; +import Image from "next/image"; +import {loadingTextEffect, modelIcon, returnToolkitIcon} from "@/utils/utils"; +import {EventBus} from "@/utils/eventBus"; +import {fetchMarketPlaceModel} from "@/pages/api/DashboardService"; + +export default function MarketModels(){ + const [showMarketplace, setShowMarketplace] = useState(false); + const [isLoading, setIsLoading] = useState(false) + const [loadingText, setLoadingText] = useState("Loading Models"); + const [modelTemplates, setModelTemplates] = useState([]); + + useEffect(() => { + loadingTextEffect('Loading Models', setLoadingText, 500); + },[]); + + useEffect(() => { + fetchMarketPlaceModel().then((response) => { + console.log(response.data) + setModelTemplates(response.data) + }) + },[]) + + function handleTemplateClick(item) { + const contentType = 'model_template'; + EventBus.emit('openTemplateDetails', {item, contentType}); + } + + return( +
+
+ {!isLoading ?
+ {modelTemplates.length > 0 ?
{modelTemplates.map((item) => ( +
handleTemplateClick(item)}> +
{item.model_name && item.model_name.includes('/') ? item.model_name.split('/')[1] : item.model_name}
+
+ by { item.model_name && item.model_name.includes('/') ? item.model_name.split('/')[0] : item.provider } + is_verified· + source-icon + {item.provider}· + download-icon + {item.installs} +
+
{item.description}
+
+ ))}
:
+ no-permissions + No Models found! +
} +
:
+
{loadingText}
+
} +
+
+ ) +} \ No newline at end of file diff --git a/gui/pages/Content/Models/ModelDetails.js b/gui/pages/Content/Models/ModelDetails.js new file mode 100644 index 000000000..751b50568 --- /dev/null +++ b/gui/pages/Content/Models/ModelDetails.js @@ -0,0 +1,41 @@ +import React, {useState, useEffect} from "react"; +import Image from "next/image"; +import ModelMetrics from "./ModelMetrics"; +import ModelInfo from "./ModelInfo"; +import {fetchModel} from "@/pages/api/DashboardService"; + +export default function ModelDetails({modelId, modelName}){ + const [modelDetails, setModelDetails] = useState([]) + const [selectedOption, setSelectedOption] = useState('metrics') + + useEffect(() => { + const fetchModelDetails = async () => { + try { + const response = await fetchModel(modelId); + console.log(response.data) + setModelDetails(response.data) + } catch(error) { + console.log(`Error Fetching the Details of the Model ${modelName}`, error) + } + }; + + fetchModelDetails().then().catch(); + },[]) + + return( +
+
+ { modelDetails.name ? (modelDetails.name.split('/')[1] || modelDetails.name) : ""} + {modelDetails.description} +
+ + +
+
+ {selectedOption === 'metrics' && } + {selectedOption === 'details' && } +
+ ) +} \ No newline at end of file diff --git a/gui/pages/Content/Models/ModelForm.js b/gui/pages/Content/Models/ModelForm.js new file mode 100644 index 000000000..b157296d3 --- /dev/null +++ b/gui/pages/Content/Models/ModelForm.js @@ -0,0 +1,177 @@ +import React, {useEffect, useRef, useState} from "react"; +import {removeTab, openNewTab, createInternalId} from "@/utils/utils"; +import Image from "next/image"; +import {fetchApiKey, storeModel, verifyEndPoint} from "@/pages/api/DashboardService"; +import {BeatLoader, ClipLoader} from "react-spinners"; +import {ToastContainer, toast} from 'react-toastify'; + +export default function ModelForm({internalId, getModels, sendModelData}){ + const models = [{'provider':'OpenAI','link':'https://platform.openai.com/account/api-keys'}, + {'provider':'Replicate','link':'https://huggingface.co/settings/tokens'}, + {'provider':'Hugging Face','link':'https://huggingface.co/settings/tokens'}, + {'provider':'Google Palm','link':'https://developers.generativeai.google/products/palm'}]; + const [selectedModel, setSelectedModel] = useState('Select a Model'); + const [selectedLink, setSelectedLink] = useState(''); + const [modelName, setModelName] = useState(''); + const [modelDescription, setModelDescription] = useState(''); + const [modelTokenLimit, setModelTokenLimit] = useState(4096); + const [modelEndpoint, setModelEndpoint] = useState(''); + const [modelDropdown, setModelDropdown] = useState(false); + const [modelVersion, setModelVersion] = useState(''); + const [tokenError, setTokenError] = useState(false); + const [lockAddition, setLockAddition] = useState(true); + const [isLoading, setIsLoading] = useState(false) + const modelRef = useRef(null); + + useEffect(() => { + function handleClickOutside(event) { + if (modelRef.current && !modelRef.current.contains(event.target)) { + setModelDropdown(false) + } + } + },[]); + + useEffect(() => { + const fetchMyAPI = async () => { + const error = await checkModelProvider(selectedModel) + if(selectedModel !== 'Select a Model' && !error) + setLockAddition(false) + else + setLockAddition(true) + } + + fetchMyAPI(); + },[selectedModel]) + + const handleModelSelect = async (index) => { + setSelectedModel(models[index].provider) + setSelectedLink(models[index].link) + setModelDropdown(false); + } + + const checkModelProvider = async (model_provider) => { + const response = await fetchApiKey(model_provider); + console.log(response.data) + if(selectedModel !== 'Select a Model'){ + if(response.data.length === 0) { + setTokenError(true) + return true + } + else { + setTokenError(false) + return false + } + } + } + + const handleAddModel = () =>{ + setIsLoading(true) + fetchApiKey(selectedModel).then((response) =>{ + if(response.data.length > 0) + { + const modelProviderId = response.data[0].id + verifyEndPoint(response.data[0].api_key, modelEndpoint, selectedModel).then((response) =>{ + if(response.data.success) + storeModelDetails(modelProviderId) + else{ + toast.error("The Endpoint is not Valid",{autoClose: 1800}); + setIsLoading(false); + } + }).catch((error) => { + console.log("Error Message:: " + error) + }) + } + }) + } + + const handleModelSuccess = (model) => { + model.contentType = 'Model' + sendModelData(model) + } + + const storeModelDetails = (modelProviderId) => { + storeModel(modelName,modelDescription, modelEndpoint, modelProviderId, modelTokenLimit, "Custom", modelVersion).then((response) =>{ + setIsLoading(false) + let data = response.data + if (data.error) { + toast.error(data.error,{autoClose: 1800}); + } else if (data.success) { + toast.success(data.success,{autoClose: 1800}); + getModels() + handleModelSuccess({id: data.model_id, name: modelName}) + } + }).catch((error) => { + console.log("SORRY, There was an error storing the model details:", error); + setIsLoading(false) + }); + } + + return( +
+
Add new model
+ + Name + setModelName(event.target.value)}/> + + Description +