├── .do ├── app.yaml └── deploy.template.yaml ├── .dockerignore ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ └── 1.BUG_REPORT.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── ci.yml │ └── codeql.yml ├── .gitignore ├── .pre-commit-config.yaml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── Dockerfile-gpu ├── DockerfileCelery ├── DockerfileRedis ├── LICENSE ├── README.MD ├── alembic.ini ├── cli2.py ├── config_template.yaml ├── docker-compose-dev.yaml ├── docker-compose-gpu.yml ├── docker-compose.image.example.yaml ├── docker-compose.yaml ├── entrypoint.sh ├── entrypoint_celery.sh ├── gui ├── .dockerignore ├── .eslintrc.json ├── Dockerfile ├── DockerfileProd ├── README.md ├── app │ ├── favicon.ico │ ├── globals.css │ └── layout.js ├── jsconfig.json ├── next.config.js ├── package-lock.json ├── package.json ├── pages │ ├── Content │ │ ├── APM │ │ │ ├── Apm.module.css │ │ │ ├── ApmDashboard.js │ │ │ └── BarGraph.js │ │ ├── Agents │ │ │ ├── ActionConsole.js │ │ │ ├── ActivityFeed.js │ │ │ ├── AgentCreate.js │ │ │ ├── AgentSchedule.js │ │ │ ├── AgentTemplatesList.js │ │ │ ├── AgentWorkspace.js │ │ │ ├── Agents.js │ │ │ ├── Agents.module.css │ │ │ ├── Details.js │ │ │ ├── ResourceList.js │ │ │ ├── ResourceManager.js │ │ │ ├── RunHistory.js │ │ │ ├── TaskQueue.js │ │ │ └── react-datetime.css │ │ ├── Knowledge │ │ │ ├── AddKnowledge.js │ │ │ ├── Knowledge.js │ │ │ ├── Knowledge.module.css │ │ │ ├── KnowledgeDetails.js │ │ │ └── KnowledgeForm.js │ │ ├── Marketplace │ │ │ ├── AgentTemplate.js │ │ │ ├── KnowledgeTemplate.js │ │ │ ├── Market.js │ │ │ ├── Market.module.css │ │ │ ├── MarketAgent.js │ │ │ ├── MarketKnowledge.js │ │ │ ├── MarketTools.js │ │ │ ├── MarketplacePublic.js │ │ │ └── ToolkitTemplate.js │ │ ├── Models │ │ │ ├── AddModel.js │ │ │ ├── AddModelMarketPlace.js │ │ │ ├── MarketModels.js │ │ │ ├── ModelDetails.js │ │ │ ├── ModelForm.js │ │ │ ├── ModelInfo.js │ │ │ ├── ModelMetrics.js │ │ │ ├── ModelTemplate.js │ │ │ └── Models.js │ │ └── Toolkits │ │ │ ├── AddTool.js │ │ │ ├── Metrics.js │ │ │ ├── Tool.module.css │ │ │ ├── ToolkitWorkspace.js │ │ │ └── Toolkits.js │ ├── Dashboard │ │ ├── Content.js │ │ ├── Dashboard.module.css │ │ ├── Settings │ │ │ ├── AddDatabase.js │ │ │ ├── ApiKeys.js │ │ │ ├── Database.js │ │ │ ├── DatabaseDetails.js │ │ │ ├── Model.js │ │ │ ├── Settings.js │ │ │ └── Webhooks.js │ │ ├── SideBar.js │ │ └── TopBar.js │ ├── _app.css │ ├── _app.js │ └── api │ │ ├── DashboardService.js │ │ └── apiConfig.js ├── public │ └── images │ │ ├── action_console.svg │ │ ├── active_icon.svg │ │ ├── add.svg │ │ ├── agent_cluster.svg │ │ ├── agent_cluster_light.svg │ │ ├── agents_icon_dropdown.svg │ │ ├── agents_light-1.svg │ │ ├── agents_light.svg │ │ ├── all_match.svg │ │ ├── apm.svg │ │ ├── apollo_logo.png │ │ ├── arrow_back.svg │ │ ├── arrow_down.svg │ │ ├── arrow_downward.svg │ │ ├── arrow_downward_dropdown.svg │ │ ├── arrow_forward.svg │ │ ├── arrow_forward_ios.svg │ │ ├── arrow_forward_secondary.svg │ │ ├── arrow_outward.svg │ │ ├── backtotop.svg │ │ ├── bolt.svg │ │ ├── books.svg │ │ ├── calendar.png │ │ ├── calendarIcon.png │ │ ├── calls_made.svg │ │ ├── cancel_presentation.svg │ │ ├── chat_paste_go.svg │ │ ├── check.svg │ │ ├── clear_input.svg │ │ ├── close.svg │ │ ├── close_fullscreen.svg │ │ ├── close_history.svg │ │ ├── close_light.svg │ │ ├── copy_icon.svg │ │ ├── custom_tool.svg │ │ ├── data_info_alert.svg │ │ ├── database.svg │ │ ├── default_file.svg │ │ ├── default_tool.svg │ │ ├── deployed_code.svg │ │ ├── discord.svg │ │ ├── docs_icon.svg │ │ ├── download.svg │ │ ├── download_icon.svg │ │ ├── dropdown_down.svg │ │ ├── dropdown_up.svg │ │ ├── duckduckgo_icon.png │ │ ├── embedding.svg │ │ ├── embedding_light.svg │ │ ├── eventSchedule.png │ │ ├── event_available.svg │ │ ├── event_repeat.svg │ │ ├── expand_more.svg │ │ ├── fact_check.svg │ │ ├── filemanager_icon.svg │ │ ├── flag.svg │ │ ├── github.svg │ │ ├── github_icon.svg │ │ ├── github_white.svg │ │ ├── gmail.png │ │ ├── gmail_icon.svg │ │ ├── google_analytics_logo.png │ │ ├── google_calender_icon.svg │ │ ├── google_palm_logo.svg │ │ ├── google_search_icon.svg │ │ ├── google_serp_icon.svg │ │ ├── history.svg │ │ ├── home_storage.svg │ │ ├── huggingface_logo.svg │ │ ├── icon_error.svg │ │ ├── icon_info.svg │ │ ├── img_file.svg │ │ ├── info.svg │ │ ├── instagram.png │ │ ├── instructions.svg │ │ ├── is_verified.svg │ │ ├── jira_icon.svg │ │ ├── key.svg │ │ ├── key_white.svg │ │ ├── knowledeg_logo.png │ │ ├── knowledge.svg │ │ ├── loading.gif │ │ ├── marketplace.svg │ │ ├── marketplace_download.svg │ │ ├── marketplace_empty.svg │ │ ├── marketplace_logo.png │ │ ├── model_light.svg │ │ ├── models.svg │ │ ├── models_icon_dropdown.svg │ │ ├── mongoDB.svg │ │ ├── no_permissions.svg │ │ ├── notion_logo.png │ │ ├── open_in_new.svg │ │ ├── openai_logo.svg │ │ ├── overview.svg │ │ ├── pdf_file.svg │ │ ├── pinecone.svg │ │ ├── plus.png │ │ ├── plus_symbol.svg │ │ ├── profile_pic.png │ │ ├── project.svg │ │ ├── qdrant.svg │ │ ├── replicate_logo.svg │ │ ├── run_icon.svg │ │ ├── runs_made.svg │ │ ├── schedule.svg │ │ ├── searx_icon.svg │ │ ├── send.svg │ │ ├── settings.svg │ │ ├── sign-in-logo.svg │ │ ├── slack_icon.svg │ │ ├── stack.svg │ │ ├── superagi_logo.png │ │ ├── superagi_logo_beta.png │ │ ├── three_dots.svg │ │ ├── three_dots_vertical.svg │ │ ├── tick.svg │ │ ├── tokens_consumed.svg │ │ ├── tools.svg │ │ ├── tools_dark.svg │ │ ├── tools_light.svg │ │ ├── twitter_icon.svg │ │ ├── txt_file.svg │ │ ├── undo.svg │ │ ├── update.svg │ │ ├── upload_icon.svg │ │ ├── upload_icon_dark.svg │ │ ├── watermark.png │ │ ├── weaviate.svg │ │ ├── webhook_icon.svg │ │ ├── webscraper_icon.svg │ │ ├── widgets.svg │ │ ├── xls_file.svg │ │ └── zip_file.svg └── utils │ ├── eventBus.js │ └── utils.js ├── install_tool_dependencies.sh ├── local-llm ├── local-llm-gpu ├── main.py ├── migrations ├── README ├── env.py ├── script.py.mako └── versions │ ├── 1d54db311055_add_permissions.py │ ├── 2cc1179834b0_agent_executions_modified.py │ ├── 2f97c068fab9_resource_modified.py │ ├── 2fbd6472112c_add_feed_group_id_to_execution_and_feed.py │ ├── 3356a2f89a33_added_configurations_table.py │ ├── 35e47f20475b_renamed_tokens_calls.py │ ├── 3867bb00a495_added_first_login_source.py │ ├── 40affbf3022b_add_filter_colume_in_webhooks.py │ ├── 446884dcae58_add_api_key_and_web_hook.py │ ├── 44b0d6f2d1b3_init_models.py │ ├── 467e85d5e1cd_updated_resources_added_exec_id.py │ ├── 516ecc1c723d_adding_marketplace_template_id_to_agent_.py │ ├── 5184645e9f12_add_question_to_agent_execution_.py │ ├── 520aa6776347_create_models_config.py │ ├── 598cfb37292a_adding_agent_templates.py │ ├── 5d5f801f28e7_create_model_table.py │ ├── 661ec8a4c32e_open_ai_error_handling.py │ ├── 71e3980d55f5_knowledge_and_vector_dbs.py │ ├── 7a3e336c0fba_added_tools_related_models.py │ ├── 83424de1347e_added_agent_execution_config.py │ ├── 8962bed0d809_creating_agent_templates.py │ ├── 9270eb5a8475_local_llms.py │ ├── 9419b3340af7_create_agent_workflow.py │ ├── a91808a89623_added_resources.py │ ├── ba60b12ae109_create_agent_scheduler.py │ ├── be1d922bf2ad_create_call_logs_table.py │ ├── c02f3d759bf3_add_summary_to_resource.py │ ├── c4f2f6ba602a_agent_workflow_wait_step.py │ ├── c5c19944c90c_create_oauth_tokens.py │ ├── cac478732572_delete_agent_feature.py │ ├── d8315244ea43_updated_tool_configs.py │ ├── d9b3436197eb_renaming_templates.py │ ├── e39295ec089c_creating_events.py │ └── fe234ea6e9bc_modify_agent_workflow_tables.py ├── nginx └── default.conf ├── package.json ├── requirements.txt ├── run.bat ├── run.sh ├── run_gui.py ├── run_gui.sh ├── static └── super-agi-1.png ├── superagi ├── __init__.py ├── agent │ ├── __init__.py │ ├── agent_iteration_step_handler.py │ ├── agent_message_builder.py │ ├── agent_prompt_builder.py │ ├── agent_prompt_template.py │ ├── agent_tool_step_handler.py │ ├── agent_workflow_step_wait_handler.py │ ├── common_types.py │ ├── output_handler.py │ ├── output_parser.py │ ├── prompts │ │ ├── agent_queue_input.txt │ │ ├── agent_recursive_summary.txt │ │ ├── agent_summary.txt │ │ ├── agent_tool_input.txt │ │ ├── agent_tool_output.txt │ │ ├── analyse_task.txt │ │ ├── create_tasks.txt │ │ ├── initialize_tasks.txt │ │ ├── prioritize_tasks.txt │ │ └── superagi.txt │ ├── queue_step_handler.py │ ├── task_queue.py │ ├── tool_builder.py │ ├── tool_executor.py │ ├── types │ │ ├── __init__.py │ │ ├── agent_execution_status.py │ │ ├── agent_workflow_step_action_types.py │ │ └── wait_step_status.py │ └── workflow_seed.py ├── apm │ ├── __init__.py │ ├── analytics_helper.py │ ├── call_log_helper.py │ ├── event_handler.py │ ├── knowledge_handler.py │ └── tools_handler.py ├── config │ ├── __init__.py │ └── config.py ├── controllers │ ├── __init__.py │ ├── agent.py │ ├── agent_execution.py │ ├── agent_execution_config.py │ ├── agent_execution_feed.py │ ├── agent_execution_permission.py │ ├── agent_template.py │ ├── agent_workflow.py │ ├── analytics.py │ ├── api │ │ └── agent.py │ ├── api_key.py │ ├── budget.py │ ├── config.py │ ├── google_oauth.py │ ├── knowledge_configs.py │ ├── knowledges.py │ ├── marketplace_stats.py │ ├── models_controller.py │ ├── organisation.py │ ├── project.py │ ├── resources.py │ ├── tool.py │ ├── tool_config.py │ ├── toolkit.py │ ├── twitter_oauth.py │ ├── types │ │ ├── agent_execution_config.py │ │ ├── agent_publish_config.py │ │ ├── agent_schedule.py │ │ ├── agent_with_config.py │ │ ├── agent_with_config_schedule.py │ │ └── models_types.py │ ├── user.py │ ├── vector_db_indices.py │ ├── vector_dbs.py │ └── webhook.py ├── helper │ ├── agent_schedule_helper.py │ ├── auth.py │ ├── calendar_date.py │ ├── encyption_helper.py │ ├── error_handler.py │ ├── feed_parser.py │ ├── github_helper.py │ ├── google_calendar_creds.py │ ├── google_search.py │ ├── google_serp.py │ ├── imap_email.py │ ├── json_cleaner.py │ ├── llm_loader.py │ ├── models_helper.py │ ├── prompt_reader.py │ ├── read_email.py │ ├── resource_helper.py │ ├── s3_helper.py │ ├── time_helper.py │ ├── token_counter.py │ ├── tool_helper.py │ ├── twitter_helper.py │ ├── twitter_tokens.py │ ├── validate_csv.py │ ├── webhook_manager.py │ └── webpage_extractor.py ├── image_llms │ ├── __init__.py │ ├── base_image_llm.py │ └── openai_dalle.py ├── jobs │ ├── __init__.py │ ├── agent_executor.py │ └── scheduling_executor.py ├── lib │ └── logger.py ├── llms │ ├── __init__.py │ ├── base_llm.py │ ├── google_palm.py │ ├── grammar │ │ └── json.gbnf │ ├── hugging_face.py │ ├── llm_model_factory.py │ ├── local_llm.py │ ├── openai.py │ ├── replicate.py │ └── utils │ │ ├── __init__.py │ │ └── huggingface_utils │ │ ├── __init__.py │ │ ├── public_endpoints.py │ │ └── tasks.py ├── models │ ├── __init__.py │ ├── agent.py │ ├── agent_config.py │ ├── agent_execution.py │ ├── agent_execution_config.py │ ├── agent_execution_feed.py │ ├── agent_execution_permission.py │ ├── agent_schedule.py │ ├── agent_template.py │ ├── agent_template_config.py │ ├── api_key.py │ ├── base_model.py │ ├── budget.py │ ├── call_logs.py │ ├── configuration.py │ ├── db.py │ ├── events.py │ ├── knowledge_configs.py │ ├── knowledges.py │ ├── marketplace_stats.py │ ├── models.py │ ├── models_config.py │ ├── oauth_tokens.py │ ├── organisation.py │ ├── project.py │ ├── resource.py │ ├── tool.py │ ├── tool_config.py │ ├── toolkit.py │ ├── types │ │ ├── __init__.py │ │ ├── agent_config.py │ │ ├── login_request.py │ │ └── validate_llm_api_key_request.py │ ├── user.py │ ├── vector_db_configs.py │ ├── vector_db_indices.py │ ├── vector_dbs.py │ ├── webhook_events.py │ ├── webhooks.py │ └── workflows │ │ ├── __init__.py │ │ ├── agent_workflow.py │ │ ├── agent_workflow_step.py │ │ ├── agent_workflow_step_tool.py │ │ ├── agent_workflow_step_wait.py │ │ ├── iteration_workflow.py │ │ └── iteration_workflow_step.py ├── resource_manager │ ├── __init__.py │ ├── file_manager.py │ ├── llama_document_summary.py │ ├── llama_vector_store_factory.py │ ├── resource_manager.py │ └── resource_summary.py ├── tool_manager.py ├── tools │ ├── __init__.py │ ├── apollo │ │ ├── __init__.py │ │ ├── apollo_search.py │ │ └── apollo_toolkit.py │ ├── base_tool.py │ ├── code │ │ ├── README.MD │ │ ├── __init__.py │ │ ├── coding_toolkit.py │ │ ├── improve_code.py │ │ ├── prompts │ │ │ ├── generate_logic.txt │ │ │ ├── improve_code.txt │ │ │ ├── write_code.txt │ │ │ ├── write_spec.txt │ │ │ └── write_test.txt │ │ ├── write_code.py │ │ ├── write_spec.py │ │ └── write_test.py │ ├── duck_duck_go │ │ ├── README.md │ │ ├── __init__.py │ │ ├── duck_duck_go_search.py │ │ └── duck_duck_go_search_toolkit.py │ ├── email │ │ ├── README.md │ │ ├── __init__.py │ │ ├── email_toolkit.py │ │ ├── read_email.py │ │ ├── send_email.py │ │ └── send_email_attachment.py │ ├── file │ │ ├── __init__.py │ │ ├── append_file.py │ │ ├── delete_file.py │ │ ├── file_toolkit.py │ │ ├── list_files.py │ │ ├── read_file.py │ │ └── write_file.py │ ├── github │ │ ├── README.MD │ │ ├── __init__.py │ │ ├── add_file.py │ │ ├── delete_file.py │ │ ├── fetch_pull_request.py │ │ ├── github_toolkit.py │ │ ├── prompts │ │ │ └── code_review.txt │ │ ├── review_pull_request.py │ │ └── search_repo.py │ ├── google_calendar │ │ ├── README.md │ │ ├── create_calendar_event.py │ │ ├── delete_calendar_event.py │ │ ├── event_details_calendar.py │ │ ├── google_calendar_toolkit.py │ │ └── list_calendar_events.py │ ├── google_search │ │ ├── README.MD │ │ ├── __init__.py │ │ ├── google_search.py │ │ └── google_search_toolkit.py │ ├── google_serp_search │ │ ├── README.md │ │ ├── __init__.py │ │ ├── google_serp_search.py │ │ └── google_serp_search_toolkit.py │ ├── image_generation │ │ ├── README.MD │ │ ├── README.STABLE_DIFFUSION.md │ │ ├── __init__.py │ │ ├── dalle_image_gen.py │ │ ├── image_generation_toolkit.py │ │ └── stable_diffusion_image_gen.py │ ├── instagram_tool │ │ ├── README.MD │ │ ├── __init__.py │ │ ├── instagram.py │ │ └── instagram_toolkit.py │ ├── jira │ │ ├── README.MD │ │ ├── __init__.py │ │ ├── create_issue.py │ │ ├── edit_issue.py │ │ ├── get_projects.py │ │ ├── jira_toolkit.py │ │ ├── search_issues.py │ │ └── tool.py │ ├── knowledge_search │ │ ├── knowledge_search.py │ │ └── knowledge_search_toolkit.py │ ├── resource │ │ ├── __init__.py │ │ ├── query_resource.py │ │ └── resource_toolkit.py │ ├── searx │ │ ├── README.MD │ │ ├── __init__.py │ │ ├── search_scraper.py │ │ ├── searx.py │ │ └── searx_toolkit.py │ ├── slack │ │ ├── README.md │ │ ├── __init__.py │ │ ├── send_message.py │ │ └── slack_toolkit.py │ ├── thinking │ │ ├── __init__.py │ │ ├── prompts │ │ │ └── thinking.txt │ │ ├── thinking_toolkit.py │ │ └── tools.py │ ├── tool_response_query_manager.py │ ├── twitter │ │ ├── README.md │ │ ├── send_tweets.py │ │ └── twitter_toolkit.py │ └── webscaper │ │ ├── README.MD │ │ ├── __init__.py │ │ ├── tools.py │ │ └── web_scraper_toolkit.py ├── types │ ├── __init__.py │ ├── common.py │ ├── key_type.py │ ├── model_source_types.py │ ├── queue_status.py │ ├── storage_types.py │ └── vector_store_types.py ├── vector_embeddings │ ├── __init__.py │ ├── base.py │ ├── pinecone.py │ ├── qdrant.py │ ├── vector_embedding_factory.py │ └── weaviate.py ├── vector_store │ ├── __init__.py │ ├── base.py │ ├── chromadb.py │ ├── document.py │ ├── embedding │ │ ├── __init__.py │ │ ├── base.py │ │ ├── openai.py │ │ └── palm.py │ ├── pinecone.py │ ├── qdrant.py │ ├── redis.py │ ├── vector_factory.py │ └── weaviate.py └── worker.py ├── test.py ├── test_main.http ├── tests ├── __init__.py ├── integration_tests │ ├── __init__.py │ ├── vector_embeddings │ │ ├── __init__.py │ │ ├── test_pinecone.py │ │ ├── test_qdrant.py │ │ └── test_weaviate.py │ └── vector_store │ │ ├── __init__.py │ │ ├── test_qdrant.py │ │ └── test_weaviate.py ├── tools │ └── google_calendar │ │ ├── create_event_test.py │ │ ├── delete_event_test.py │ │ ├── event_details_test.py │ │ └── list_events_test.py └── unit_tests │ ├── __init__.py │ ├── agent │ ├── __init__.py │ ├── test_agent_iteration_step_handler.py │ ├── test_agent_message_builder.py │ ├── test_agent_prompt_builder.py │ ├── test_agent_prompt_template.py │ ├── test_agent_tool_step_handler.py │ ├── test_agent_workflow_step_wait_handler.py │ ├── test_output_handler.py │ ├── test_output_parser.py │ ├── test_queue_step_handler.py │ ├── test_task_queue.py │ ├── test_tool_builder.py │ └── test_tool_executor.py │ ├── apm │ ├── __init__.py │ ├── test_analytics_helper.py │ ├── test_call_log_helper.py │ ├── test_event_handler.py │ ├── test_knowledge_handler.py │ └── test_tools_handler.py │ ├── controllers │ ├── __init__.py │ ├── api │ │ ├── __init__.py │ │ └── test_agent.py │ ├── test_agent.py │ ├── test_agent_execution.py │ ├── test_agent_execution_config.py │ ├── test_agent_execution_feeds.py │ ├── test_agent_template.py │ ├── test_analytics.py │ ├── test_models_controller.py │ ├── test_publish_agent.py │ ├── test_tool.py │ ├── test_tool_config.py │ ├── test_toolkit.py │ ├── test_update_agent_config_table.py │ └── test_user.py │ ├── helper │ ├── __init__.py │ ├── test_agent_schedule_helper.py │ ├── test_calendar_date.py │ ├── test_error_handling.py │ ├── test_feed_parser.py │ ├── test_github_helper.py │ ├── test_json_cleaner.py │ ├── test_resource_helper.py │ ├── test_s3_helper.py │ ├── test_time_helper.py │ ├── test_token_counter.py │ ├── test_tool_helper.py │ ├── test_twitter_helper.py │ ├── test_twitter_tokens.py │ └── test_webhooks.py │ ├── jobs │ ├── __init__.py │ ├── conftest.py │ ├── test_resource_summary.py │ └── test_scheduling_executor.py │ ├── llms │ ├── __init__.py │ ├── test_google_palm.py │ ├── test_hugging_face.py │ ├── test_model_factory.py │ ├── test_open_ai.py │ └── test_replicate.py │ ├── models │ ├── __init__.py │ ├── test_agent.py │ ├── test_agent_execution.py │ ├── test_agent_execution_config.py │ ├── test_agent_execution_feed.py │ ├── test_agent_schedule.py │ ├── test_agent_template.py │ ├── test_agent_workflow.py │ ├── test_agent_workflow_step.py │ ├── test_agent_workflow_step_tool.py │ ├── test_api_key.py │ ├── test_call_logs.py │ ├── test_configuration.py │ ├── test_events.py │ ├── test_iteration_workflow.py │ ├── test_iteration_workflow_step.py │ ├── test_knowledge_configs.py │ ├── test_marketplace_stats.py │ ├── test_models.py │ ├── test_models_config.py │ ├── test_project.py │ ├── test_tool.py │ ├── test_tool_config.py │ ├── test_toolkit.py │ ├── test_vector_db_configs.py │ ├── test_vector_db_indices.py │ └── test_vector_dbs.py │ ├── resource_manager │ ├── __init__.py │ ├── test_file_manager.py │ ├── test_llama_document_creation.py │ ├── test_llama_vector_store_factory.py │ └── test_save_document_to_vector_store.py │ ├── test_migrations_multiheads.py │ ├── test_tool_manager.py │ ├── tools │ ├── __init__.py │ ├── code │ │ ├── __init__.py │ │ ├── test_improve_code.py │ │ ├── test_write_code.py │ │ ├── test_write_spec.py │ │ └── test_write_test.py │ ├── duck_duck_go │ │ ├── __init__.py │ │ ├── test_duckduckgo_results.py │ │ └── test_duckduckgo_toolkit.py │ ├── email │ │ ├── __init__.py │ │ ├── test_read_email.py │ │ ├── test_send_email.py │ │ └── test_send_email_attachment.py │ ├── file │ │ ├── __init__.py │ │ ├── test_list_files.py │ │ └── test_read_file.py │ ├── github │ │ ├── __init__.py │ │ ├── test_add_file.py │ │ ├── test_fetch_pull_request.py │ │ ├── test_github_delete.py │ │ └── test_review_pull_request.py │ ├── image_generation │ │ ├── __init__.py │ │ ├── test_dalle_image_gen.py │ │ └── test_stable_diffusion_image_gen.py │ ├── instagram_tool │ │ ├── __init__.py │ │ ├── test_instagram_tool.py │ │ └── test_instagram_toolkit.py │ ├── jira │ │ ├── __init__.py │ │ ├── test_create_issue.py │ │ ├── test_edit_issue.py │ │ ├── test_get_projects.py │ │ └── test_search_issues.py │ ├── knowledge_tool │ │ ├── __init__.py │ │ └── test_knowledge_search.py │ ├── searx │ │ ├── __init__.py │ │ └── test_searx_toolkit.py │ ├── test_search_repo.py │ └── twitter │ │ └── test_send_tweets.py │ ├── types │ ├── __init__.py │ └── test_model_source_types.py │ ├── vector_embeddings │ ├── __init__.py │ └── test_vector_embedding_factory.py │ └── vector_store │ ├── __init__.py │ ├── test_chromadb.py │ ├── test_redis.py │ └── test_vector_factory.py ├── tgwui ├── DockerfileTGWUI ├── config │ ├── loras │ │ └── place-your-loras-here.txt │ ├── presets │ │ ├── Debug-deterministic.yaml │ │ ├── Kobold-Godlike.yaml │ │ ├── Kobold-Liminal Drift.yaml │ │ ├── LLaMA-Precise.yaml │ │ ├── Naive.yaml │ │ ├── NovelAI-Best Guess.yaml │ │ ├── NovelAI-Decadence.yaml │ │ ├── NovelAI-Genesis.yaml │ │ ├── NovelAI-Lycaenidae.yaml │ │ ├── NovelAI-Ouroboros.yaml │ │ ├── NovelAI-Pleasing Results.yaml │ │ ├── NovelAI-Sphinx Moth.yaml │ │ ├── NovelAI-Storywriter.yaml │ │ ├── Special-Contrastive Search.yaml │ │ └── Special-Eta Sampling.yaml │ ├── prompts │ │ ├── Alpaca-with-Input.txt │ │ ├── GPT-4chan.txt │ │ └── QA.txt │ └── training │ │ ├── datasets │ │ └── put-trainer-datasets-here.txt │ │ └── formats │ │ ├── alpaca-chatbot-format.json │ │ └── alpaca-format.json └── scripts │ ├── build_extensions.sh │ └── docker-entrypoint.sh ├── tools.json ├── ui.py ├── wait-for-it.sh └── workspace ├── input └── .temp └── output ├── .temp └── testing.txt /.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore everything 2 | ** 3 | 4 | # Allow files and directories 5 | !/migrations 6 | !/nginx 7 | !/superagi 8 | !/tgwui 9 | !/tools 10 | !/workspace 11 | !/main.py 12 | !/requirements.txt 13 | !/entrypoint.sh 14 | !/entrypoint_celery.sh 15 | !/wait-for-it.sh 16 | !/tools.json 17 | !/install_tool_dependencies.sh 18 | !/alembic.ini -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh text eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | **/.env 3 | **/.venv 4 | config.yaml 5 | __pycache__ 6 | superagi/models/__pycache__ 7 | superagi/controllers/__pycache__ 8 | **agent_dictvenv 9 | **/__gitpycache__/ 10 | gui/node_modules 11 | node_modules 12 | gui/.next 13 | .DS_Store 14 | .DS_Store? 15 | venv 16 | workspace/output 17 | workspace/input 18 | celerybeat-schedule 19 | ../bfg-report* 20 | superagi/tools/marketplace_tools/ 21 | superagi/tools/external_tools/ 22 | tests/unit_tests/resource_manager/test_path 23 | /tools.json -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: local 3 | hooks: 4 | - id: pylint 5 | name: pylint 6 | entry: pylint 7 | language: system 8 | types: [python] -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Stage 1: Compile image 2 | FROM python:3.10-slim-bullseye AS compile-image 3 | WORKDIR /app 4 | 5 | RUN apt-get update && \ 6 | apt-get install --no-install-recommends -y wget libpq-dev gcc g++ && \ 7 | apt-get clean && \ 8 | rm -rf /var/lib/apt/lists/* 9 | 10 | RUN python -m venv /opt/venv 11 | ENV PATH="/opt/venv/bin:$PATH" 12 | 13 | COPY requirements.txt . 14 | RUN pip install --upgrade pip && \ 15 | pip install --no-cache-dir -r requirements.txt 16 | 17 | RUN python3.10 -c "import nltk; nltk.download('punkt')" && \ 18 | python3.10 -c "import nltk; nltk.download('averaged_perceptron_tagger')" 19 | 20 | COPY . . 21 | 22 | RUN chmod +x ./entrypoint.sh ./wait-for-it.sh ./install_tool_dependencies.sh ./entrypoint_celery.sh 23 | 24 | # Stage 2: Build image 25 | FROM python:3.10-slim-bullseye AS build-image 26 | WORKDIR /app 27 | 28 | RUN apt-get update && \ 29 | apt-get install --no-install-recommends -y libpq-dev && \ 30 | apt-get clean && \ 31 | rm -rf /var/lib/apt/lists/* 32 | 33 | COPY --from=compile-image /opt/venv /opt/venv 34 | COPY --from=compile-image /app /app 35 | COPY --from=compile-image /root/nltk_data /root/nltk_data 36 | 37 | ENV PATH="/opt/venv/bin:$PATH" 38 | 39 | EXPOSE 8001 -------------------------------------------------------------------------------- /DockerfileCelery: -------------------------------------------------------------------------------- 1 | FROM python:3.9 2 | 3 | WORKDIR /app 4 | 5 | #RUN apt-get update && apt-get install --no-install-recommends -y git wget libpq-dev gcc python3-dev && pip install psycopg2 6 | RUN pip install --upgrade pip 7 | 8 | COPY requirements.txt . 9 | RUN pip install --no-cache-dir -r requirements.txt 10 | 11 | COPY . . 12 | 13 | # Downloads the tools 14 | RUN python superagi/tool_manager.py 15 | 16 | # Set executable permissions for install_tool_dependencies.sh 17 | RUN chmod +x install_tool_dependencies.sh 18 | 19 | # Install dependencies 20 | RUN ./install_tool_dependencies.sh 21 | 22 | # Downloads the tools 23 | RUN python superagi/tool_manager.py 24 | 25 | # Set executable permissions for install_tool_dependencies.sh 26 | RUN chmod +x install_tool_dependencies.sh 27 | 28 | # Install dependencies 29 | RUN ./install_tool_dependencies.sh 30 | 31 | 32 | CMD ["celery", "-A", "superagi.worker", "worker", "--beat","--loglevel=info"] 33 | -------------------------------------------------------------------------------- /DockerfileRedis: -------------------------------------------------------------------------------- 1 | FROM redis/redis-stack-server:latest -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 TransformerOptimus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Downloads the tools from marketplace and external tool repositories 4 | python superagi/tool_manager.py 5 | 6 | # Install dependencies 7 | ./install_tool_dependencies.sh 8 | 9 | # Run Alembic migrations 10 | alembic upgrade head 11 | 12 | # Start the app 13 | exec uvicorn main:app --host 0.0.0.0 --port 8001 --reload 14 | -------------------------------------------------------------------------------- /entrypoint_celery.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Downloads the tools 4 | python superagi/tool_manager.py 5 | 6 | # Install dependencies 7 | ./install_tool_dependencies.sh 8 | 9 | exec celery -A superagi.worker worker --beat --loglevel=info -------------------------------------------------------------------------------- /gui/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore everything 2 | ** 3 | 4 | # Allow files and directories 5 | !app 6 | !pages 7 | !public 8 | !utils 9 | !package.json 10 | !next.config.js 11 | !package-lock.json 12 | !.eslintrc.json 13 | !jsconfig.json -------------------------------------------------------------------------------- /gui/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /gui/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine AS deps 2 | RUN apk add --no-cache libc6-compat 3 | WORKDIR /app 4 | COPY package.json package-lock.json ./ 5 | RUN npm ci 6 | 7 | # Rebuild the source code only when needed 8 | FROM node:18-alpine AS builder 9 | 10 | WORKDIR /app 11 | 12 | COPY --from=deps /app/node_modules ./node_modules 13 | 14 | COPY . . 15 | ARG NEXT_PUBLIC_API_BASE_URL=/api 16 | ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL 17 | ARG NEXT_PUBLIC_MIXPANEL_AUTH_ID 18 | ENV NEXT_PUBLIC_MIXPANEL_AUTH_ID=$NEXT_PUBLIC_MIXPANEL_AUTH_ID 19 | EXPOSE 3000 20 | 21 | CMD ["npm", "run", "dev"] -------------------------------------------------------------------------------- /gui/DockerfileProd: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine AS deps 2 | RUN apk add --no-cache libc6-compat 3 | WORKDIR /app 4 | COPY package.json package-lock.json ./ 5 | RUN npm ci --only=production 6 | 7 | # Rebuild the source code only when needed 8 | FROM node:18-alpine AS builder 9 | 10 | WORKDIR /app 11 | 12 | COPY --from=deps /app/node_modules ./node_modules 13 | 14 | COPY . . 15 | ARG NEXT_PUBLIC_API_BASE_URL=/api 16 | ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL 17 | 18 | RUN npm run build 19 | 20 | # Production image, copy all the files and run next 21 | FROM node:18-alpine AS runner 22 | WORKDIR /app 23 | 24 | ENV NODE_ENV production 25 | 26 | RUN addgroup --system --gid 1001 supergroup 27 | RUN adduser --system --uid 1001 superuser 28 | 29 | COPY --from=builder /app/public ./public 30 | COPY --from=builder /app/package.json ./package.json 31 | 32 | # Automatically leverage output traces to reduce image size 33 | # https://nextjs.org/docs/advanced-features/output-file-tracing 34 | COPY --from=builder --chown=superuser:supergroup /app/.next/standalone ./ 35 | COPY --from=builder --chown=superuser:supergroup /app/.next/static ./.next/static 36 | 37 | USER superuser 38 | 39 | EXPOSE 3000 40 | 41 | ENV PORT 3000 42 | 43 | CMD ["node", "server.js"] -------------------------------------------------------------------------------- /gui/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/app/favicon.ico -------------------------------------------------------------------------------- /gui/app/layout.js: -------------------------------------------------------------------------------- 1 | import './globals.css' 2 | 3 | export const metadata = { 4 | title: 'Super AGI', 5 | description: 'Generated by create next app', 6 | } 7 | 8 | export default function RootLayout({ children }) { 9 | return ( 10 | 11 | {children} 12 | 13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /gui/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "paths": { 4 | "@/*": ["./*"] 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /gui/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | assetPrefix: process.env.NODE_ENV === "production" ? "/" : "./", 4 | output: 'standalone' 5 | }; 6 | 7 | module.exports = nextConfig; 8 | -------------------------------------------------------------------------------- /gui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "super-agi", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint", 10 | "export": "next export" 11 | }, 12 | "dependencies": { 13 | "axios": "^1.4.0", 14 | "bootstrap": "^5.2.3", 15 | "date-fns": "^2.30.0", 16 | "date-fns-tz": "^2.0.0", 17 | "echarts": "^5.4.2", 18 | "echarts-for-react": "^3.0.2", 19 | "eslint": "8.40.0", 20 | "eslint-config-next": "13.4.2", 21 | "js-cookie": "^3.0.5", 22 | "jszip": "^3.10.1", 23 | "mitt": "^3.0.0", 24 | "mixpanel-browser": "^2.47.0", 25 | "moment": "^2.29.4", 26 | "moment-timezone": "^0.5.43", 27 | "next": "13.4.2", 28 | "react": "18.2.0", 29 | "react-datetime": "^3.2.0", 30 | "react-dom": "18.2.0", 31 | "react-draggable": "^4.4.5", 32 | "react-grid-layout": "^1.3.4", 33 | "react-markdown": "^8.0.7", 34 | "react-spinners": "^0.13.8", 35 | "react-tippy": "^1.4.0", 36 | "react-toastify": "^9.1.3" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /gui/pages/Content/APM/Apm.module.css: -------------------------------------------------------------------------------- 1 | .apm_dashboard_container { 2 | display: flex; 3 | flex-direction: column; 4 | } 5 | 6 | .apm_dashboard { 7 | margin-top: 16px; 8 | height: calc(100vh - 16vh); 9 | overflow-y: auto; 10 | } -------------------------------------------------------------------------------- /gui/pages/Content/Models/AddModel.js: -------------------------------------------------------------------------------- 1 | import React, {useEffect, useState} from "react"; 2 | import ModelForm from "./ModelForm"; 3 | 4 | export default function AddModel({internalId, getModels, sendModelData, env}){ 5 | 6 | return( 7 |
8 |
9 |
10 |
11 | 12 |
13 |
14 |
15 |
16 | ) 17 | } -------------------------------------------------------------------------------- /gui/public/images/active_icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /gui/public/images/add.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/apollo_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/apollo_logo.png -------------------------------------------------------------------------------- /gui/public/images/arrow_back.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/arrow_down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/arrow_downward.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/arrow_downward_dropdown.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /gui/public/images/arrow_forward.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/arrow_forward_ios.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/arrow_forward_secondary.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/arrow_outward.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/bolt.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/calendar.png -------------------------------------------------------------------------------- /gui/public/images/calendarIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/calendarIcon.png -------------------------------------------------------------------------------- /gui/public/images/calls_made.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /gui/public/images/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/close_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/default_file.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /gui/public/images/dropdown_down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/dropdown_up.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/duckduckgo_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/duckduckgo_icon.png -------------------------------------------------------------------------------- /gui/public/images/eventSchedule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/eventSchedule.png -------------------------------------------------------------------------------- /gui/public/images/expand_more.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/flag.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gui/public/images/github_white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /gui/public/images/gmail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/gmail.png -------------------------------------------------------------------------------- /gui/public/images/google_analytics_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/google_analytics_logo.png -------------------------------------------------------------------------------- /gui/public/images/img_file.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /gui/public/images/instagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/instagram.png -------------------------------------------------------------------------------- /gui/public/images/knowledeg_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/knowledeg_logo.png -------------------------------------------------------------------------------- /gui/public/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/loading.gif -------------------------------------------------------------------------------- /gui/public/images/marketplace_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/marketplace_logo.png -------------------------------------------------------------------------------- /gui/public/images/models.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /gui/public/images/no_permissions.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /gui/public/images/notion_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/notion_logo.png -------------------------------------------------------------------------------- /gui/public/images/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/plus.png -------------------------------------------------------------------------------- /gui/public/images/plus_symbol.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/profile_pic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/profile_pic.png -------------------------------------------------------------------------------- /gui/public/images/run_icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/runs_made.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/send.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/superagi_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/superagi_logo.png -------------------------------------------------------------------------------- /gui/public/images/superagi_logo_beta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/superagi_logo_beta.png -------------------------------------------------------------------------------- /gui/public/images/three_dots_vertical.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/tick.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gui/public/images/txt_file.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /gui/public/images/undo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /gui/public/images/watermark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/gui/public/images/watermark.png -------------------------------------------------------------------------------- /gui/utils/eventBus.js: -------------------------------------------------------------------------------- 1 | import mitt from 'mitt'; 2 | 3 | const emitter = mitt(); 4 | 5 | export const EventBus = { 6 | on: emitter.on, 7 | off: emitter.off, 8 | emit: emitter.emit, 9 | }; 10 | -------------------------------------------------------------------------------- /install_tool_dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Update and upgrade apt settings and apps 4 | apt update && apt upgrade -y 5 | xargs apt install -y < /app/requirements_apt.txt 6 | 7 | # Run the project's main requirements.txt 8 | pip install -r /app/requirements.txt 9 | 10 | for tool in /app/superagi/tools/* /app/superagi/tools/external_tools/* /app/superagi/tools/marketplace_tools/* ; do 11 | # Loop through the tools directories and install their apt_requirements.txt if they exist 12 | if [ -d "$tool" ] && [ -f "$tool/requirements_apt.txt" ]; then 13 | echo "Installing apt requirements for tool: $(basename "$tool")" 14 | xargs apt install -y < "$tool/requirements_apt.txt" 15 | fi 16 | # Loop through the tools directories and install their requirements.txt if they exist 17 | if [ -d "$tool" ] && [ -f "$tool/requirements.txt" ]; then 18 | echo "Installing requirements for tool: $(basename "$tool")" 19 | pip install -r "$tool/requirements.txt" 20 | fi 21 | done 22 | -------------------------------------------------------------------------------- /migrations/README: -------------------------------------------------------------------------------- 1 | Generic single-database configuration. -------------------------------------------------------------------------------- /migrations/script.py.mako: -------------------------------------------------------------------------------- 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision | comma,n} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | ${imports if imports else ""} 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = ${repr(up_revision)} 14 | down_revision = ${repr(down_revision)} 15 | branch_labels = ${repr(branch_labels)} 16 | depends_on = ${repr(depends_on)} 17 | 18 | 19 | def upgrade() -> None: 20 | ${upgrades if upgrades else "pass"} 21 | 22 | 23 | def downgrade() -> None: 24 | ${downgrades if downgrades else "pass"} 25 | -------------------------------------------------------------------------------- /migrations/versions/2cc1179834b0_agent_executions_modified.py: -------------------------------------------------------------------------------- 1 | """agent_executions_modified 2 | 3 | Revision ID: 2cc1179834b0 4 | Revises: 2f97c068fab9 5 | Create Date: 2023-06-02 21:01:43.303961 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '2cc1179834b0' 14 | down_revision = '2f97c068fab9' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('agent_executions', sa.Column('calls', sa.Integer(), nullable=True)) 22 | op.add_column('agent_executions', sa.Column('tokens', sa.Integer(), nullable=True)) 23 | # ### end Alembic commands ### 24 | 25 | 26 | def downgrade() -> None: 27 | # ### commands auto generated by Alembic - please adjust! ### 28 | op.drop_column('agent_executions', 'tokens') 29 | op.drop_column('agent_executions', 'calls') 30 | # ### end Alembic commands ### 31 | -------------------------------------------------------------------------------- /migrations/versions/2f97c068fab9_resource_modified.py: -------------------------------------------------------------------------------- 1 | """Resource Modified 2 | 3 | Revision ID: 2f97c068fab9 4 | Revises: a91808a89623 5 | Create Date: 2023-06-02 13:13:21.670935 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '2f97c068fab9' 14 | down_revision = 'a91808a89623' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('resources', sa.Column('agent_id', sa.Integer(), nullable=True)) 22 | op.drop_column('resources', 'project_id') 23 | # ### end Alembic commands ### 24 | 25 | 26 | def downgrade() -> None: 27 | # ### commands auto generated by Alembic - please adjust! ### 28 | op.add_column('resources', sa.Column('project_id', sa.INTEGER(), autoincrement=False, nullable=True)) 29 | op.drop_column('resources', 'agent_id') 30 | # ### end Alembic commands ### 31 | -------------------------------------------------------------------------------- /migrations/versions/2fbd6472112c_add_feed_group_id_to_execution_and_feed.py: -------------------------------------------------------------------------------- 1 | """add feed group id to execution and feed 2 | 3 | Revision ID: 2fbd6472112c 4 | Revises: 5184645e9f12 5 | Create Date: 2023-08-01 17:09:16.183863 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | # revision identifiers, used by Alembic. 12 | revision = '2fbd6472112c' 13 | down_revision = '5184645e9f12' 14 | branch_labels = None 15 | depends_on = None 16 | 17 | 18 | def upgrade() -> None: 19 | op.add_column('agent_executions', 20 | sa.Column('current_feed_group_id', sa.String(), nullable=True, server_default="DEFAULT")) 21 | op.add_column('agent_execution_feeds', sa.Column('feed_group_id', sa.String(), nullable=True)) 22 | 23 | 24 | def downgrade() -> None: 25 | op.drop_column('agent_executions', 'current_feed_group_id') 26 | op.drop_column('agent_execution_feeds', 'feed_group_id') 27 | -------------------------------------------------------------------------------- /migrations/versions/35e47f20475b_renamed_tokens_calls.py: -------------------------------------------------------------------------------- 1 | """renamed_tokens_calls 2 | 3 | Revision ID: 35e47f20475b 4 | Revises: 598cfb37292a 5 | Create Date: 2023-06-06 04:34:15.101672 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '35e47f20475b' 14 | down_revision = '598cfb37292a' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('agent_executions', sa.Column('num_of_calls', sa.Integer(), nullable=True)) 22 | op.add_column('agent_executions', sa.Column('num_of_tokens', sa.Integer(), nullable=True)) 23 | op.drop_column('agent_executions', 'calls') 24 | op.drop_column('agent_executions', 'tokens') 25 | # ### end Alembic commands ### 26 | 27 | 28 | def downgrade() -> None: 29 | # ### commands auto generated by Alembic - please adjust! ### 30 | op.add_column('agent_executions', sa.Column('tokens', sa.INTEGER(), autoincrement=False, nullable=True)) 31 | op.add_column('agent_executions', sa.Column('calls', sa.INTEGER(), autoincrement=False, nullable=True)) 32 | op.drop_column('agent_executions', 'num_of_tokens') 33 | op.drop_column('agent_executions', 'num_of_calls') 34 | # ### end Alembic commands ### 35 | -------------------------------------------------------------------------------- /migrations/versions/3867bb00a495_added_first_login_source.py: -------------------------------------------------------------------------------- 1 | """added_first_login_source 2 | 3 | Revision ID: 3867bb00a495 4 | Revises: 661ec8a4c32e 5 | Create Date: 2023-09-15 02:06:24.006555 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '3867bb00a495' 14 | down_revision = '661ec8a4c32e' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('users', sa.Column('first_login_source', sa.String(), nullable=True)) 22 | # ### end Alembic commands ### 23 | 24 | 25 | def downgrade() -> None: 26 | # ### commands auto generated by Alembic - please adjust! ### 27 | op.drop_column('users', 'first_login_source') 28 | # ### end Alembic commands ### 29 | -------------------------------------------------------------------------------- /migrations/versions/40affbf3022b_add_filter_colume_in_webhooks.py: -------------------------------------------------------------------------------- 1 | """add filter colume in webhooks 2 | 3 | Revision ID: 40affbf3022b 4 | Revises: 5d5f801f28e7 5 | Create Date: 2023-08-28 12:30:35.171176 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '40affbf3022b' 14 | down_revision = '5d5f801f28e7' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('webhooks', sa.Column('filters', sa.JSON(), nullable=True)) 22 | # ### end Alembic commands ### 23 | 24 | 25 | def downgrade() -> None: 26 | # ### commands auto generated by Alembic - please adjust! ### 27 | op.drop_column('webhooks', 'filters') 28 | # ### end Alembic commands ### 29 | -------------------------------------------------------------------------------- /migrations/versions/467e85d5e1cd_updated_resources_added_exec_id.py: -------------------------------------------------------------------------------- 1 | """updated_resources_added_exec_id 2 | 3 | Revision ID: 467e85d5e1cd 4 | Revises: ba60b12ae109 5 | Create Date: 2023-07-10 08:54:46.702652 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '467e85d5e1cd' 14 | down_revision = 'ba60b12ae109' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('resources', sa.Column('agent_execution_id', sa.Integer(), nullable=True)) 22 | # ### end Alembic commands ### 23 | 24 | 25 | def downgrade() -> None: 26 | # ### commands auto generated by Alembic - please adjust! ### 27 | op.drop_column('resources', 'agent_execution_id') 28 | # ### end Alembic commands ### 29 | -------------------------------------------------------------------------------- /migrations/versions/516ecc1c723d_adding_marketplace_template_id_to_agent_.py: -------------------------------------------------------------------------------- 1 | """adding marketplace_template_id to agent tempaltes 2 | 3 | Revision ID: 516ecc1c723d 4 | Revises: 8962bed0d809 5 | Create Date: 2023-06-13 17:10:06.262764 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '516ecc1c723d' 14 | down_revision = '8962bed0d809' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | op.add_column('agent_templates', sa.Column('marketplace_template_id', sa.Integer(), nullable=True)) 21 | 22 | 23 | def downgrade() -> None: 24 | op.drop_column('agent_templates', sa.Column('marketplace_template_id', sa.Integer(), nullable=True)) 25 | -------------------------------------------------------------------------------- /migrations/versions/5184645e9f12_add_question_to_agent_execution_.py: -------------------------------------------------------------------------------- 1 | """add question to agent execution permission 2 | 3 | Revision ID: 5184645e9f12 4 | Revises: 9419b3340af7 5 | Create Date: 2023-07-21 08:16:14.702389 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '5184645e9f12' 14 | down_revision = '9419b3340af7' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | op.add_column('agent_execution_permissions', sa.Column('question', sa.Text(), nullable=True)) 21 | 22 | 23 | def downgrade() -> None: 24 | op.drop_column('agent_execution_permissions', "question") 25 | -------------------------------------------------------------------------------- /migrations/versions/520aa6776347_create_models_config.py: -------------------------------------------------------------------------------- 1 | """create models config 2 | 3 | Revision ID: 520aa6776347 4 | Revises: 71e3980d55f5 5 | Create Date: 2023-08-01 07:48:13.724938 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '520aa6776347' 14 | down_revision = '446884dcae58' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.create_table('models_config', 22 | sa.Column('id', sa.Integer(), nullable=False), 23 | sa.Column('provider', sa.String(), nullable=False), 24 | sa.Column('api_key', sa.String(), nullable=False), 25 | sa.Column('org_id', sa.Integer(), nullable=False), 26 | sa.Column('created_at', sa.DateTime(), nullable=True), 27 | sa.Column('updated_at', sa.DateTime(), nullable=True), 28 | sa.PrimaryKeyConstraint('id') 29 | ) 30 | # ### end Alembic commands ### 31 | 32 | 33 | def downgrade() -> None: 34 | # ### commands auto generated by Alembic - please adjust! ### 35 | op.drop_table('models_config') 36 | # ### end Alembic commands ### 37 | -------------------------------------------------------------------------------- /migrations/versions/661ec8a4c32e_open_ai_error_handling.py: -------------------------------------------------------------------------------- 1 | """open_ai_error_handling 2 | 3 | Revision ID: 661ec8a4c32e 4 | Revises: 40affbf3022b 5 | Create Date: 2023-09-07 10:41:07.462436 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '661ec8a4c32e' 14 | down_revision = 'c4f2f6ba602a' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('agent_execution_feeds', sa.Column('error_message', sa.String(), nullable=True)) 22 | op.add_column('agent_executions', sa.Column('last_shown_error_id', sa.Integer(), nullable=True)) 23 | # ### end Alembic commands ### 24 | 25 | 26 | def downgrade() -> None: 27 | # ### commands auto generated by Alembic - please adjust! ### 28 | op.drop_column('agent_executions', 'last_shown_error_id') 29 | op.drop_column('agent_execution_feeds', 'error_message') 30 | # ### end Alembic commands ### 31 | -------------------------------------------------------------------------------- /migrations/versions/83424de1347e_added_agent_execution_config.py: -------------------------------------------------------------------------------- 1 | """added_agent_execution_config 2 | 3 | Revision ID: 83424de1347e 4 | Revises: c02f3d759bf3 5 | Create Date: 2023-07-03 22:42:50.091762 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '83424de1347e' 14 | down_revision = 'c02f3d759bf3' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.create_table('agent_execution_configs', 22 | sa.Column('id', sa.Integer(), nullable=False), 23 | sa.Column('agent_execution_id', sa.Integer(), nullable=True), 24 | sa.Column('key', sa.String(), nullable=True), 25 | sa.Column('value', sa.Text(), nullable=True), 26 | sa.Column('created_at', sa.DateTime(), nullable=True), 27 | sa.Column('updated_at', sa.DateTime(), nullable=True), 28 | sa.PrimaryKeyConstraint('id') 29 | ) 30 | # ### end Alembic commands ### 31 | 32 | 33 | def downgrade() -> None: 34 | # ### commands auto generated by Alembic - please adjust! ### 35 | op.drop_table('agent_execution_configs') 36 | # ### end Alembic commands ### 37 | -------------------------------------------------------------------------------- /migrations/versions/9270eb5a8475_local_llms.py: -------------------------------------------------------------------------------- 1 | """local_llms 2 | 3 | Revision ID: 9270eb5a8475 4 | Revises: 3867bb00a495 5 | Create Date: 2023-10-04 09:26:33.865424 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '9270eb5a8475' 14 | down_revision = '3867bb00a495' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('models', sa.Column('context_length', sa.Integer(), nullable=True)) 22 | # ### end Alembic commands ### 23 | 24 | 25 | def downgrade() -> None: 26 | # ### commands auto generated by Alembic - please adjust! ### 27 | op.drop_column('models', 'context_length') 28 | # ### end Alembic commands ### 29 | -------------------------------------------------------------------------------- /migrations/versions/be1d922bf2ad_create_call_logs_table.py: -------------------------------------------------------------------------------- 1 | """create call logs table 2 | 3 | Revision ID: be1d922bf2ad 4 | Revises: 2fbd6472112c 5 | Create Date: 2023-08-08 08:42:37.148178 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = 'be1d922bf2ad' 14 | down_revision = '520aa6776347' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.create_table('call_logs', 22 | sa.Column('id', sa.Integer(), nullable=False), 23 | sa.Column('agent_execution_name', sa.String(), nullable=False), 24 | sa.Column('agent_id', sa.Integer(), nullable=False), 25 | sa.Column('tokens_consumed', sa.Integer(), nullable=False), 26 | sa.Column('tool_used', sa.String(), nullable=False), 27 | sa.Column('model', sa.String(), nullable=True), 28 | sa.Column('org_id', sa.Integer(), nullable=False), 29 | sa.Column('created_at', sa.DateTime(), nullable=True), 30 | sa.Column('updated_at', sa.DateTime(), nullable=True), 31 | sa.PrimaryKeyConstraint('id') 32 | ) 33 | # ### end Alembic commands ### 34 | 35 | 36 | def downgrade() -> None: 37 | # ### commands auto generated by Alembic - please adjust! ### 38 | op.drop_table('call_logs') 39 | # ### end Alembic commands ### 40 | -------------------------------------------------------------------------------- /migrations/versions/c02f3d759bf3_add_summary_to_resource.py: -------------------------------------------------------------------------------- 1 | """add summary to resource 2 | 3 | Revision ID: c02f3d759bf3 4 | Revises: 1d54db311055 5 | Create Date: 2023-06-27 05:07:29.016704 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = 'c02f3d759bf3' 14 | down_revision = 'c5c19944c90c' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ## 21 | op.add_column('resources', sa.Column('summary', sa.Text(), nullable=True)) 22 | # ### end Alembic commands ### 23 | 24 | 25 | def downgrade() -> None: 26 | # ### commands auto generated by Alembic - please adjust! ### 27 | op.drop_column('resources', 'summary') 28 | # ### end Alembic commands ### 29 | -------------------------------------------------------------------------------- /migrations/versions/c4f2f6ba602a_agent_workflow_wait_step.py: -------------------------------------------------------------------------------- 1 | """agent_workflow_wait_step 2 | 3 | Revision ID: c4f2f6ba602a 4 | Revises: 40affbf3022b 5 | Create Date: 2023-09-04 05:34:10.195248 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = 'c4f2f6ba602a' 14 | down_revision = '40affbf3022b' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.create_table('agent_workflow_step_waits', 22 | sa.Column('id', sa.Integer(), nullable=False), 23 | sa.Column('name', sa.String(), nullable=True), 24 | sa.Column('description', sa.String(), nullable=True), 25 | sa.Column('unique_id', sa.String(), nullable=True), 26 | sa.Column('delay', sa.Integer(), nullable=True), 27 | sa.Column('wait_begin_time', sa.DateTime(), nullable=True), 28 | sa.Column('status', sa.String(), nullable=True), 29 | sa.Column('created_at', sa.DateTime(), nullable=True), 30 | sa.Column('updated_at', sa.DateTime(), nullable=True), 31 | sa.PrimaryKeyConstraint('id') 32 | ) 33 | # ### end Alembic commands ### 34 | 35 | 36 | def downgrade() -> None: 37 | # ### commands auto generated by Alembic - please adjust! ### 38 | op.drop_table('agent_workflow_step_waits') 39 | # ### end Alembic commands ### 40 | -------------------------------------------------------------------------------- /migrations/versions/cac478732572_delete_agent_feature.py: -------------------------------------------------------------------------------- 1 | """delete_agent_feature 2 | 3 | Revision ID: cac478732572 4 | Revises: e39295ec089c 5 | Create Date: 2023-07-13 17:18:42.003412 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | # revision identifiers, used by Alembic. 12 | revision = 'cac478732572' 13 | down_revision = 'e39295ec089c' 14 | branch_labels = None 15 | depends_on = None 16 | 17 | 18 | def upgrade() -> None: 19 | op.add_column('agents', sa.Column('is_deleted', sa.Boolean(), nullable=True, server_default=sa.false())) 20 | 21 | 22 | def downgrade() -> None: 23 | op.drop_column('agents', 'is_deleted') 24 | -------------------------------------------------------------------------------- /migrations/versions/d8315244ea43_updated_tool_configs.py: -------------------------------------------------------------------------------- 1 | """updated_tool_configs 2 | 3 | Revision ID: d8315244ea43 4 | Revises: 71e3980d55f5 5 | Create Date: 2023-08-01 11:11:32.725355 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = 'd8315244ea43' 14 | down_revision = '71e3980d55f5' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('tool_configs', sa.Column('key_type', sa.String(), nullable=True)) 22 | op.add_column('tool_configs', sa.Column('is_secret', sa.Boolean(), nullable=True)) 23 | op.add_column('tool_configs', sa.Column('is_required', sa.Boolean(), nullable=True)) 24 | # ### end Alembic commands ### 25 | 26 | 27 | def downgrade() -> None: 28 | # ### commands auto generated by Alembic - please adjust! ### 29 | op.drop_column('tool_configs', 'is_required') 30 | op.drop_column('tool_configs', 'is_secret') 31 | op.drop_column('tool_configs', 'key_type') 32 | # ### end Alembic commands ### 33 | -------------------------------------------------------------------------------- /migrations/versions/d9b3436197eb_renaming_templates.py: -------------------------------------------------------------------------------- 1 | """renaming templates 2 | 3 | Revision ID: d9b3436197eb 4 | Revises: 3356a2f89a33 5 | Create Date: 2023-06-10 09:28:28.262705 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = 'd9b3436197eb' 14 | down_revision = '3356a2f89a33' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade() -> None: 20 | op.rename_table('agent_templates', 'agent_workflows') 21 | op.rename_table('agent_template_steps', 'agent_workflow_steps') 22 | with op.batch_alter_table('agent_workflow_steps') as bop: 23 | bop.alter_column('agent_template_id', new_column_name='agent_workflow_id') 24 | with op.batch_alter_table('agents') as bop: 25 | bop.alter_column('agent_template_id', new_column_name='agent_workflow_id') 26 | 27 | 28 | def downgrade() -> None: 29 | op.rename_table('agent_workflows', 'agent_templates') 30 | op.rename_table('agent_workflow_steps', 'agent_template_steps') 31 | with op.batch_alter_table('agent_templates') as bop: 32 | bop.alter_column('agent_workflow_id', new_column_name='agent_template_id') 33 | with op.batch_alter_table('agents') as bop: 34 | bop.alter_column('agent_workflow_id', new_column_name='agent_template_id') 35 | -------------------------------------------------------------------------------- /nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | location / { 5 | proxy_pass http://gui:3000; 6 | proxy_set_header Host $host; 7 | proxy_set_header X-Real-IP $remote_addr; 8 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 9 | } 10 | 11 | location /api { 12 | proxy_pass http://backend:8001; 13 | client_max_body_size 50M; 14 | proxy_set_header Host $host; 15 | proxy_set_header X-Real-IP $remote_addr; 16 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 17 | rewrite ^/api/(.*) /$1 break; 18 | } 19 | location /_next/webpack-hmr { 20 | proxy_pass http://gui:3000; 21 | proxy_http_version 1.1; 22 | proxy_set_header Upgrade $http_upgrade; 23 | proxy_set_header Connection "upgrade"; 24 | proxy_set_header Host $host; 25 | proxy_cache_bypass $http_upgrade; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "axios": "^1.4.0", 4 | "react-toastify": "^9.1.3" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /run.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Checking if config.yaml file exists... 3 | if not exist config.yaml ( 4 | echo ERROR: config.yaml file not found. Please create the config.yaml file. 5 | exit /b 1 6 | ) 7 | echo Checking if virtual environment is activated... 8 | if not defined VIRTUAL_ENV ( 9 | echo Virtual environment not activated. Creating and activating virtual environment... 10 | python3 -m venv venv 11 | if errorlevel 1 ( 12 | echo Error: Failed to create virtual environment. 13 | exit /b 1 14 | ) 15 | call venv\Scripts\activate.bat 16 | ) else ( 17 | echo Virtual environment is already activated. 18 | ) 19 | echo Checking requirements... 20 | pip show -r requirements.txt >nul 2>&1 21 | if errorlevel 1 ( 22 | echo Installing requirements... 23 | pip install -r requirements.txt >nul 2>&1 24 | ) else ( 25 | echo All packages are already installed. 26 | ) 27 | echo Running test.py with python... 28 | python test.py 29 | if errorlevel 1 ( 30 | echo Running test.py with python3... 31 | python3 test.py 32 | ) -------------------------------------------------------------------------------- /run_gui.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | api_process="" 4 | ui_process="" 5 | 6 | function check_command() { 7 | command -v "$1" >/dev/null 2>&1 8 | if [ $? -ne 0 ]; then 9 | echo "$1 is not installed. Please install $1 to proceed." 10 | exit 1 11 | fi 12 | } 13 | 14 | function run_npm_commands() { 15 | cd gui 16 | npm install 17 | if [ $? -ne 0 ]; then 18 | echo "Error during 'npm install'. Exiting." 19 | exit 1 20 | fi 21 | 22 | npm run build 23 | if [ $? -ne 0 ]; then 24 | echo "Error during 'npm run build'. Exiting." 25 | exit 1 26 | fi 27 | 28 | cd .. 29 | } 30 | 31 | function run_server() { 32 | uvicorn main:app --host 0.0.0.0 --port 8000 & 33 | api_process=$! 34 | cd gui && npm run dev & 35 | ui_process=$! 36 | } 37 | 38 | function cleanup() { 39 | echo "Shutting down processes..." 40 | kill $api_process 41 | kill $ui_process 42 | echo "Processes terminated. Exiting." 43 | exit 1 44 | } 45 | 46 | trap cleanup SIGINT 47 | 48 | check_command "node" 49 | check_command "npm" 50 | check_command "uvicorn" 51 | 52 | run_npm_commands 53 | run_server 54 | 55 | wait $api_process -------------------------------------------------------------------------------- /static/super-agi-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/static/super-agi-1.png -------------------------------------------------------------------------------- /superagi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/__init__.py -------------------------------------------------------------------------------- /superagi/agent/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/agent/__init__.py -------------------------------------------------------------------------------- /superagi/agent/common_types.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | 3 | 4 | class ToolExecutorResponse(BaseModel): 5 | status: str 6 | result: str = None 7 | retry: bool = False 8 | is_permission_required: bool = False 9 | permission_id: int = None 10 | 11 | 12 | class TaskExecutorResponse(BaseModel): 13 | status: str 14 | retry: bool 15 | -------------------------------------------------------------------------------- /superagi/agent/prompts/agent_queue_input.txt: -------------------------------------------------------------------------------- 1 | Use the below instruction and break down the last response to an individual array of items that can be inserted into the queue. 2 | 3 | INSTRUCTION: `{instruction}` 4 | 5 | Respond with an array of items that are JSON parsable and can be inserted into the queue. 6 | Ignore the header row in the case of csv. 7 | -------------------------------------------------------------------------------- /superagi/agent/prompts/agent_recursive_summary.txt: -------------------------------------------------------------------------------- 1 | AI, you are provided with a previous summary of interactions between the system, user, and assistant, as well as additional conversations that were not included in the original summary. 2 | If the previous summary is empty, your task is to create a summary based solely on the new interactions. 3 | 4 | Previous Summary: {previous_ltm_summary} 5 | 6 | {past_messages} 7 | 8 | If the previous summary is not empty, your final summary should integrate the new interactions into the existing summary to create a comprehensive recap of all interactions. 9 | If the previous summary is empty, your summary should encapsulate the main points of the new conversations. 10 | In both cases, highlight the key issues discussed, decisions made, and any actions assigned. 11 | Please ensure that the final summary does not exceed {char_limit} characters. -------------------------------------------------------------------------------- /superagi/agent/prompts/agent_summary.txt: -------------------------------------------------------------------------------- 1 | AI, your task is to generate a concise summary of the previous interactions between the system, user, and assistant. 2 | The interactions are as follows: 3 | 4 | {past_messages} 5 | 6 | This summary should encapsulate the main points of the conversation, highlighting the key issues discussed, decisions made, and any actions assigned. 7 | It should serve as a recap of the past interaction, providing a clear understanding of the conversation's context and outcomes. 8 | Please ensure that the summary does not exceed {char_limit} characters. -------------------------------------------------------------------------------- /superagi/agent/prompts/agent_tool_input.txt: -------------------------------------------------------------------------------- 1 | {tool_name} is the most suitable tool for the given instruction, use {tool_name} to perform the below instruction which lets you achieve the high level goal. 2 | 3 | High-Level GOAL: 4 | `{goals}` 5 | 6 | INSTRUCTION: `{instruction}` 7 | 8 | Respond with tool name and tool arguments to achieve the instruction. 9 | 10 | {tool_schema} 11 | 12 | Respond with only valid JSON conforming to the following json schema. You should generate JSON as output and not JSON schema. 13 | 14 | JSON Schema: 15 | { 16 | "$schema": "http://json-schema.org/draft-07/schema#", 17 | "type": "object", 18 | "properties": { 19 | "name": { 20 | "type": "string", 21 | "description": "{tool_name}", 22 | }, 23 | "args": { 24 | "type": "object", 25 | "description": "tool arguments", 26 | } 27 | }, 28 | "required": ["name", "args"] 29 | } -------------------------------------------------------------------------------- /superagi/agent/prompts/agent_tool_output.txt: -------------------------------------------------------------------------------- 1 | Analyze {tool_name} output and follow the instruction to come up with the response: 2 | High-Level GOAL: 3 | `{goals}` 4 | 5 | TOOL OUTPUT: 6 | `{tool_output}` 7 | 8 | INSTRUCTION: `{instruction}` 9 | 10 | Analyze the instruction and respond with one of the below outputs. Response should be one of the below options: 11 | {output_options} -------------------------------------------------------------------------------- /superagi/agent/prompts/create_tasks.txt: -------------------------------------------------------------------------------- 1 | You are an AI assistant to create task. 2 | 3 | High level goal: 4 | {goals} 5 | 6 | {task_instructions} 7 | 8 | You have following incomplete tasks `{pending_tasks}`. You have following completed tasks `{completed_tasks}`. 9 | 10 | Task History: 11 | `{task_history}` 12 | 13 | Based on this, create a single task in plain english to be completed by your AI system ONLY IF REQUIRED to get closer to or fully reach your high level goal. 14 | Don't create any task if it is already covered in incomplete or completed tasks. 15 | Ensure your new task are not deviated from completing the goal. 16 | 17 | Your answer should be an array of tasks in plain english that can be used with JSON.parse() and NOTHING ELSE. Return empty array if no new task is required. 18 | -------------------------------------------------------------------------------- /superagi/agent/prompts/initialize_tasks.txt: -------------------------------------------------------------------------------- 1 | You are a task-generating AI known as SuperAGI. You are not a part of any system or device. Your role is to understand the goals presented to you, identify important components, Go through the instruction provided by the user and construct a thorough execution plan. 2 | 3 | GOALS: 4 | {goals} 5 | 6 | {task_instructions} 7 | 8 | Construct a sequence of actions, not exceeding 3 steps, to achieve this goal. 9 | 10 | Submit your response as a formatted ARRAY of strings, suitable for utilization with JSON.parse(). 11 | 12 | -------------------------------------------------------------------------------- /superagi/agent/prompts/prioritize_tasks.txt: -------------------------------------------------------------------------------- 1 | You are a task prioritization AI assistant. 2 | 3 | High level goal: 4 | {goals} 5 | 6 | {task_instructions} 7 | 8 | You have following incomplete tasks `{pending_tasks}`. You have following completed tasks `{completed_tasks}`. 9 | 10 | Based on this, evaluate the incomplete tasks and sort them in the order of execution. In output first task will be executed first and so on. 11 | Remove if any tasks are unnecessary or duplicate incomplete tasks. Remove tasks if they are already covered in completed tasks. 12 | Remove tasks if it does not help in achieving the main goal. 13 | 14 | Your answer should be an array of strings that can be used with JSON.parse() and NOTHING ELSE. -------------------------------------------------------------------------------- /superagi/agent/types/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/agent/types/__init__.py -------------------------------------------------------------------------------- /superagi/agent/types/agent_execution_status.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class AgentExecutionStatus(Enum): 5 | RUNNING = 'RUNNING' 6 | WAITING_FOR_PERMISSION = 'WAITING_FOR_PERMISSION' 7 | ITERATION_LIMIT_EXCEEDED = 'ITERATION_LIMIT_EXCEEDED' 8 | WAIT_STEP = 'WAIT_STEP' 9 | COMPLETED = 'COMPLETED' 10 | 11 | @classmethod 12 | def get_agent_execution_status(cls, store): 13 | if store is None: 14 | raise ValueError("Storage type cannot be None.") 15 | store = store.upper() 16 | if store in cls.__members__: 17 | return cls[store] 18 | raise ValueError(f"{store} is not a valid storage name.") 19 | -------------------------------------------------------------------------------- /superagi/agent/types/agent_workflow_step_action_types.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class AgentWorkflowStepAction(Enum): 5 | ITERATION_WORKFLOW = 'ITERATION_WORKFLOW' 6 | TOOL = 'TOOL' 7 | WAIT_STEP = 'WAIT_STEP' 8 | 9 | 10 | @classmethod 11 | def get_agent_workflow_action_type(cls, store): 12 | if store is None: 13 | raise ValueError("Storage type cannot be None.") 14 | store = store.upper() 15 | if store in cls.__members__: 16 | return cls[store] 17 | raise ValueError(f"{store} is not a valid storage name.") 18 | -------------------------------------------------------------------------------- /superagi/agent/types/wait_step_status.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class AgentWorkflowStepWaitStatus(Enum): 5 | PENDING = 'PENDING' 6 | WAITING = 'WAITING' 7 | COMPLETED = 'COMPLETED' 8 | 9 | @classmethod 10 | def get_agent_workflow_step_wait_status(cls, store): 11 | if store is None: 12 | raise ValueError("Storage type cannot be None.") 13 | store = store.upper() 14 | if store in cls.__members__: 15 | return cls[store] 16 | raise ValueError(f"{store} is not a valid storage name.") 17 | -------------------------------------------------------------------------------- /superagi/apm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/apm/__init__.py -------------------------------------------------------------------------------- /superagi/apm/event_handler.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from typing import Optional, Dict 3 | from sqlalchemy.exc import SQLAlchemyError 4 | from sqlalchemy.orm import Session 5 | 6 | from superagi.models.events import Event 7 | 8 | class EventHandler: 9 | 10 | def __init__(self, session: Session): 11 | self.session = session 12 | 13 | def create_event(self, event_name: str, event_property: Dict, agent_id: int, 14 | org_id: int, event_value: int = 1) -> Optional[Event]: 15 | try: 16 | event = Event( 17 | event_name=event_name, 18 | event_value=event_value, 19 | event_property=event_property, 20 | agent_id=agent_id, 21 | org_id=org_id, 22 | ) 23 | self.session.add(event) 24 | self.session.commit() 25 | return event 26 | except SQLAlchemyError as err: 27 | logging.error(f"Error while creating event: {str(err)}") 28 | return None -------------------------------------------------------------------------------- /superagi/config/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/config/__init__.py -------------------------------------------------------------------------------- /superagi/controllers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/controllers/__init__.py -------------------------------------------------------------------------------- /superagi/controllers/agent_workflow.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter 2 | from fastapi import Depends 3 | from fastapi_sqlalchemy import db 4 | 5 | from superagi.helper.auth import get_user_organisation 6 | from superagi.models.workflows.agent_workflow import AgentWorkflow 7 | 8 | router = APIRouter() 9 | 10 | 11 | @router.get("/list", status_code=201) 12 | def list_workflows(organisation=Depends(get_user_organisation)): 13 | """ 14 | Lists agent workflows. 15 | 16 | Args: 17 | organisation: User's organisation. 18 | 19 | Returns: 20 | list: A list of dictionaries representing the agent workflows. 21 | 22 | """ 23 | 24 | workflows = db.session.query(AgentWorkflow).all() 25 | 26 | output_json = [] 27 | for workflow in workflows: 28 | output_json.append(workflow.to_dict()) 29 | return output_json 30 | -------------------------------------------------------------------------------- /superagi/controllers/knowledge_configs.py: -------------------------------------------------------------------------------- 1 | from fastapi_sqlalchemy import db 2 | from fastapi import HTTPException, Depends, Query, status 3 | from fastapi import APIRouter 4 | from superagi.config.config import get_config 5 | from superagi.helper.auth import check_auth 6 | from superagi.models.knowledge_configs import KnowledgeConfigs 7 | from fastapi_jwt_auth import AuthJWT 8 | 9 | router = APIRouter() 10 | 11 | @router.get("/marketplace/details/{knowledge_id}") 12 | def get_marketplace_knowledge_configs(knowledge_id: int): 13 | knowledge_configs = db.session.query(KnowledgeConfigs).filter(KnowledgeConfigs.knowledge_id == knowledge_id).all() 14 | return knowledge_configs 15 | 16 | -------------------------------------------------------------------------------- /superagi/controllers/marketplace_stats.py: -------------------------------------------------------------------------------- 1 | from fastapi_sqlalchemy import db 2 | from fastapi import HTTPException, Depends, Query, status 3 | from fastapi import APIRouter 4 | from superagi.config.config import get_config 5 | from superagi.models.marketplace_stats import MarketPlaceStats 6 | from superagi.models.vector_dbs import Vectordbs 7 | 8 | router = APIRouter() 9 | 10 | @router.get("/knowledge/downloads/{knowledge_id}") 11 | def count_knowledge_downloads(knowledge_id: int): 12 | download_number = db.session.query(MarketPlaceStats).filter(MarketPlaceStats.reference_id == knowledge_id, MarketPlaceStats.reference_name == "KNOWLEDGE", MarketPlaceStats.key == "download_count").first() 13 | if download_number is None: 14 | downloads = 0 15 | else: 16 | downloads = download_number.value 17 | return downloads -------------------------------------------------------------------------------- /superagi/controllers/types/agent_execution_config.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | from typing import List, Optional 3 | from pydantic import BaseModel 4 | from datetime import datetime 5 | 6 | 7 | class AgentRunIn(BaseModel): 8 | status: Optional[str] 9 | name: Optional[str] 10 | agent_id: Optional[int] 11 | last_execution_time: Optional[datetime] 12 | num_of_calls: Optional[int] 13 | num_of_tokens: Optional[int] 14 | current_step_id: Optional[int] 15 | permission_id: Optional[int] 16 | goal: Optional[List[str]] 17 | instruction: Optional[List[str]] 18 | agent_workflow: str 19 | constraints: List[str] 20 | toolkits: List[int] 21 | tools: List[int] 22 | exit: str 23 | iteration_interval: int 24 | model: str 25 | permission_type: str 26 | LTM_DB: str 27 | max_iterations: int 28 | user_timezone: Optional[str] 29 | knowledge: Optional[int] 30 | 31 | class Config: 32 | orm_mode = True -------------------------------------------------------------------------------- /superagi/controllers/types/agent_publish_config.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | from pydantic import BaseModel 3 | 4 | class AgentPublish(BaseModel): 5 | name: str 6 | description: str 7 | agent_template_id: int 8 | goal: Optional[List[str]] 9 | instruction: Optional[List[str]] 10 | constraints: List[str] 11 | toolkits: List[int] 12 | tools: List[int] 13 | exit: str 14 | iteration_interval: int 15 | model: str 16 | permission_type: str 17 | LTM_DB: str 18 | max_iterations: int 19 | user_timezone: Optional[str] 20 | knowledge: Optional[int] 21 | 22 | class Config: 23 | orm_mode = True -------------------------------------------------------------------------------- /superagi/controllers/types/agent_schedule.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | from typing import Optional 3 | from datetime import datetime 4 | 5 | class AgentScheduleInput(BaseModel): 6 | agent_id: Optional[int] 7 | start_time: datetime 8 | recurrence_interval: Optional[str] = None 9 | expiry_date: Optional[datetime] = None 10 | expiry_runs: Optional[int] = -1 11 | -------------------------------------------------------------------------------- /superagi/controllers/types/agent_with_config_schedule.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | from superagi.controllers.types.agent_schedule import AgentScheduleInput 3 | from superagi.controllers.types.agent_with_config import AgentConfigInput 4 | 5 | 6 | class AgentConfigSchedule(BaseModel): 7 | agent_config: AgentConfigInput 8 | schedule: AgentScheduleInput -------------------------------------------------------------------------------- /superagi/controllers/types/models_types.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class ModelsTypes(Enum): 4 | MARKETPLACE = "Marketplace" 5 | CUSTOM = "Custom" 6 | 7 | @classmethod 8 | def get_models_types(cls, model_type): 9 | if model_type is None: 10 | raise ValueError("Queue status type cannot be None.") 11 | model_type = model_type.upper() 12 | if model_type in cls.__members__: 13 | return cls[model_type] 14 | raise ValueError(f"{model_type} is not a valid storage name.") -------------------------------------------------------------------------------- /superagi/helper/error_handler.py: -------------------------------------------------------------------------------- 1 | from superagi.models.agent_execution import AgentExecution 2 | from superagi.models.agent_execution_feed import AgentExecutionFeed 3 | 4 | class ErrorHandler: 5 | 6 | def handle_openai_errors(session, agent_id, agent_execution_id, error_message): 7 | execution = session.query(AgentExecution).filter(AgentExecution.id == agent_execution_id).first() 8 | agent_feed = AgentExecutionFeed(agent_execution_id=agent_execution_id, agent_id=agent_id, role="system", feed="", error_message=error_message, feed_group_id=execution.current_feed_group_id) 9 | session.add(agent_feed) 10 | session.commit() -------------------------------------------------------------------------------- /superagi/helper/imap_email.py: -------------------------------------------------------------------------------- 1 | import imaplib 2 | 3 | 4 | class ImapEmail: 5 | 6 | def imap_open(self, imap_folder, email_sender, email_password, imap_server) -> imaplib.IMAP4_SSL: 7 | """ 8 | Function to open an IMAP connection to the email server. 9 | 10 | Args: 11 | imap_folder (str): The folder to open. 12 | email_sender (str): The email address of the sender. 13 | email_password (str): The password of the sender. 14 | 15 | Returns: 16 | imaplib.IMAP4_SSL: The IMAP connection. 17 | """ 18 | conn = imaplib.IMAP4_SSL(imap_server) 19 | conn.login(email_sender, email_password) 20 | conn.select(imap_folder) 21 | return conn 22 | 23 | def adjust_imap_folder(self, imap_folder, email_sender) -> str: 24 | """ 25 | Function to adjust the IMAP folder based on the email address of the sender. 26 | 27 | Args: 28 | imap_folder (str): The folder to open. 29 | email_sender (str): The email address of the sender. 30 | 31 | Returns: 32 | str: The adjusted IMAP folder. 33 | """ 34 | if "@gmail" in email_sender.lower(): 35 | if "sent" in imap_folder.lower(): 36 | return '"[Gmail]/Sent Mail"' 37 | if "draft" in imap_folder.lower(): 38 | return '"[Gmail]/Drafts"' 39 | return imap_folder 40 | -------------------------------------------------------------------------------- /superagi/helper/llm_loader.py: -------------------------------------------------------------------------------- 1 | from llama_cpp import Llama 2 | from llama_cpp import LlamaGrammar 3 | from superagi.config.config import get_config 4 | from superagi.lib.logger import logger 5 | 6 | 7 | class LLMLoader: 8 | _instance = None 9 | _model = None 10 | _grammar = None 11 | 12 | def __new__(cls, *args, **kwargs): 13 | if cls._instance is None: 14 | cls._instance = super(LLMLoader, cls).__new__(cls) 15 | return cls._instance 16 | 17 | def __init__(self, context_length): 18 | self.context_length = context_length 19 | 20 | @property 21 | def model(self): 22 | if self._model is None: 23 | try: 24 | self._model = Llama( 25 | model_path="/app/local_model_path", n_ctx=self.context_length, n_gpu_layers=int(get_config('GPU_LAYERS', '-1'))) 26 | except Exception as e: 27 | logger.error(e) 28 | return self._model 29 | 30 | @property 31 | def grammar(self): 32 | if self._grammar is None: 33 | try: 34 | self._grammar = LlamaGrammar.from_file( 35 | "superagi/llms/grammar/json.gbnf") 36 | except Exception as e: 37 | logger.error(e) 38 | return self._grammar 39 | -------------------------------------------------------------------------------- /superagi/helper/models_helper.py: -------------------------------------------------------------------------------- 1 | from superagi.llms.hugging_face import HuggingFace 2 | 3 | class ModelsHelper: 4 | @staticmethod 5 | def validate_end_point(model_api_key, end_point, model_provider): 6 | response = {"success": True} 7 | 8 | if (model_provider == 'Hugging Face'): 9 | try: 10 | result = HuggingFace(api_key=model_api_key, end_point=end_point).verify_end_point() 11 | except Exception as e: 12 | response['success'] = False 13 | response['error'] = str(e) 14 | else: 15 | response['result'] = result 16 | 17 | return response 18 | 19 | 20 | -------------------------------------------------------------------------------- /superagi/helper/prompt_reader.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | 4 | class PromptReader: 5 | @staticmethod 6 | def read_tools_prompt(current_file: str, prompt_file: str) -> str: 7 | file_path = str(Path(current_file).resolve().parent) + "/prompts/" + prompt_file 8 | try: 9 | f = open(file_path, "r") 10 | file_content = f.read() 11 | f.close() 12 | except FileNotFoundError as e: 13 | print(e.__str__()) 14 | raise e 15 | return file_content 16 | 17 | @staticmethod 18 | def read_agent_prompt(current_file: str, prompt_file: str) -> str: 19 | file_path = str(Path(current_file).resolve().parent) + "/prompts/" + prompt_file 20 | try: 21 | f = open(file_path, "r") 22 | file_content = f.read() 23 | f.close() 24 | except FileNotFoundError as e: 25 | print(e.__str__()) 26 | raise e 27 | return file_content 28 | -------------------------------------------------------------------------------- /superagi/helper/validate_csv.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import pandas as pd 3 | import chardet 4 | from superagi.lib.logger import logger 5 | 6 | def correct_csv_encoding(file_path): 7 | with open(file_path, 'rb') as f: 8 | result = chardet.detect(f.read()) 9 | encoding = result['encoding'] 10 | 11 | if encoding != 'utf-8': 12 | data = [] 13 | with open(file_path, 'r', encoding=encoding) as f: 14 | reader = csv.reader(f, delimiter=',', quotechar='"') 15 | for row in reader: 16 | try: 17 | data.append(row) 18 | except Exception as e: 19 | logger.error(f"An error occurred while processing the file: {e}") 20 | continue 21 | 22 | df = pd.DataFrame(data) 23 | df.to_csv(file_path, encoding='utf-8', index=False) 24 | logger.info("File is converted to utf-8 encoding.") 25 | else: 26 | logger.info("File is already in utf-8 encoding.") -------------------------------------------------------------------------------- /superagi/image_llms/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/image_llms/__init__.py -------------------------------------------------------------------------------- /superagi/image_llms/base_image_llm.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class BaseImageLlm(ABC): 5 | @abstractmethod 6 | def get_image_model(self): 7 | pass 8 | 9 | @abstractmethod 10 | def generate_image(self, prompt: str, size: int = 512, num: int = 2): 11 | pass 12 | -------------------------------------------------------------------------------- /superagi/image_llms/openai_dalle.py: -------------------------------------------------------------------------------- 1 | import openai 2 | 3 | from superagi.config.config import get_config 4 | from superagi.image_llms.base_image_llm import BaseImageLlm 5 | 6 | 7 | class OpenAiDalle(BaseImageLlm): 8 | def __init__(self, api_key, image_model=None, number_of_results=1): 9 | """ 10 | Args: 11 | api_key (str): The OpenAI API key. 12 | image_model (str): The image model. 13 | number_of_results (int): The number of results. 14 | """ 15 | self.number_of_results = number_of_results 16 | self.api_key = api_key 17 | self.image_model = image_model 18 | openai.api_key = api_key 19 | openai.api_base = get_config("OPENAI_API_BASE", "https://api.openai.com/v1") 20 | 21 | def get_image_model(self): 22 | """ 23 | Returns: 24 | str: The image model. 25 | """ 26 | return self.image_model 27 | 28 | def generate_image(self, prompt: str, size: int = 512): 29 | """ 30 | Call the OpenAI image API. 31 | 32 | Args: 33 | prompt (str): The prompt. 34 | size (int): The size. 35 | num (int): The number of images. 36 | 37 | Returns: 38 | dict: The response. 39 | """ 40 | response = openai.Image.create( 41 | prompt=prompt, 42 | n=self.number_of_results, 43 | size=f"{size}x{size}" 44 | ) 45 | return response 46 | -------------------------------------------------------------------------------- /superagi/jobs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/jobs/__init__.py -------------------------------------------------------------------------------- /superagi/llms/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/llms/__init__.py -------------------------------------------------------------------------------- /superagi/llms/base_llm.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class BaseLlm(ABC): 5 | @abstractmethod 6 | def chat_completion(self, prompt): 7 | pass 8 | 9 | @abstractmethod 10 | def get_source(self): 11 | pass 12 | 13 | @abstractmethod 14 | def get_api_key(self): 15 | pass 16 | 17 | @abstractmethod 18 | def get_model(self): 19 | pass 20 | 21 | @abstractmethod 22 | def get_models(self): 23 | pass 24 | 25 | @abstractmethod 26 | def verify_access_key(self): 27 | pass 28 | -------------------------------------------------------------------------------- /superagi/llms/grammar/json.gbnf: -------------------------------------------------------------------------------- 1 | root ::= object 2 | value ::= object | array | string | number | ("true" | "false" | "null") ws 3 | 4 | object ::= 5 | "{" ws ( 6 | string ":" ws value 7 | ("," ws string ":" ws value)* 8 | )? "}" ws 9 | 10 | array ::= 11 | "[" ws ( 12 | value 13 | ("," ws value)* 14 | )? "]" ws 15 | 16 | string ::= 17 | "\"" ( 18 | [^"\\] | 19 | "\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes 20 | )* "\"" ws 21 | 22 | number ::= ("-"? ([0-9] | [1-9] [0-9]*)) ("." [0-9]+)? ([eE] [-+]? [0-9]+)? ws 23 | 24 | # Optional space: by convention, applied in this grammar after literal chars when allowed 25 | ws ::= ([ \t\n] ws)? 26 | -------------------------------------------------------------------------------- /superagi/llms/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/llms/utils/__init__.py -------------------------------------------------------------------------------- /superagi/llms/utils/huggingface_utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/llms/utils/huggingface_utils/__init__.py -------------------------------------------------------------------------------- /superagi/llms/utils/huggingface_utils/public_endpoints.py: -------------------------------------------------------------------------------- 1 | ACCOUNT_VERIFICATION_URL = "https://huggingface.co/api/whoami-v2" -------------------------------------------------------------------------------- /superagi/models/__init__.py: -------------------------------------------------------------------------------- 1 | import glob 2 | from os.path import basename, dirname, isfile, join 3 | 4 | modules = glob.glob(join(dirname(__file__), "*.py")) 5 | __all__ = [basename(f)[:-3] for f in modules if isfile(f) and not f.endswith("__init__.py")] -------------------------------------------------------------------------------- /superagi/models/budget.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import Column, Integer, String, Float 2 | from superagi.models.base_model import DBBaseModel 3 | 4 | 5 | class Budget(DBBaseModel): 6 | """ 7 | Model representing a budget. 8 | 9 | Attributes: 10 | id (Integer): The primary key of the budget. 11 | budget (Float): The budget value. 12 | cycle (String): The cycle of the budget. 13 | """ 14 | 15 | __tablename__ = 'budgets' 16 | 17 | id = Column(Integer, primary_key=True) 18 | budget = Column(Float) 19 | cycle = Column(String) 20 | 21 | def __repr__(self): 22 | """ 23 | Returns a string representation of the Budget object. 24 | 25 | Returns: 26 | str: String representation of the Budget object. 27 | """ 28 | 29 | return (f"Budget(id={self.id}, budget={self.budget}, " 30 | f"cycle='{self.cycle}')") 31 | -------------------------------------------------------------------------------- /superagi/models/types/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/models/types/__init__.py -------------------------------------------------------------------------------- /superagi/models/types/agent_config.py: -------------------------------------------------------------------------------- 1 | from typing import Union 2 | from pydantic import BaseModel 3 | 4 | class AgentConfig(BaseModel): 5 | agent_id: int 6 | key: str 7 | value: Union[str, list] 8 | 9 | def __repr__(self): 10 | return f"AgentConfiguration(id={self.id}, key={self.key}, value={self.value})" 11 | 12 | -------------------------------------------------------------------------------- /superagi/models/types/login_request.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | 3 | 4 | class LoginRequest(BaseModel): 5 | email: str 6 | password: str 7 | -------------------------------------------------------------------------------- /superagi/models/types/validate_llm_api_key_request.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | 3 | 4 | class ValidateAPIKeyRequest(BaseModel): 5 | model_source: str 6 | model_api_key: str 7 | -------------------------------------------------------------------------------- /superagi/models/user.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import Column, Integer, String 2 | 3 | from superagi.models.base_model import DBBaseModel 4 | 5 | 6 | # from pydantic import BaseModel 7 | 8 | class User(DBBaseModel): 9 | """ 10 | Model representing a user. 11 | 12 | Attributes: 13 | id (Integer): The primary key of the user. 14 | name (String): The name of the user. 15 | email (String): The email of the user. 16 | password (String): The password of the user. 17 | organisation_id (Integer): The ID of the associated organisation. 18 | """ 19 | 20 | __tablename__ = 'users' 21 | 22 | id = Column(Integer, primary_key=True, autoincrement=True) 23 | name = Column(String) 24 | email = Column(String, unique=True) 25 | password = Column(String) 26 | organisation_id = Column(Integer) 27 | first_login_source = Column(String) 28 | 29 | def __repr__(self): 30 | """ 31 | Returns a string representation of the User object. 32 | 33 | Returns: 34 | str: String representation of the User object. 35 | """ 36 | 37 | return f"User(id={self.id}, name='{self.name}', email='{self.email}', password='{self.password}'," \ 38 | f"organisation_id={self.organisation_id}, first_login_source={self.first_login_source})" 39 | -------------------------------------------------------------------------------- /superagi/models/webhook_events.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import Column, Integer, Text, String, Boolean, ForeignKey 2 | from sqlalchemy.orm import relationship 3 | from superagi.models.base_model import DBBaseModel 4 | from superagi.models.agent_execution import AgentExecution 5 | 6 | 7 | class WebhookEvents(DBBaseModel): 8 | """ 9 | 10 | Attributes: 11 | 12 | 13 | Methods: 14 | """ 15 | __tablename__ = 'webhook_events' 16 | 17 | id = Column(Integer, primary_key=True) 18 | agent_id=Column(Integer) 19 | run_id = Column(Integer) 20 | event = Column(String) 21 | status = Column(String) 22 | errors= Column(Text) 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /superagi/models/webhooks.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import Column, Integer, Text, String, Boolean, ForeignKey,JSON 2 | from sqlalchemy.orm import relationship 3 | from sqlalchemy.dialects.postgresql import JSONB 4 | from superagi.models.base_model import DBBaseModel 5 | from superagi.models.agent_execution import AgentExecution 6 | 7 | class Webhooks(DBBaseModel): 8 | """ 9 | 10 | Attributes: 11 | 12 | 13 | Methods: 14 | """ 15 | __tablename__ = 'webhooks' 16 | 17 | id = Column(Integer, primary_key=True) 18 | name=Column(String) 19 | org_id = Column(Integer) 20 | url = Column(String) 21 | headers=Column(JSON) 22 | is_deleted=Column(Boolean) 23 | filters=Column(JSON) 24 | -------------------------------------------------------------------------------- /superagi/models/workflows/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/models/workflows/__init__.py -------------------------------------------------------------------------------- /superagi/resource_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/resource_manager/__init__.py -------------------------------------------------------------------------------- /superagi/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/__init__.py -------------------------------------------------------------------------------- /superagi/tools/apollo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/apollo/__init__.py -------------------------------------------------------------------------------- /superagi/tools/apollo/apollo_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | 4 | from superagi.tools.apollo.apollo_search import ApolloSearchTool 5 | from superagi.tools.base_tool import BaseToolkit, BaseTool, ToolConfiguration 6 | from superagi.types.key_type import ToolConfigKeyType 7 | 8 | 9 | class ApolloToolkit(BaseToolkit, ABC): 10 | name: str = "ApolloToolkit" 11 | description: str = "Apollo Tool kit contains all tools related to apollo.io tasks" 12 | 13 | def get_tools(self) -> List[BaseTool]: 14 | return [ApolloSearchTool()] 15 | 16 | def get_env_keys(self) -> List[str]: 17 | return [ToolConfiguration(key="APOLLO_SEARCH_KEY", key_type=ToolConfigKeyType.STRING, is_required=True)] 18 | -------------------------------------------------------------------------------- /superagi/tools/code/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/code/__init__.py -------------------------------------------------------------------------------- /superagi/tools/code/coding_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | 4 | from superagi.tools.base_tool import BaseToolkit, BaseTool, ToolConfiguration 5 | from superagi.tools.code.improve_code import ImproveCodeTool 6 | from superagi.tools.code.write_code import CodingTool 7 | from superagi.tools.code.write_spec import WriteSpecTool 8 | from superagi.tools.code.write_test import WriteTestTool 9 | 10 | 11 | class CodingToolkit(BaseToolkit, ABC): 12 | name: str = "CodingToolkit" 13 | description: str = "Coding Tool kit contains all tools related to coding tasks" 14 | 15 | def get_tools(self) -> List[BaseTool]: 16 | return [CodingTool(), WriteSpecTool(), WriteTestTool(), ImproveCodeTool()] 17 | 18 | def get_env_keys(self) -> List[ToolConfiguration]: 19 | return [] 20 | -------------------------------------------------------------------------------- /superagi/tools/code/prompts/generate_logic.txt: -------------------------------------------------------------------------------- 1 | You typically always place distinct classes in separate files. 2 | Always create a run.sh file which act as the entrypoint of the program, create it intellligently after analyzing the file types 3 | For Python, always generate a suitable requirements.txt file. 4 | For NodeJS, consistently produce an appropriate package.json file. 5 | Always include a brief comment that describes the purpose of the function definition. 6 | Attempt to provide comments that explain complicated logic. 7 | Consistently adhere to best practices for the specified languages, ensuring code is defined as a package or project. 8 | 9 | Preferred Python toolbelt: 10 | - pytest 11 | - dataclasses -------------------------------------------------------------------------------- /superagi/tools/code/prompts/improve_code.txt: -------------------------------------------------------------------------------- 1 | You are a super smart developer. You have been tasked with fixing and filling the function and classes where only the description of code is written without the actual code . There might be placeholders in the code you have to fill in. 2 | You provide fully functioning, well formatted code with few comments, that works and has no bugs. 3 | If the code is already correct and doesn't need change, just return the same code 4 | However, make sure that you only return the improved code, without any additional content. 5 | 6 | 7 | Please structure the improved code as follows: 8 | 9 | ``` 10 | CODE 11 | ``` 12 | 13 | Please return the full new code in same format as the original code 14 | Don't write any explanation or description in your response other than the actual code 15 | 16 | Your high-level goal is: 17 | {goals} 18 | 19 | The content of the file you need to improve is: 20 | {content} 21 | 22 | Only return the code and not any other line 23 | 24 | To start, first analyze the existing code. Check for any function with missing logic inside it and fill the function. 25 | Make sure, that not a single function is empty or contains just comments, there should be function logic inside it 26 | Return fully completed functions by filling the placeholders -------------------------------------------------------------------------------- /superagi/tools/code/prompts/write_spec.txt: -------------------------------------------------------------------------------- 1 | You are a super smart developer who has been asked to make a specification for a program. 2 | 3 | Your high-level goal is: 4 | {goals} 5 | 6 | Please keep in mind the following when creating the specification: 7 | 1. Be super explicit about what the program should do, which features it should have, and give details about anything that might be unclear. 8 | 2. Lay out the names of the core classes, functions, methods that will be necessary, as well as a quick comment on their purpose. 9 | 3. List all non-standard dependencies that will have to be used. 10 | 11 | Write a specification for the following task: 12 | {task} -------------------------------------------------------------------------------- /superagi/tools/code/prompts/write_test.txt: -------------------------------------------------------------------------------- 1 | You are a super smart developer who practices Test Driven Development for writing tests according to a specification. 2 | 3 | Your high-level goal is: 4 | {goals} 5 | 6 | Test Description: 7 | {test_description} 8 | 9 | {spec} 10 | 11 | Test should follow the following format: 12 | FILENAME is the lowercase file name including the file extension, 13 | [LANG] is the markup code block language for the code's language, and [UNIT_TEST_CODE] is the code: 14 | 15 | FILENAME 16 | ```[LANG] 17 | [UNIT_TEST_CODE] 18 | ``` 19 | 20 | The tests should be as simple as possible, but still cover all the functionality described in the specification. 21 | 22 | -------------------------------------------------------------------------------- /superagi/tools/duck_duck_go/README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | # SuperAGI DuckDuckGo Search Tool 6 | 7 | The SuperAGI DuckDuckGo Search Tool helps users perform a DuckDuckGo search and extract snippets and webpages. 8 | 9 | ## ⚙️ Installation 10 | 11 | ### 🛠 **Setting Up of SuperAGI** 12 | 13 | Set up the SuperAGI by following the instructions given (https://github.com/TransformerOptimus/SuperAGI/blob/main/README.MD) 14 | 15 | ## Running SuperAGI DuckDuckGo Search Tool 16 | 17 | You can simply ask your agent about latest information regarding anything in the world and your agent will be able to browse the internet to get that information for you. 18 | -------------------------------------------------------------------------------- /superagi/tools/duck_duck_go/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/duck_duck_go/__init__.py -------------------------------------------------------------------------------- /superagi/tools/duck_duck_go/duck_duck_go_search_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.duck_duck_go.duck_duck_go_search import DuckDuckGoSearchTool 5 | from superagi.types.key_type import ToolConfigKeyType 6 | from superagi.models.tool_config import ToolConfig 7 | 8 | class DuckDuckGoToolkit(BaseToolkit, ABC): 9 | name: str = "DuckDuckGo Search Toolkit" 10 | description: str = "Toolkit containing tools for performing DuckDuckGo search and extracting snippets and webpages" 11 | 12 | def get_tools(self) -> List[BaseTool]: 13 | return [DuckDuckGoSearchTool()] 14 | 15 | def get_env_keys(self) -> List[ToolConfiguration]: 16 | return [ 17 | # Add more config keys specific to your project 18 | ] 19 | -------------------------------------------------------------------------------- /superagi/tools/email/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/email/__init__.py -------------------------------------------------------------------------------- /superagi/tools/file/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/file/__init__.py -------------------------------------------------------------------------------- /superagi/tools/file/file_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.file.append_file import AppendFileTool 5 | from superagi.tools.file.delete_file import DeleteFileTool 6 | from superagi.tools.file.list_files import ListFileTool 7 | from superagi.tools.file.read_file import ReadFileTool 8 | from superagi.tools.file.write_file import WriteFileTool 9 | from superagi.types.key_type import ToolConfigKeyType 10 | from superagi.models.tool_config import ToolConfig 11 | 12 | 13 | class FileToolkit(BaseToolkit, ABC): 14 | name: str = "File Toolkit" 15 | description: str = "File Tool kit contains all tools related to file operations" 16 | 17 | def get_tools(self) -> List[BaseTool]: 18 | return [AppendFileTool(), DeleteFileTool(), ListFileTool(), ReadFileTool(), WriteFileTool()] 19 | 20 | def get_env_keys(self) -> List[ToolConfiguration]: 21 | return [] 22 | -------------------------------------------------------------------------------- /superagi/tools/github/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/github/__init__.py -------------------------------------------------------------------------------- /superagi/tools/github/github_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.github.add_file import GithubAddFileTool 5 | from superagi.tools.github.delete_file import GithubDeleteFileTool 6 | from superagi.tools.github.fetch_pull_request import GithubFetchPullRequest 7 | from superagi.tools.github.search_repo import GithubRepoSearchTool 8 | from superagi.tools.github.review_pull_request import GithubReviewPullRequest 9 | from superagi.types.key_type import ToolConfigKeyType 10 | 11 | 12 | class GitHubToolkit(BaseToolkit, ABC): 13 | name: str = "GitHub Toolkit" 14 | description: str = "GitHub Tool Kit contains all github related to tool" 15 | 16 | def get_tools(self) -> List[BaseTool]: 17 | return [GithubAddFileTool(), GithubDeleteFileTool(), GithubRepoSearchTool(), GithubReviewPullRequest(), 18 | GithubFetchPullRequest()] 19 | 20 | def get_env_keys(self) -> List[ToolConfiguration]: 21 | return [ 22 | ToolConfiguration(key="GITHUB_ACCESS_TOKEN", key_type=ToolConfigKeyType.STRING, is_required= True, is_secret = True), 23 | ToolConfiguration(key="GITHUB_USERNAME", key_type=ToolConfigKeyType.STRING, is_required=True, is_secret=False) 24 | ] 25 | 26 | 27 | -------------------------------------------------------------------------------- /superagi/tools/google_calendar/google_calendar_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from superagi.tools.base_tool import BaseToolkit, BaseTool, ToolConfiguration 3 | from typing import Type, List 4 | from superagi.tools.google_calendar.create_calendar_event import CreateEventCalendarTool 5 | from superagi.tools.google_calendar.delete_calendar_event import DeleteCalendarEventTool 6 | from superagi.tools.google_calendar.list_calendar_events import ListCalendarEventsTool 7 | from superagi.tools.google_calendar.event_details_calendar import EventDetailsCalendarTool 8 | from superagi.types.key_type import ToolConfigKeyType 9 | 10 | class GoogleCalendarToolKit(BaseToolkit, ABC): 11 | name: str = "Google Calendar Toolkit" 12 | description: str = "Google Calendar Tool kit contains all tools related to Google Calendar" 13 | 14 | def get_tools(self) -> List[BaseTool]: 15 | return [CreateEventCalendarTool(), DeleteCalendarEventTool(), ListCalendarEventsTool(), EventDetailsCalendarTool()] 16 | 17 | def get_env_keys(self) -> List[ToolConfiguration]: 18 | return [ 19 | ToolConfiguration(key="GOOGLE_CLIENT_ID", key_type=ToolConfigKeyType.STRING, is_required= True, is_secret = False), 20 | ToolConfiguration(key="GOOGLE_CLIENT_SECRET", key_type=ToolConfigKeyType.STRING, is_required= True, is_secret= True) 21 | ] 22 | -------------------------------------------------------------------------------- /superagi/tools/google_search/README.MD: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | # SuperAGI Google Search Tool 6 | 7 | The SuperAGI Google Search Tool helps users perform a Google search and extract snippets and webpages. 8 | 9 | ## ⚙️ Installation 10 | 11 | ### 🛠 **Setting Up of SuperAGI** 12 | Set up the SuperAGI by following the instructions given (https://github.com/TransformerOptimus/SuperAGI/blob/main/README.MD) 13 | 14 | If you've put the correct Google API key and Custom Search Engine ID, you'll be able to use the Google Search Tool as well. 15 | 16 | ## Running SuperAGI Google Search Tool 17 | 18 | You can simply ask your agent about latest information regarding anything in the world and your agent will be able to browse the internet to get that information for you. -------------------------------------------------------------------------------- /superagi/tools/google_search/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/google_search/__init__.py -------------------------------------------------------------------------------- /superagi/tools/google_search/google_search_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.google_search.google_search import GoogleSearchTool 5 | from superagi.models.tool_config import ToolConfig 6 | from superagi.types.key_type import ToolConfigKeyType 7 | 8 | 9 | class GoogleSearchToolkit(BaseToolkit, ABC): 10 | name: str = "Google Search Toolkit" 11 | description: str = "Toolkit containing tools for performing Google search and extracting snippets and webpages" 12 | 13 | def get_tools(self) -> List[BaseTool]: 14 | return [GoogleSearchTool()] 15 | 16 | def get_env_keys(self) -> List[ToolConfiguration]: 17 | return [ 18 | ToolConfiguration(key="GOOGLE_API_KEY", key_type=ToolConfigKeyType.STRING, is_required= True, is_secret = True), 19 | ToolConfiguration(key="SEARCH_ENGINE_ID", key_type=ToolConfigKeyType.STRING, is_required=True, is_secret=True) 20 | ] 21 | -------------------------------------------------------------------------------- /superagi/tools/google_serp_search/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/google_serp_search/__init__.py -------------------------------------------------------------------------------- /superagi/tools/google_serp_search/google_serp_search_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.google_serp_search.google_serp_search import GoogleSerpTool 5 | from superagi.models.tool_config import ToolConfig 6 | from superagi.types.key_type import ToolConfigKeyType 7 | 8 | class GoogleSerpToolkit(BaseToolkit, ABC): 9 | name: str = "Google SERP Toolkit" 10 | description: str = "Toolkit containing tools for performing Google SERP search and extracting snippets and webpages" 11 | 12 | def get_tools(self) -> List[BaseTool]: 13 | return [GoogleSerpTool()] 14 | 15 | def get_env_keys(self) -> List[ToolConfiguration]: 16 | return [ 17 | ToolConfiguration(key="SERP_API_KEY", key_type=ToolConfigKeyType.STRING, is_required= True, is_secret = True) 18 | ] 19 | -------------------------------------------------------------------------------- /superagi/tools/image_generation/README.MD: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | # SuperAGI Image Generation Tool 6 | 7 | The SuperAGI Image Generation Tool helps you generate an image with a prompt using DALL-E. 8 | 9 | ## ⚙️ Installation 10 | 11 | ### 🛠 **Setting Up of SuperAGI** 12 | Set up the SuperAGI by following the instructions given (https://github.com/TransformerOptimus/SuperAGI/blob/main/README.MD) 13 | 14 | If you've put the correct OpenAI key during the installation, you'd be able to use the Image Generation tool as well. 15 | 16 | ## Running SuperAGI Image Generation Tool 17 | 18 | You can simply put one of the goals of your agent to create an image and the agent will pick up the Image Generation Tool and will place it in the Output folder of the Resource Manager, from where you'll be able to download it. 19 | 20 | -------------------------------------------------------------------------------- /superagi/tools/image_generation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/image_generation/__init__.py -------------------------------------------------------------------------------- /superagi/tools/image_generation/image_generation_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | 4 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 5 | from superagi.tools.image_generation.dalle_image_gen import DalleImageGenTool 6 | from superagi.tools.image_generation.stable_diffusion_image_gen import StableDiffusionImageGenTool 7 | from superagi.types.key_type import ToolConfigKeyType 8 | 9 | class ImageGenToolkit(BaseToolkit, ABC): 10 | name: str = "Image Generation Toolkit" 11 | description: str = "Toolkit containing a tool for generating images" 12 | 13 | def get_tools(self) -> List[BaseTool]: 14 | return [DalleImageGenTool(), StableDiffusionImageGenTool()] 15 | 16 | def get_env_keys(self) -> List[ToolConfiguration]: 17 | return [ 18 | ToolConfiguration(key="STABILITY_API_KEY", key_type=ToolConfigKeyType.STRING, is_required=False, is_secret = True), 19 | ToolConfiguration(key="ENGINE_ID", key_type=ToolConfigKeyType.STRING, is_required=False, is_secret=False), 20 | ToolConfiguration(key="OPENAI_API_KEY", key_type=ToolConfigKeyType.STRING, is_required=False, is_secret=True) 21 | ] 22 | -------------------------------------------------------------------------------- /superagi/tools/instagram_tool/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/instagram_tool/__init__.py -------------------------------------------------------------------------------- /superagi/tools/instagram_tool/instagram_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.instagram_tool.instagram import InstagramTool 5 | from superagi.types.key_type import ToolConfigKeyType 6 | 7 | class InstagramToolkit(BaseToolkit, ABC): 8 | name: str = "Instagram Toolkit" 9 | description: str = "Toolkit containing tools for posting AI generated photo on Instagram. Posts only one photo in a run " 10 | 11 | def get_tools(self) -> List[BaseTool]: 12 | return [InstagramTool()] 13 | 14 | def get_env_keys(self) -> List[ToolConfiguration]: 15 | return [ 16 | ToolConfiguration(key="META_USER_ACCESS_TOKEN", key_type=ToolConfigKeyType.STRING, is_required=True, is_secret=True), 17 | ToolConfiguration(key="FACEBOOK_PAGE_ID", key_type=ToolConfigKeyType.STRING, is_required=True, is_secret=False) 18 | ] -------------------------------------------------------------------------------- /superagi/tools/jira/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/jira/__init__.py -------------------------------------------------------------------------------- /superagi/tools/jira/jira_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.jira.create_issue import CreateIssueTool 5 | from superagi.tools.jira.edit_issue import EditIssueTool 6 | from superagi.tools.jira.get_projects import GetProjectsTool 7 | from superagi.tools.jira.search_issues import SearchJiraTool 8 | from superagi.types.key_type import ToolConfigKeyType 9 | from superagi.models.tool_config import ToolConfig 10 | 11 | 12 | class JiraToolkit(BaseToolkit, ABC): 13 | name: str = "Jira Toolkit" 14 | description: str = "Toolkit containing tools for Jira integration" 15 | 16 | def get_tools(self) -> List[BaseTool]: 17 | return [ 18 | CreateIssueTool(), 19 | EditIssueTool(), 20 | GetProjectsTool(), 21 | SearchJiraTool(), 22 | ] 23 | 24 | def get_env_keys(self) -> List[ToolConfiguration]: 25 | return [ 26 | ToolConfiguration(key="JIRA_INSTANCE_URL", key_type=ToolConfigKeyType.STRING, is_required= True, is_secret = False), 27 | ToolConfiguration(key="JIRA_USERNAME", key_type=ToolConfigKeyType.STRING, is_required=True, is_secret=False), 28 | ToolConfiguration(key="JIRA_API_TOKEN", key_type=ToolConfigKeyType.STRING, is_required=True, is_secret=True) 29 | ] 30 | -------------------------------------------------------------------------------- /superagi/tools/jira/tool.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import requests 4 | from typing import List, Type 5 | from pydantic import BaseModel, Field 6 | 7 | from superagi.config.config import get_config 8 | from superagi.tools.base_tool import BaseTool 9 | from jira import JIRA 10 | 11 | class JiraIssueSchema(BaseModel): 12 | issue_key: str = Field( 13 | ..., 14 | description="The key of the Jira issue.", 15 | ) 16 | fields: dict = Field( 17 | ..., 18 | description="The fields to update for the Jira issue.", 19 | ) 20 | 21 | 22 | class JiraTool(BaseTool): 23 | """ 24 | Jira tool 25 | 26 | Attributes: 27 | name : The name. 28 | description : The description. 29 | args_schema : The args schema. 30 | """ 31 | def build_jira_instance(self) -> dict: 32 | """ 33 | Build a Jira instance. 34 | 35 | Returns: 36 | The Jira instance. 37 | """ 38 | jira_instance_url = self.get_tool_config("JIRA_INSTANCE_URL") 39 | jira_username = self.get_tool_config("JIRA_USERNAME") 40 | jira_api_token = self.get_tool_config("JIRA_API_TOKEN") 41 | jira = JIRA( 42 | server=jira_instance_url, 43 | basic_auth=(jira_username, jira_api_token) 44 | ) 45 | return jira 46 | -------------------------------------------------------------------------------- /superagi/tools/knowledge_search/knowledge_search_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.knowledge_search.knowledge_search import KnowledgeSearchTool 5 | from superagi.types.key_type import ToolConfigKeyType 6 | 7 | class KnowledgeSearchToolkit(BaseToolkit, ABC): 8 | name: str = "Knowledge Search Toolkit" 9 | description: str = "Toolkit containing tools for performing search on the knowledge base." 10 | 11 | def get_tools(self) -> List[BaseTool]: 12 | return [KnowledgeSearchTool()] 13 | 14 | def get_env_keys(self) -> List[ToolConfiguration]: 15 | return [ 16 | ToolConfiguration(key="OPENAI_API_KEY", key_type=ToolConfigKeyType.STRING, is_required=False, is_secret=True) 17 | ] -------------------------------------------------------------------------------- /superagi/tools/resource/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/resource/__init__.py -------------------------------------------------------------------------------- /superagi/tools/resource/resource_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.resource.query_resource import QueryResourceTool 5 | from superagi.types.key_type import ToolConfigKeyType 6 | 7 | 8 | class JiraToolkit(BaseToolkit, ABC): 9 | name: str = "Resource Toolkit" 10 | description: str = "Toolkit containing tools for Resource integration" 11 | 12 | def get_tools(self) -> List[BaseTool]: 13 | return [ 14 | QueryResourceTool(), 15 | ] 16 | 17 | def get_env_keys(self) -> List[ToolConfiguration]: 18 | return [ 19 | ToolConfiguration(key="RESOURCE_VECTOR_STORE", key_type=ToolConfigKeyType.STRING, is_required= True, is_secret = True), 20 | ToolConfiguration(key="RESOURCE_VECTOR_STORE_INDEX_NAME", key_type=ToolConfigKeyType.STRING, is_required=True, is_secret=True) 21 | ] 22 | -------------------------------------------------------------------------------- /superagi/tools/searx/README.MD: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | # SuperAGI Searx Search Tool 6 | 7 | The SuperAGI Searx Search Tool helps users perform a Searx search and extract snippets and webpages. We parse the HTML response pages because most Searx instances do not support the JSON response format without an API key. 8 | 9 | ## ⚙️ Installation 10 | 11 | ### 🛠 **Setting Up of SuperAGI** 12 | Set up the SuperAGI by following the instructions given (https://github.com/TransformerOptimus/SuperAGI/blob/main/README.MD) 13 | 14 | ## Running SuperAGI Searx Search Serp Tool 15 | 16 | You can simply ask your agent about latest information regarding anything in the world and your agent will be able to browse the internet to get that information for you. 17 | -------------------------------------------------------------------------------- /superagi/tools/searx/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/searx/__init__.py -------------------------------------------------------------------------------- /superagi/tools/searx/searx_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | 4 | from superagi.tools.base_tool import BaseToolkit, BaseTool, ToolConfiguration 5 | from superagi.tools.searx.searx import SearxSearchTool 6 | from superagi.types.key_type import ToolConfigKeyType 7 | 8 | class SearxSearchToolkit(BaseToolkit, ABC): 9 | name: str = "Searx Toolkit" 10 | description: str = "Toolkit containing tools for performing Google search and extracting snippets and webpages " \ 11 | "using Searx" 12 | 13 | def get_tools(self) -> List[BaseTool]: 14 | return [SearxSearchTool()] 15 | 16 | def get_env_keys(self) -> List[ToolConfiguration]: 17 | return [] 18 | -------------------------------------------------------------------------------- /superagi/tools/slack/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/slack/__init__.py -------------------------------------------------------------------------------- /superagi/tools/slack/slack_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.slack.send_message import SlackMessageTool 5 | from superagi.types.key_type import ToolConfigKeyType 6 | 7 | 8 | class SlackToolkit(BaseToolkit, ABC): 9 | name: str = "Slack Toolkit" 10 | description: str = "Toolkit containing tools for Slack integration" 11 | 12 | def get_tools(self) -> List[BaseTool]: 13 | return [ 14 | SlackMessageTool(), 15 | ] 16 | 17 | def get_env_keys(self) -> List[ToolConfiguration]: 18 | return [ 19 | ToolConfiguration(key="SLACK_BOT_TOKEN", key_type=ToolConfigKeyType.STRING, is_required= True, is_secret = True) 20 | ] 21 | -------------------------------------------------------------------------------- /superagi/tools/thinking/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/thinking/__init__.py -------------------------------------------------------------------------------- /superagi/tools/thinking/prompts/thinking.txt: -------------------------------------------------------------------------------- 1 | Given the following overall objective 2 | Objective: 3 | {goals} 4 | 5 | and the following task, `{task_description}`. 6 | 7 | Below is last tool response: 8 | `{last_tool_response}` 9 | 10 | Below is the relevant tool response: 11 | `{relevant_tool_response}` 12 | 13 | Perform the task by understanding the problem, extracting variables, and being smart 14 | and efficient. Provide a descriptive response, make decisions yourself when 15 | confronted with choices and provide reasoning for ideas / decisions. -------------------------------------------------------------------------------- /superagi/tools/thinking/thinking_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.thinking.tools import ThinkingTool 5 | from superagi.types.key_type import ToolConfigKeyType 6 | 7 | 8 | class ThinkingToolkit(BaseToolkit, ABC): 9 | name: str = "Thinking Toolkit" 10 | description: str = "Toolkit containing tools for intelligent problem-solving" 11 | 12 | def get_tools(self) -> List[BaseTool]: 13 | return [ 14 | ThinkingTool(), 15 | ] 16 | 17 | def get_env_keys(self) -> List[ToolConfiguration]: 18 | return [] 19 | -------------------------------------------------------------------------------- /superagi/tools/tool_response_query_manager.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy.orm import Session 2 | 3 | from superagi.models.agent_execution_feed import AgentExecutionFeed 4 | from superagi.vector_store.base import VectorStore 5 | 6 | class ToolResponseQueryManager: 7 | def __init__(self, session: Session, agent_execution_id: int,memory:VectorStore): 8 | self.session = session 9 | self.agent_execution_id = agent_execution_id 10 | self.memory=memory 11 | 12 | def get_last_response(self, tool_name: str = None): 13 | return AgentExecutionFeed.get_last_tool_response(self.session, self.agent_execution_id, tool_name) 14 | 15 | def get_relevant_response(self, query: str,metadata:dict, top_k: int = 5): 16 | if self.memory is None: 17 | return "" 18 | documents = self.memory.get_matching_text(query, metadata=metadata) 19 | relevant_responses = "" 20 | for document in documents["documents"]: 21 | relevant_responses += document.text_content 22 | return relevant_responses 23 | -------------------------------------------------------------------------------- /superagi/tools/twitter/twitter_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from superagi.tools.base_tool import BaseToolkit, BaseTool, ToolConfiguration 3 | from typing import Type, List 4 | from superagi.tools.twitter.send_tweets import SendTweetsTool 5 | from superagi.types.key_type import ToolConfigKeyType 6 | 7 | class TwitterToolkit(BaseToolkit, ABC): 8 | name: str = "Twitter Toolkit" 9 | description: str = "Twitter Tool kit contains all tools related to Twitter" 10 | 11 | def get_tools(self) -> List[BaseTool]: 12 | return [SendTweetsTool()] 13 | 14 | def get_env_keys(self) -> List[ToolConfiguration]: 15 | return [ 16 | ToolConfiguration(key="TWITTER_API_KEY", key_type=ToolConfigKeyType.STRING, is_required= True, is_secret = True), 17 | ToolConfiguration(key="TWITTER_API_SECRET", key_type=ToolConfigKeyType.STRING, is_required=True, is_secret= True) 18 | ] 19 | -------------------------------------------------------------------------------- /superagi/tools/webscaper/README.MD: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | # SuperAGI Web Scraper Tool 6 | 7 | The SuperAGI Webscraper Tool lets users perform web scraping, extracting URLs and retrieving the textual content from websites. 8 | 9 | ## ⚙️ Installation 10 | 11 | ### 🛠 **Setting Up of SuperAGI** 12 | Set up the SuperAGI by following the instructions given (https://github.com/TransformerOptimus/SuperAGI/blob/main/README.MD) 13 | 14 | You'll be able to use the Web Scraper Tool on the fly once you have setup SuperAGI. 15 | 16 | ## Running SuperAGI Web Scraper Tool 17 | 18 | You can simply ask your agent to read or go through a certain website or URL, and it'll be able to retrieve it's textual information from there. -------------------------------------------------------------------------------- /superagi/tools/webscaper/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/tools/webscaper/__init__.py -------------------------------------------------------------------------------- /superagi/tools/webscaper/tools.py: -------------------------------------------------------------------------------- 1 | from typing import Type, Optional 2 | 3 | from pydantic import BaseModel, Field 4 | 5 | from superagi.helper.webpage_extractor import WebpageExtractor 6 | from superagi.llms.base_llm import BaseLlm 7 | from superagi.tools.base_tool import BaseTool 8 | 9 | 10 | class WebScraperSchema(BaseModel): 11 | website_url: str = Field( 12 | ..., 13 | description="Valid website url without any quotes.", 14 | ) 15 | 16 | 17 | class WebScraperTool(BaseTool): 18 | """ 19 | Web Scraper tool 20 | 21 | Attributes: 22 | name : The name. 23 | description : The description. 24 | args_schema : The args schema. 25 | """ 26 | llm: Optional[BaseLlm] = None 27 | name = "WebScraperTool" 28 | description = ( 29 | "Used to scrape website urls and extract text content" 30 | ) 31 | args_schema: Type[WebScraperSchema] = WebScraperSchema 32 | 33 | class Config: 34 | arbitrary_types_allowed = True 35 | 36 | def _execute(self, website_url: str) -> tuple: 37 | """ 38 | Execute the Web Scraper tool. 39 | 40 | Args: 41 | website_url : The website url to scrape. 42 | 43 | Returns: 44 | The text content of the website. 45 | """ 46 | content = WebpageExtractor().extract_with_bs4(website_url) 47 | max_length = len(' '.join(content.split(" ")[:600])) 48 | return content[:max_length] -------------------------------------------------------------------------------- /superagi/tools/webscaper/web_scraper_toolkit.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | from typing import List 3 | from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration 4 | from superagi.tools.webscaper.tools import WebScraperTool 5 | from superagi.types.key_type import ToolConfigKeyType 6 | 7 | class WebScrapperToolkit(BaseToolkit, ABC): 8 | name: str = "Web Scrapper Toolkit" 9 | description: str = "Web Scrapper tool kit is used to scrape web" 10 | 11 | def get_tools(self) -> List[BaseTool]: 12 | return [ 13 | WebScraperTool(), 14 | ] 15 | 16 | def get_env_keys(self) -> List[ToolConfiguration]: 17 | return [] 18 | -------------------------------------------------------------------------------- /superagi/types/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/types/__init__.py -------------------------------------------------------------------------------- /superagi/types/common.py: -------------------------------------------------------------------------------- 1 | from abc import abstractmethod 2 | from pydantic import BaseModel, Field 3 | 4 | 5 | class BaseMessage(BaseModel): 6 | """Base message object.""" 7 | 8 | content: str 9 | additional_kwargs: dict = Field(default_factory=dict) 10 | 11 | @property 12 | @abstractmethod 13 | def type(self) -> str: 14 | """Message type used.""" 15 | 16 | 17 | class HumanMessage(BaseMessage): 18 | """Message by human.""" 19 | 20 | example: bool = False 21 | 22 | @property 23 | def type(self) -> str: 24 | return "user" 25 | 26 | 27 | class AIMessage(BaseMessage): 28 | """Type of message that is spoken by the AI.""" 29 | 30 | example: bool = False 31 | 32 | @property 33 | def type(self) -> str: 34 | return "assistant" 35 | 36 | 37 | class SystemMessage(BaseMessage): 38 | """Used when message is system message.""" 39 | 40 | @property 41 | def type(self) -> str: 42 | return "system" 43 | 44 | 45 | class GitHubLinkRequest(BaseModel): 46 | """Used for Request body in install API""" 47 | github_link: str 48 | -------------------------------------------------------------------------------- /superagi/types/key_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class ToolConfigKeyType(Enum): 4 | STRING = 'string' 5 | FILE = 'file' 6 | INT = 'int' 7 | 8 | @classmethod 9 | def get_key_type(cls, store): 10 | store = store.upper() 11 | if store in cls.__members__: 12 | return cls[store] 13 | raise ValueError(f"{store} is not a valid key type.") 14 | 15 | def __str__(self): 16 | return self.value 17 | -------------------------------------------------------------------------------- /superagi/types/model_source_types.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class ModelSourceType(Enum): 5 | GooglePalm = 'Google Palm' 6 | OpenAI = 'OpenAi' 7 | Replicate = 'Replicate' 8 | HuggingFace = 'Hugging Face' 9 | LocalLLM = 'Local LLM' 10 | 11 | @classmethod 12 | def get_model_source_type(cls, name): 13 | name = name.upper().replace(" ", "") 14 | for member in cls.__members__: 15 | if name == member.upper(): 16 | return cls[member] 17 | raise ValueError(f"{name} is not a valid vector store name.") 18 | 19 | @classmethod 20 | def get_model_source_from_model(cls, model_name: str): 21 | open_ai_models = ['gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-4-32k'] 22 | google_models = ['google-palm-bison-001', 'models/chat-bison-001'] 23 | replicate_models = ['replicate-llama13b-v2-chat'] 24 | if model_name in open_ai_models: 25 | return ModelSourceType.OpenAI 26 | if model_name in google_models: 27 | return ModelSourceType.GooglePalm 28 | if model_name in replicate_models: 29 | return ModelSourceType.Replicate 30 | return ModelSourceType.OpenAI 31 | 32 | def __str__(self): 33 | return self.value -------------------------------------------------------------------------------- /superagi/types/queue_status.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class QueueStatus(Enum): 5 | INITIATED = 'INITIATED' 6 | PROCESSING = 'PROCESSING' 7 | COMPLETE = 'COMPLETE' 8 | 9 | @classmethod 10 | def get_queue_type(cls, store): 11 | if store is None: 12 | raise ValueError("Queue status type cannot be None.") 13 | store = store.upper() 14 | if store in cls.__members__: 15 | return cls[store] 16 | raise ValueError(f"{store} is not a valid storage name.") 17 | -------------------------------------------------------------------------------- /superagi/types/storage_types.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class StorageType(Enum): 5 | FILE = 'FILE' 6 | S3 = 'S3' 7 | 8 | @classmethod 9 | def get_storage_type(cls, store): 10 | if store is None: 11 | raise ValueError("Storage type cannot be None.") 12 | store = store.upper() 13 | if store in cls.__members__: 14 | return cls[store] 15 | raise ValueError(f"{store} is not a valid storage name.") 16 | -------------------------------------------------------------------------------- /superagi/types/vector_store_types.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class VectorStoreType(Enum): 5 | REDIS = 'redis' 6 | PINECONE = 'pinecone' 7 | CHROMA = 'chroma' 8 | WEAVIATE = 'weaviate' 9 | QDRANT = 'qdrant' 10 | LANCEDB = 'LanceDB' 11 | 12 | @classmethod 13 | def get_vector_store_type(cls, store): 14 | store = store.upper() 15 | if store in cls.__members__: 16 | return cls[store] 17 | raise ValueError(f"{store} is not a valid vector store name.") 18 | 19 | def __str__(self): 20 | return self.value 21 | -------------------------------------------------------------------------------- /superagi/vector_embeddings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/vector_embeddings/__init__.py -------------------------------------------------------------------------------- /superagi/vector_embeddings/base.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | from abc import ABC, abstractmethod 3 | from typing import Any, Iterable, List, Optional, Tuple 4 | 5 | class VectorEmbeddings(ABC): 6 | 7 | @abstractmethod 8 | def get_vector_embeddings_from_chunks( 9 | self, 10 | final_chunks: Any 11 | ): 12 | """ Returns embeddings for vector dbs from final chunks""" -------------------------------------------------------------------------------- /superagi/vector_embeddings/pinecone.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | from superagi.vector_embeddings.base import VectorEmbeddings 3 | 4 | class Pinecone(VectorEmbeddings): 5 | 6 | def __init__(self, uuid, embeds, metadata): 7 | self.uuid = uuid 8 | self.embeds = embeds 9 | self.metadata = metadata 10 | 11 | def get_vector_embeddings_from_chunks(self): 12 | """ Returns embeddings for vector dbs from final chunks""" 13 | result = {} 14 | vectors = list(zip(self.uuid, self.embeds, self.metadata)) 15 | result['vectors'] = vectors 16 | return result -------------------------------------------------------------------------------- /superagi/vector_embeddings/qdrant.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | from superagi.vector_embeddings.base import VectorEmbeddings 3 | 4 | class Qdrant(VectorEmbeddings): 5 | 6 | def __init__(self, uuid, embeds, metadata): 7 | self.uuid = uuid 8 | self.embeds = embeds 9 | self.metadata = metadata 10 | 11 | def get_vector_embeddings_from_chunks(self): 12 | """ Returns embeddings for vector dbs from final chunks""" 13 | result = {} 14 | result['ids'] = self.uuid 15 | result['payload'] = self.metadata 16 | result['vectors'] = self.embeds 17 | 18 | return result -------------------------------------------------------------------------------- /superagi/vector_embeddings/weaviate.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | from superagi.vector_embeddings.base import VectorEmbeddings 3 | 4 | class Weaviate(VectorEmbeddings): 5 | 6 | def __init__(self, uuid, embeds, metadata): 7 | self.uuid = uuid 8 | self.embeds = embeds 9 | self.metadata = metadata 10 | 11 | def get_vector_embeddings_from_chunks(self): 12 | """ Returns embeddings for vector dbs from final chunks""" 13 | 14 | return {'ids': self.uuid, 'data_object': self.metadata, 'vectors': self.embeds} 15 | -------------------------------------------------------------------------------- /superagi/vector_store/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/superagi/vector_store/__init__.py -------------------------------------------------------------------------------- /superagi/vector_store/document.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel, Field 2 | 3 | 4 | class Document(BaseModel): 5 | """Interface for interacting with a document.""" 6 | 7 | text_content: str = None 8 | metadata: dict = Field(default_factory=dict) 9 | 10 | def __init__(self, text_content, *args, **kwargs): 11 | super().__init__(text_content=text_content, *args, **kwargs) -------------------------------------------------------------------------------- /superagi/vector_store/embedding/__init__.py: -------------------------------------------------------------------------------- 1 | from superagi.vector_store.embedding.openai import OpenAiEmbedding 2 | from superagi.vector_store.embedding.palm import PalmEmbedding 3 | 4 | __all__ = ['OpenAiEmbedding', 'PalmEmbedding'] -------------------------------------------------------------------------------- /superagi/vector_store/embedding/base.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class BaseEmbedding(ABC): 5 | 6 | @abstractmethod 7 | def get_embedding(self, text): 8 | pass 9 | -------------------------------------------------------------------------------- /superagi/vector_store/embedding/openai.py: -------------------------------------------------------------------------------- 1 | import openai 2 | 3 | 4 | class OpenAiEmbedding: 5 | def __init__(self, api_key, model="text-embedding-ada-002"): 6 | self.model = model 7 | self.api_key = api_key 8 | 9 | async def get_embedding_async(self, text: str): 10 | try: 11 | openai.api_key = self.api_key 12 | response = await openai.Embedding.create( 13 | input=[text], 14 | engine=self.model 15 | ) 16 | return response['data'][0]['embedding'] 17 | except Exception as exception: 18 | return {"error": exception} 19 | 20 | 21 | def get_embedding(self, text): 22 | try: 23 | # openai.api_key = get_config("OPENAI_API_KEY") 24 | response = openai.Embedding.create( 25 | api_key=self.api_key, 26 | input=[text], 27 | engine=self.model 28 | ) 29 | return response['data'][0]['embedding'] 30 | except Exception as exception: 31 | return {"error": exception} 32 | -------------------------------------------------------------------------------- /superagi/vector_store/embedding/palm.py: -------------------------------------------------------------------------------- 1 | import openai 2 | import google.generativeai as palm 3 | 4 | 5 | class PalmEmbedding: 6 | def __init__(self, api_key, model="models/embedding-gecko-001"): 7 | self.model = model 8 | self.api_key = api_key 9 | 10 | def get_embedding(self, text): 11 | try: 12 | response = palm.generate_embeddings(model=self.model, text=text) 13 | return response['embedding'] 14 | except Exception as exception: 15 | return {"error": exception} 16 | -------------------------------------------------------------------------------- /test_main.http: -------------------------------------------------------------------------------- 1 | # Test your FastAPI endpoints 2 | 3 | GET http://127.0.0.1:8000/ 4 | Accept: application/json 5 | 6 | ### 7 | 8 | GET http://127.0.0.1:8000/hello/User 9 | Accept: application/json 10 | 11 | ### 12 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/__init__.py -------------------------------------------------------------------------------- /tests/integration_tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/integration_tests/__init__.py -------------------------------------------------------------------------------- /tests/integration_tests/vector_embeddings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/integration_tests/vector_embeddings/__init__.py -------------------------------------------------------------------------------- /tests/integration_tests/vector_embeddings/test_pinecone.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from superagi.vector_embeddings.pinecone import Pinecone 3 | 4 | 5 | class TestPinecone(unittest.TestCase): 6 | 7 | def setUp(self): 8 | self.uuid = ["id1", "id2"] 9 | self.embeds = ["embed1", "embed2"] 10 | self.metadata = ["metadata1", "metadata2"] 11 | self.pinecone_instance = Pinecone(self.uuid, self.embeds, self.metadata) 12 | 13 | def test_init(self): 14 | self.assertEqual(self.pinecone_instance.uuid, self.uuid) 15 | self.assertEqual(self.pinecone_instance.embeds, self.embeds) 16 | self.assertEqual(self.pinecone_instance.metadata, self.metadata) 17 | 18 | def test_get_vector_embeddings_from_chunks(self): 19 | expected = { 20 | 'vectors': list(zip(self.uuid, self.embeds, self.metadata)) 21 | } 22 | result = self.pinecone_instance.get_vector_embeddings_from_chunks() 23 | self.assertEqual(result, expected) 24 | 25 | 26 | if __name__ == "__main__": 27 | unittest.main() -------------------------------------------------------------------------------- /tests/integration_tests/vector_embeddings/test_qdrant.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from superagi.vector_embeddings.qdrant import Qdrant 4 | 5 | class TestQdrant(unittest.TestCase): 6 | 7 | def setUp(self): 8 | self.uuid = ['1234', '5678'] 9 | self.embeds = [[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]] 10 | self.metadata = [{'key1': 'value1'}, {'key2': 'value2'}] 11 | 12 | self.qdrant_obj = Qdrant(self.uuid, self.embeds, self.metadata) 13 | 14 | def test_init(self): 15 | self.assertEqual(self.qdrant_obj.uuid, self.uuid) 16 | self.assertEqual(self.qdrant_obj.embeds, self.embeds) 17 | self.assertEqual(self.qdrant_obj.metadata, self.metadata) 18 | 19 | def test_get_vector_embeddings_from_chunks(self): 20 | expected = { 21 | 'ids': self.uuid, 22 | 'payload': self.metadata, 23 | 'vectors': self.embeds, 24 | } 25 | result = self.qdrant_obj.get_vector_embeddings_from_chunks() 26 | 27 | self.assertEqual(result, expected) 28 | 29 | if __name__ == '__main__': 30 | unittest.main() -------------------------------------------------------------------------------- /tests/integration_tests/vector_embeddings/test_weaviate.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from superagi.vector_embeddings.base import VectorEmbeddings 3 | from superagi.vector_embeddings.weaviate import Weaviate 4 | 5 | class TestWeaviate(unittest.TestCase): 6 | 7 | def setUp(self): 8 | self.weaviate = Weaviate(uuid="1234", embeds=[0.1, 0.2, 0.3, 0.4], metadata={"info": "sample data"}) 9 | 10 | def test_init(self): 11 | self.assertEqual(self.weaviate.uuid, "1234") 12 | self.assertEqual(self.weaviate.embeds, [0.1, 0.2, 0.3, 0.4]) 13 | self.assertEqual(self.weaviate.metadata, {"info": "sample data"}) 14 | 15 | def test_get_vector_embeddings_from_chunks(self): 16 | expected_result = { 17 | "ids": "1234", 18 | "data_object": {"info": "sample data"}, 19 | "vectors": [0.1, 0.2, 0.3, 0.4] 20 | } 21 | self.assertEqual(self.weaviate.get_vector_embeddings_from_chunks(), expected_result) 22 | 23 | 24 | if __name__ == '__main__': 25 | unittest.main() 26 | -------------------------------------------------------------------------------- /tests/integration_tests/vector_store/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/integration_tests/vector_store/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/agent/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/agent/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/agent/test_output_parser.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from superagi.agent.output_parser import AgentGPTAction, AgentSchemaOutputParser 4 | 5 | import pytest 6 | 7 | def test_agent_schema_output_parser(): 8 | parser = AgentSchemaOutputParser() 9 | 10 | # Test with valid json response 11 | response = '```{"tool": {"name": "Tool1", "args": {}}}```' 12 | parsed = parser.parse(response) 13 | assert isinstance(parsed, AgentGPTAction) 14 | assert parsed.name == 'Tool1' 15 | assert parsed.args == {} 16 | 17 | # Test with valid json but with boolean values 18 | response = "```{'tool': {'name': 'Tool1', 'args': 'arg1'}, 'status': True}```" 19 | parsed = parser.parse(response) 20 | assert isinstance(parsed, AgentGPTAction) 21 | assert parsed.name == 'Tool1' 22 | assert parsed.args == 'arg1' 23 | 24 | # Test with invalid json response 25 | response = "invalid response" 26 | with pytest.raises(Exception): 27 | parsed = parser.parse(response) 28 | 29 | # Test with empty json response 30 | response = "" 31 | with pytest.raises(Exception): 32 | parsed = parser.parse(response) 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/unit_tests/apm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/apm/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/apm/test_analytics_helper.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from superagi.models.events import Event 3 | from superagi.apm.analytics_helper import AnalyticsHelper 4 | from unittest.mock import MagicMock 5 | 6 | @pytest.fixture 7 | def organisation_id(): 8 | return 1 9 | 10 | @pytest.fixture 11 | def mock_session(): 12 | return MagicMock() 13 | 14 | @pytest.fixture 15 | def analytics_helper(mock_session, organisation_id): 16 | return AnalyticsHelper(mock_session, organisation_id) 17 | 18 | def test_calculate_run_completed_metrics(analytics_helper, mock_session): 19 | mock_session.query().all.return_value = [MagicMock()] 20 | result = analytics_helper.calculate_run_completed_metrics() 21 | assert isinstance(result, dict) 22 | 23 | def test_fetch_agent_data(analytics_helper, mock_session): 24 | mock_session.query().all.return_value = [MagicMock()] 25 | result = analytics_helper.fetch_agent_data() 26 | assert isinstance(result, dict) 27 | 28 | def test_fetch_agent_runs(analytics_helper, mock_session): 29 | mock_session.query().all.return_value = [MagicMock()] 30 | result = analytics_helper.fetch_agent_runs(1) 31 | assert isinstance(result, list) 32 | 33 | def test_get_active_runs(analytics_helper, mock_session): 34 | mock_session.query().all.return_value = [MagicMock()] 35 | result = analytics_helper.get_active_runs() 36 | assert isinstance(result, list) -------------------------------------------------------------------------------- /tests/unit_tests/apm/test_event_handler.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from sqlalchemy.exc import SQLAlchemyError 3 | from superagi.models.events import Event 4 | from unittest.mock import MagicMock 5 | 6 | from superagi.apm.event_handler import EventHandler 7 | 8 | @pytest.fixture 9 | def mock_session(): 10 | return MagicMock() 11 | 12 | @pytest.fixture 13 | def event_handler(mock_session): 14 | return EventHandler(mock_session) 15 | 16 | def test_create_event_success(event_handler, mock_session): 17 | mock_session.add = MagicMock() 18 | mock_session.commit = MagicMock() 19 | event = event_handler.create_event('test', {}, 1, 1, 100) 20 | 21 | assert isinstance(event, Event) 22 | mock_session.add.assert_called_once() 23 | mock_session.commit.assert_called_once() 24 | 25 | def test_create_event_failure(event_handler, mock_session): 26 | mock_session.commit = MagicMock(side_effect=SQLAlchemyError()) 27 | event = event_handler.create_event('test', {}, 1, 1, 100) 28 | assert event is None -------------------------------------------------------------------------------- /tests/unit_tests/controllers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/controllers/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/controllers/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/controllers/api/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/controllers/test_update_agent_config_table.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from unittest.mock import patch, Mock 3 | from superagi.models.agent_config import AgentConfiguration 4 | from superagi.controllers.types.agent_execution_config import AgentRunIn 5 | 6 | def test_update_existing_toolkits(): 7 | agent_id = 1 8 | updated_details = AgentRunIn( 9 | agent_workflow="test", constraints=["c1", "c2"], toolkits=[1, 2], 10 | tools=[1, 2, 3], exit="exit", iteration_interval=1, 11 | model="test", permission_type="p", LTM_DB="LTM", max_iterations=100 12 | ) 13 | 14 | # Mock AgentConfiguration instance for the agent_configs list 15 | existing_toolkits_config = Mock(spec=AgentConfiguration) 16 | existing_toolkits_config.key = "toolkits" 17 | existing_toolkits_config.value = [3, 4] 18 | 19 | agent_configs = [existing_toolkits_config] 20 | 21 | mock_session = Mock() 22 | 23 | # Mock the query filter behavior for existing configurations 24 | mock_session.query().filter().all.return_value = agent_configs 25 | 26 | result = AgentConfiguration.update_agent_configurations_table(mock_session, agent_id, updated_details) 27 | 28 | #Check whether the value gets updated or not 29 | assert existing_toolkits_config.value == '[1, 2]' 30 | assert mock_session.commit.called_once() 31 | assert result == "Details updated successfully" 32 | -------------------------------------------------------------------------------- /tests/unit_tests/helper/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/helper/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/helper/test_error_handling.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from unittest.mock import Mock, patch 3 | from superagi.models.agent_execution import AgentExecution 4 | from superagi.models.agent_execution_feed import AgentExecutionFeed 5 | from superagi.helper.error_handler import ErrorHandler 6 | 7 | def test_handle_error(): 8 | session = Mock() 9 | agent_id = 1 10 | agent_execution_id = 2 11 | error_message = 'Test error' 12 | 13 | mock_query = Mock() 14 | mock_query.filter().first.return_value = AgentExecution(id=agent_execution_id) 15 | session.query.return_value = mock_query 16 | 17 | ErrorHandler.handle_openai_errors(session, agent_id, agent_execution_id, error_message) 18 | 19 | session.query.assert_called_once_with(AgentExecution) 20 | -------------------------------------------------------------------------------- /tests/unit_tests/helper/test_feed_parser.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from datetime import datetime 3 | from superagi.helper.feed_parser import parse_feed 4 | from superagi.models.agent_execution_feed import AgentExecutionFeed 5 | class TestParseFeed(unittest.TestCase): 6 | def test_parse_feed_system(self): 7 | current_time = datetime.now() 8 | sample_feed = AgentExecutionFeed( 9 | id=2, agent_execution_id=100, agent_id=200, role="user", 10 | feed='System message', updated_at=current_time 11 | ) 12 | 13 | result = parse_feed(sample_feed) 14 | 15 | self.assertEqual(result['feed'], sample_feed.feed, "Incorrect output from parse_feed function for system role") 16 | self.assertEqual(result['role'], sample_feed.role, "Incorrect output from parse_feed function for system role") -------------------------------------------------------------------------------- /tests/unit_tests/helper/test_json_cleaner.py: -------------------------------------------------------------------------------- 1 | from superagi.helper.json_cleaner import JsonCleaner 2 | import pytest 3 | 4 | def test_extract_json_section(): 5 | test_str = 'Before json {"key":"value"} after json' 6 | result = JsonCleaner.extract_json_section(test_str) 7 | assert result == '{"key":"value"}' 8 | 9 | def test_remove_escape_sequences(): 10 | test_str = r'This is a test\nstring' 11 | result = JsonCleaner.remove_escape_sequences(test_str) 12 | assert result == 'This is a test\nstring' 13 | 14 | def test_balance_braces(): 15 | test_str = '{{{{"key":"value"}}' 16 | result = JsonCleaner.balance_braces(test_str) 17 | assert result == '{{{{"key":"value"}}}}' 18 | 19 | 20 | def test_balance_braces(): 21 | test_str = '{"key": false}' 22 | result = JsonCleaner.clean_boolean(test_str) 23 | assert result == '{"key": False}' 24 | 25 | -------------------------------------------------------------------------------- /tests/unit_tests/helper/test_time_helper.py: -------------------------------------------------------------------------------- 1 | from superagi.helper.time_helper import get_time_difference, parse_interval_to_seconds 2 | import pytest 3 | 4 | def test_get_time_difference(): 5 | timestamp1 = "2023-06-26 17:31:08.884322" 6 | timestamp2 = "2023-06-27 03:57:42.038497" 7 | expected_result = { 8 | "years": 0, 9 | "months": 0, 10 | "days": 0, 11 | "hours": 10, 12 | "minutes": 26 13 | } 14 | assert get_time_difference(timestamp1, timestamp2) == expected_result 15 | 16 | 17 | 18 | def test_parse_interval_to_seconds(): 19 | assert parse_interval_to_seconds("2 Minutes") == 120 20 | assert parse_interval_to_seconds("3 Hours") == 10800 21 | assert parse_interval_to_seconds("1 Days") == 86400 22 | assert parse_interval_to_seconds("7 Weeks") == 4233600 23 | assert parse_interval_to_seconds("2 Months") == 5184000 24 | -------------------------------------------------------------------------------- /tests/unit_tests/jobs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/jobs/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/jobs/conftest.py: -------------------------------------------------------------------------------- 1 | # content of conftest.py 2 | def pytest_configure(config): 3 | import sys 4 | sys._called_from_test = True 5 | 6 | def pytest_unconfigure(config): 7 | import sys # This was missing from the manual 8 | del sys._called_from_test 9 | -------------------------------------------------------------------------------- /tests/unit_tests/jobs/test_resource_summary.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/jobs/test_resource_summary.py -------------------------------------------------------------------------------- /tests/unit_tests/llms/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/llms/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/llms/test_google_palm.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import patch 2 | 3 | from superagi.llms.google_palm import GooglePalm 4 | 5 | 6 | @patch('superagi.llms.google_palm.palm') 7 | def test_chat_completion(mock_palm): 8 | # Arrange 9 | model = 'models/text-bison-001' 10 | api_key = 'test_key' 11 | palm_instance = GooglePalm(api_key, model=model) 12 | 13 | messages = [{"role": "system", "content": "You are a helpful assistant."}] 14 | max_tokens = 100 15 | mock_palm.generate_text.return_value.result = 'Sure, I can help with that.' 16 | 17 | # Act 18 | result = palm_instance.chat_completion(messages, max_tokens) 19 | 20 | # Assert 21 | assert result == {"response": mock_palm.generate_text.return_value, "content": 'Sure, I can help with that.'} 22 | mock_palm.generate_text.assert_called_once_with( 23 | model=model, 24 | prompt='You are a helpful assistant.', 25 | temperature=palm_instance.temperature, 26 | candidate_count=palm_instance.candidate_count, 27 | top_k=palm_instance.top_k, 28 | top_p=palm_instance.top_p, 29 | max_output_tokens=int(max_tokens) 30 | ) 31 | 32 | 33 | def test_verify_access_key(): 34 | model = 'models/text-bison-001' 35 | api_key = 'test_key' 36 | palm_instance = GooglePalm(api_key, model=model) 37 | result = palm_instance.verify_access_key() 38 | assert result is False 39 | -------------------------------------------------------------------------------- /tests/unit_tests/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/models/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/models/test_agent_execution_config.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from unittest.mock import MagicMock, patch, call 3 | 4 | from distlib.util import AND 5 | 6 | from superagi.models.agent_execution_config import AgentExecutionConfiguration 7 | 8 | 9 | class TestAgentExecutionConfiguration(unittest.TestCase): 10 | 11 | def setUp(self): 12 | self.session = MagicMock() 13 | self.execution = MagicMock() 14 | self.execution.id = 1 15 | 16 | def test_fetch_configuration(self): 17 | test_db_response = [MagicMock(key="goal", value="['test_goal']"), 18 | MagicMock(key="instruction", value="['test_instruction']"), 19 | MagicMock(key="tools", value="[1]")] 20 | 21 | self.session.query.return_value.filter_by.return_value.all.return_value = test_db_response 22 | 23 | result = AgentExecutionConfiguration.fetch_configuration(self.session, self.execution) 24 | 25 | expected_result = {"goal": ["test_goal"], "instruction": ["test_instruction"], "tools":[1]} 26 | self.assertDictEqual(result, expected_result) 27 | 28 | def test_eval_agent_config(self): 29 | key = "goal" 30 | value = "['test_goal']" 31 | 32 | result = AgentExecutionConfiguration.eval_agent_config(key, value) 33 | 34 | self.assertEqual(result, ["test_goal"]) -------------------------------------------------------------------------------- /tests/unit_tests/models/test_agent_execution_feed.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from unittest.mock import Mock, create_autospec 3 | from sqlalchemy.orm import Session 4 | from superagi.models.agent_execution_feed import AgentExecutionFeed 5 | 6 | 7 | def test_get_last_tool_response(): 8 | mock_session = create_autospec(Session) 9 | agent_execution_feed_1 = AgentExecutionFeed(id=1, agent_execution_id=2, feed="Tool test1", role='system') 10 | agent_execution_feed_2 = AgentExecutionFeed(id=2, agent_execution_id=2, feed="Tool test2", role='system') 11 | 12 | mock_session.query().filter().order_by().all.return_value = [agent_execution_feed_1, agent_execution_feed_2] 13 | 14 | result = AgentExecutionFeed.get_last_tool_response(mock_session, 2) 15 | 16 | assert result == agent_execution_feed_1.feed # as agent_execution_feed_1 should be the latest based on created_at 17 | 18 | 19 | def test_get_last_tool_response_with_tool_name(): 20 | mock_session = create_autospec(Session) 21 | agent_execution_feed_1 = AgentExecutionFeed(id=1, agent_execution_id=2, feed="Tool test1", role='system') 22 | agent_execution_feed_2 = AgentExecutionFeed(id=2, agent_execution_id=2, feed="Tool test2", role='system') 23 | 24 | mock_session.query().filter().order_by().all.return_value = [agent_execution_feed_1, agent_execution_feed_2] 25 | 26 | result = AgentExecutionFeed.get_last_tool_response(mock_session, 2, "test2") 27 | assert result == agent_execution_feed_2.feed 28 | -------------------------------------------------------------------------------- /tests/unit_tests/models/test_agent_schedule.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import create_autospec 2 | 3 | from sqlalchemy.orm import Session 4 | from superagi.models.agent_schedule import AgentSchedule 5 | 6 | def test_find_by_agent_id(): 7 | # Create a mock session 8 | session = create_autospec(Session) 9 | 10 | # Create a sample agent ID 11 | agent_id = 1 12 | 13 | # Create a mock agent schedule object to be returned by the session query 14 | mock_agent_schedule = AgentSchedule(id=1,agent_id=agent_id, start_time="2023-08-10 12:17:00", recurrence_interval="2 Minutes", expiry_runs=2) 15 | 16 | # Configure the session query to return the mock agent 17 | session.query.return_value.filter.return_value.first.return_value = mock_agent_schedule 18 | 19 | # Call the method under test 20 | agent_schedule = AgentSchedule.find_by_agent_id(session, agent_id) 21 | 22 | # Assert that the returned agent object matches the mock agent 23 | assert agent_schedule == mock_agent_schedule 24 | -------------------------------------------------------------------------------- /tests/unit_tests/models/test_agent_workflow.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from unittest.mock import MagicMock 3 | from sqlalchemy.orm import Session 4 | 5 | from superagi.models.workflows.agent_workflow import AgentWorkflow 6 | 7 | 8 | @pytest.fixture 9 | def mock_session(): 10 | session = MagicMock(spec=Session) 11 | session.query.return_value.filter.return_value.first.return_value = MagicMock(spec=AgentWorkflow) 12 | return session 13 | 14 | def test_find_by_name(mock_session): 15 | result = AgentWorkflow.find_by_name(mock_session, 'workflow_name') 16 | mock_session.query.assert_called_once_with(AgentWorkflow) 17 | assert result.__class__ == AgentWorkflow 18 | 19 | def test_find_or_create_by_name_new(mock_session): 20 | mock_session.query.return_value.filter.return_value.first.return_value = None 21 | result = AgentWorkflow.find_or_create_by_name(mock_session, 'workflow_name', 'description') 22 | mock_session.add.assert_called_once() 23 | assert result.__class__ == AgentWorkflow 24 | 25 | def test_find_or_create_by_name_exists(mock_session): 26 | result = AgentWorkflow.find_or_create_by_name(mock_session, 'workflow_name', 'description') 27 | mock_session.add.assert_not_called() 28 | assert result.__class__ == AgentWorkflow 29 | 30 | def test_fetch_trigger_step_id(mock_session): 31 | result = AgentWorkflow.fetch_trigger_step_id(mock_session, 1) 32 | mock_session.query.assert_called_once() 33 | assert result is not None -------------------------------------------------------------------------------- /tests/unit_tests/models/test_events.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import MagicMock, patch 2 | 3 | import pytest 4 | 5 | from superagi.models.events import Event 6 | 7 | @pytest.fixture 8 | def mock_session(): 9 | return MagicMock() 10 | 11 | def test_create_event(mock_session): 12 | # Arrange 13 | event_name = "example_event" 14 | event_value = 100 15 | agent_id = 1 16 | org_id = 1 17 | mock_session.query.return_value.filter_by.return_value.first.return_value = None 18 | 19 | # Act 20 | event = Event(event_name=event_name, event_value=event_value) 21 | mock_session.add(event) 22 | 23 | # Assert 24 | mock_session.add.assert_called_once_with(event) 25 | 26 | def test_repr_method_event(mock_session): 27 | # Arrange 28 | event_name = "example_event" 29 | event_value = 100 30 | agent_id = 1 31 | org_id = 1 32 | mock_session.query.return_value.filter_by.return_value.first.return_value = None 33 | 34 | # Act 35 | event = Event(event_name=event_name, event_value=event_value) 36 | event_repr = repr(event) 37 | 38 | # Assert 39 | assert event_repr == f"Event(id=None, event_name={event_name}, " \ 40 | f"event_value={event_value}, " \ 41 | f"agent_id=None, " \ 42 | f"org_id=None)" 43 | -------------------------------------------------------------------------------- /tests/unit_tests/models/test_tool.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from unittest.mock import MagicMock, call 3 | from sqlalchemy.orm.exc import NoResultFound 4 | from superagi.models.tool import Tool 5 | from superagi.controllers.types.agent_with_config import AgentConfigInput 6 | from fastapi import HTTPException 7 | from typing import List 8 | 9 | @pytest.fixture 10 | def mock_session(): 11 | session = MagicMock() 12 | get_mock = MagicMock() 13 | get_mock.side_effect = [MagicMock(), NoResultFound()] # assuming 2nd tool won't be found 14 | session.query.return_value.get = get_mock 15 | return session 16 | 17 | 18 | def test_get_invalid_tools(mock_session): 19 | # Set up the mock session such that the second tool is not found 20 | mock_session.query.return_value.get.side_effect = [MagicMock(), None] 21 | 22 | # Call the get_invalid_tools method with tool_ids as [1, 2] 23 | invalid_tool_ids = Tool.get_invalid_tools([1, 2], mock_session) 24 | 25 | # Assert that the returned invalid tool IDs is as expected 26 | assert invalid_tool_ids == [2] 27 | 28 | # Assert that mock_session.query().get() was called with the correct arguments 29 | calls = [call(Tool).get(1), call(Tool).get(2)] 30 | mock_session.query.assert_has_calls(calls, any_order=True) 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/unit_tests/models/test_tool_config.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import MagicMock, patch 2 | 3 | import pytest 4 | 5 | from superagi.models.tool_config import ToolConfig 6 | from superagi.models.toolkit import Toolkit 7 | 8 | 9 | @pytest.fixture 10 | def mock_session(): 11 | return MagicMock() 12 | 13 | 14 | def test_add_or_update_existing_tool_config(mock_session): 15 | # Arrange 16 | toolkit_id = 1 17 | key = "example_key" 18 | value = "example_value" 19 | existing_tool_config = ToolConfig(toolkit_id=toolkit_id, key=key, value="old_value") 20 | mock_session.query.return_value.filter_by.return_value.first.return_value = existing_tool_config 21 | 22 | # Act 23 | ToolConfig.add_or_update(mock_session, toolkit_id, key, value) 24 | 25 | # Assert 26 | assert existing_tool_config.value == value 27 | mock_session.commit.assert_called_once() 28 | 29 | 30 | def test_add_or_update_new_tool_config(mock_session): 31 | # Arrange 32 | toolkit_id = 1 33 | key = "example_key" 34 | value = "example_value" 35 | mock_session.query.return_value.filter_by.return_value.first.return_value = None 36 | 37 | # Act 38 | ToolConfig.add_or_update(mock_session, toolkit_id, key, value) 39 | 40 | # Assert 41 | # mock_session.add.assert_called_once_with(ToolConfig(toolkit_id=toolkit_id, key=key, value=value)) 42 | mock_session.commit.assert_called_once() -------------------------------------------------------------------------------- /tests/unit_tests/resource_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/resource_manager/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/code/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/code/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/code/test_write_spec.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import Mock 2 | 3 | import pytest 4 | 5 | from superagi.tools.code.write_spec import WriteSpecTool 6 | from unittest.mock import MagicMock 7 | 8 | 9 | class MockBaseLlm: 10 | def chat_completion(self, messages, max_tokens): 11 | return {"content": "Generated specification"} 12 | 13 | def get_model(self): 14 | return "gpt-3.5-turbo" 15 | 16 | class TestWriteSpecTool: 17 | 18 | @pytest.fixture 19 | def tool(self): 20 | tool = WriteSpecTool() 21 | tool.llm = MockBaseLlm() 22 | tool.resource_manager = Mock() 23 | mock_session = MagicMock(name="session") 24 | tool.toolkit_config.session = mock_session 25 | return tool 26 | 27 | def test_execute(self, tool): 28 | tool.resource_manager.write_file = Mock() 29 | tool.resource_manager.write_file.return_value = "File write successful" 30 | response = tool._execute("Test task description", "test_spec_file.txt") 31 | assert response == "Generated specification\nSpecification generated and saved successfully" 32 | tool.resource_manager.write_file.assert_called_once_with("test_spec_file.txt", "Generated specification") 33 | -------------------------------------------------------------------------------- /tests/unit_tests/tools/duck_duck_go/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/duck_duck_go/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/duck_duck_go/test_duckduckgo_toolkit.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from superagi.tools.duck_duck_go.duck_duck_go_search_toolkit import DuckDuckGoToolkit 3 | from superagi.tools.duck_duck_go.duck_duck_go_search import DuckDuckGoSearchTool 4 | 5 | class TestDuckDuckGoSearchToolKit: 6 | def setup_method(self): 7 | """ 8 | Set up the test fixture. 9 | 10 | This method is called before each test method is executed to prepare the test environment. 11 | 12 | Returns: 13 | None 14 | """ 15 | self.toolkit = DuckDuckGoToolkit() 16 | 17 | def test_get_tools(self): 18 | """ 19 | Test the `get_tools` method of the `DuckDuckGoToolkit` class. 20 | 21 | It should return a list of tools, containing one instance of `DuckDuckGoSearchTool`. 22 | 23 | Returns: 24 | None 25 | """ 26 | tools = self.toolkit.get_tools() 27 | assert len(tools) == 1 28 | assert isinstance(tools[0], DuckDuckGoSearchTool) 29 | 30 | def test_get_env_keys(self): 31 | """ 32 | Test the `get_env_keys` method of the `DuckDuckGoToolkit` class. 33 | 34 | It should return an empty list of environment keys. 35 | 36 | Returns: 37 | None 38 | """ 39 | env_keys = self.toolkit.get_env_keys() 40 | assert len(env_keys) == 0 41 | -------------------------------------------------------------------------------- /tests/unit_tests/tools/email/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/email/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/email/test_read_email.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import patch, Mock 2 | 3 | from superagi.tools.email.read_email import ReadEmailTool 4 | 5 | 6 | @patch('superagi.tools.email.read_email.ImapEmail') 7 | @patch('superagi.tools.email.read_email.ReadEmail') 8 | def test_execute(mock_read_email, mock_imap_email): 9 | # Configure the mock objects 10 | mock_conn = Mock() 11 | mock_conn.select.return_value = ('OK', ['10']) # assume 10 messages in INBOX 12 | mock_conn.fetch.return_value = ('OK', [(b'1 (RFC822 {337}', b'Some email content')]) 13 | mock_imap_email.return_value.imap_open.return_value = mock_conn 14 | mock_read_email.return_value.obtain_header.return_value = ('From', 'To', 'Date', 'Subject') 15 | mock_read_email.return_value.clean_email_body.return_value = 'Cleaned email body' 16 | 17 | # Set up ReadEmailTool object 18 | tool = ReadEmailTool() 19 | tool.toolkit_config.get_tool_config = Mock() 20 | tool.toolkit_config.get_tool_config.return_value = 'dummy_value' 21 | 22 | # Call the function 23 | result = tool._execute() 24 | 25 | # Check the results 26 | assert len(result) == 5 # check that one email was processed 27 | assert result[0]['From'] == 'From' 28 | assert result[0]['To'] == 'To' 29 | assert result[0]['Date'] == 'Date' 30 | assert result[0]['Subject'] == 'Subject' 31 | assert result[0]['Message Body'] == 'Cleaned email body' 32 | -------------------------------------------------------------------------------- /tests/unit_tests/tools/file/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/file/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/file/test_list_files.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import MagicMock, patch 2 | 3 | import pytest 4 | 5 | from superagi.tools.file.list_files import ListFileTool 6 | 7 | 8 | @pytest.fixture 9 | def list_file_tool(): 10 | list_file_tool = ListFileTool() 11 | list_file_tool.agent_id = 1 # Set a dummy agent ID for testing. 12 | # list_file_tool = "test_agent" 13 | mock_session = MagicMock(name="session") 14 | list_file_tool.toolkit_config.session = mock_session 15 | 16 | yield list_file_tool 17 | 18 | def test_list_files(list_file_tool): 19 | with patch('os.walk') as mock_walk: 20 | mock_walk.return_value = [ 21 | ('/path/to', ('subdir',), ('file1.txt', '.file2.txt')), 22 | ('/path/to/subdir', (), ('file3.txt', 'file4.txt')) 23 | ] 24 | 25 | files = list_file_tool.list_files('/path/to') 26 | 27 | assert files == ['file1.txt', 'file3.txt', 'file4.txt'] 28 | 29 | def test_execute(list_file_tool): 30 | mock_get_formatted_agent_level_path = MagicMock(return_value="SuperAGI/workspace/input/{agent_id}/") 31 | 32 | with patch.object(ListFileTool, 'list_files', return_value=['file1.txt', 'file2.txt']), \ 33 | patch('superagi.helper.resource_helper.ResourceHelper.get_formatted_agent_level_path', new=mock_get_formatted_agent_level_path): 34 | 35 | files = list_file_tool._execute() 36 | 37 | assert files == ['file1.txt', 'file2.txt'] -------------------------------------------------------------------------------- /tests/unit_tests/tools/github/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/github/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/image_generation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/image_generation/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/instagram_tool/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/instagram_tool/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/instagram_tool/test_instagram_toolkit.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from superagi.tools.instagram_tool.instagram import InstagramTool 3 | from superagi.tools.instagram_tool.instagram_toolkit import InstagramToolkit 4 | 5 | class TestInstagramToolKit: 6 | def setup_method(self): 7 | """ 8 | Set up the test fixture. 9 | 10 | This method is called before each test method is executed to prepare the test environment. 11 | 12 | Returns: 13 | None 14 | """ 15 | self.toolkit = InstagramToolkit() 16 | 17 | def test_get_tools(self): 18 | """ 19 | Test the `get_tools` method of the `DuckDuckGoToolkit` class. 20 | 21 | It should return a list of tools, containing one instance of `DuckDuckGoSearchTool`. 22 | 23 | Returns: 24 | None 25 | """ 26 | tools = self.toolkit.get_tools() 27 | assert len(tools) == 1 28 | assert isinstance(tools[0], InstagramTool) 29 | 30 | def test_get_env_keys(self): 31 | """ 32 | Test the `get_env_keys` method of the `DuckDuckGoToolkit` class. 33 | 34 | It should return an empty list of environment keys. 35 | 36 | Returns: 37 | None 38 | """ 39 | env_keys = self.toolkit.get_env_keys() 40 | assert len(env_keys) == 2 41 | -------------------------------------------------------------------------------- /tests/unit_tests/tools/jira/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/jira/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/jira/test_create_issue.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from unittest.mock import Mock, patch 3 | from superagi.tools.jira.create_issue import CreateIssueTool 4 | 5 | CreateIssueTool 6 | @patch("superagi.tools.jira.create_issue.JiraTool.build_jira_instance") 7 | def test_create_issue_tool(mock_build_jira_instance): 8 | # Arrange 9 | mock_jira_instance = Mock() 10 | mock_new_issue = Mock() 11 | mock_new_issue.key = "TEST-1" 12 | mock_jira_instance.create_issue.return_value = mock_new_issue 13 | mock_build_jira_instance.return_value = mock_jira_instance 14 | tool = CreateIssueTool() 15 | fields = { 16 | "summary": "test issue", 17 | "project": "project_id", 18 | "description": "test description", 19 | "issuetype": {"name": "Task"}, 20 | "priority": {"name": "Low"}, 21 | } 22 | 23 | # Act 24 | result = tool._execute(fields) 25 | 26 | # Assert 27 | mock_jira_instance.create_issue.assert_called_once_with(fields=fields) 28 | assert result == f"Issue '{mock_new_issue.key}' created successfully!" -------------------------------------------------------------------------------- /tests/unit_tests/tools/jira/test_edit_issue.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from unittest.mock import Mock, patch 3 | 4 | from superagi.tools.jira.edit_issue import EditIssueTool 5 | 6 | 7 | @patch("superagi.tools.jira.edit_issue.JiraTool.build_jira_instance") 8 | def test_edit_issue_tool(mock_build_jira_instance): 9 | # Arrange 10 | mock_jira_instance = Mock() 11 | mock_issue = Mock() 12 | mock_issue.key = "TEST-1" 13 | mock_jira_instance.search_issues.return_value = [mock_issue] 14 | mock_build_jira_instance.return_value = mock_jira_instance 15 | tool = EditIssueTool() 16 | key = "TEST-1" 17 | fields = { 18 | "summary": "test issue", 19 | "project": "project_id", 20 | "description": "test description", 21 | "issuetype": {"name": "Task"}, 22 | "priority": {"name": "Low"}, 23 | } 24 | 25 | # Act 26 | result = tool._execute(key, fields) 27 | 28 | # Assert 29 | mock_jira_instance.search_issues.assert_called_once_with(f"key={key}") 30 | mock_issue.update.assert_called_once_with(fields=fields) 31 | assert result == f"Issue '{mock_issue.key}' created successfully!" 32 | -------------------------------------------------------------------------------- /tests/unit_tests/tools/jira/test_get_projects.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from unittest.mock import patch, Mock 3 | 4 | from superagi.tools.jira.get_projects import GetProjectsTool 5 | 6 | @patch("superagi.tools.jira.get_projects.JiraTool.build_jira_instance") 7 | def test_get_projects_tool(mock_build_jira_instance): 8 | # Arrange 9 | mock_jira_instance = Mock() 10 | mock_project_1 = Mock() 11 | mock_project_1.id = "123" 12 | mock_project_1.key = "PRJ1" 13 | mock_project_1.name = "Project 1" 14 | 15 | mock_projects = [mock_project_1] 16 | mock_jira_instance.projects.return_value = mock_projects 17 | mock_build_jira_instance.return_value = mock_jira_instance 18 | 19 | tool = GetProjectsTool() 20 | 21 | # Act 22 | result = tool._execute() 23 | 24 | # Assert 25 | mock_jira_instance.projects.assert_called_once() 26 | assert "Found 1 projects" in result 27 | assert "123" in result 28 | assert "PRJ1" in result 29 | assert "Project 1" in result -------------------------------------------------------------------------------- /tests/unit_tests/tools/jira/test_search_issues.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import Mock, patch 2 | 3 | from superagi.tools.jira.search_issues import SearchJiraTool 4 | 5 | @patch("superagi.tools.jira.search_issues.JiraTool.build_jira_instance") 6 | def test_search_jira_tool(mock_build_jira_instance): 7 | mock_jira_instance = Mock() 8 | mock_issue_1 = Mock() 9 | mock_issue_1.key = "TEST-1" 10 | mock_issue_1.fields.summary = "Test issue summary 1" 11 | mock_issue_1.fields.created = "2023-06-01T10:20:30.400Z" 12 | mock_issue_1.fields.priority.name = "High" 13 | mock_issue_1.fields.status.name = "Open" 14 | mock_issue_1.fields.assignee = None 15 | mock_issue_1.fields.issuelinks = [] 16 | mock_issues = [mock_issue_1] 17 | mock_jira_instance.search_issues.return_value = mock_issues 18 | mock_build_jira_instance.return_value = mock_jira_instance 19 | tool = SearchJiraTool() 20 | query = 'summary ~ "test"' 21 | 22 | result = tool._execute(query) 23 | 24 | mock_jira_instance.search_issues.assert_called_once_with(query) 25 | assert "Found 1 issues" in result 26 | assert f"'key': '{mock_issue_1.key}'" in result 27 | assert f"'summary': '{mock_issue_1.fields.summary}'" in result 28 | assert f"'priority': '{mock_issue_1.fields.priority.name}'" in result 29 | assert f"'status': '{mock_issue_1.fields.status.name}'" in result 30 | assert "'related_issues': {}" in result -------------------------------------------------------------------------------- /tests/unit_tests/tools/knowledge_tool/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/knowledge_tool/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/searx/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/tools/searx/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/tools/searx/test_searx_toolkit.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from superagi.tools.searx.searx import SearxSearchTool 4 | from superagi.tools.searx.searx_toolkit import SearxSearchToolkit 5 | 6 | 7 | class TestSearxSearchToolkit(unittest.TestCase): 8 | 9 | def setUp(self): 10 | """ 11 | Set up the test fixture. 12 | 13 | This method is called before each test method is executed to prepare the test environment. 14 | 15 | Returns: 16 | None 17 | """ 18 | self.toolkit = SearxSearchToolkit() 19 | 20 | def test_get_tools(self): 21 | """ 22 | Test the `get_tools` method of the `SearxSearchToolkit` class. 23 | 24 | It should return a list of tools, containing one instance of `SearxSearchTool`. 25 | 26 | Returns: 27 | None 28 | """ 29 | 30 | tools = self.toolkit.get_tools() 31 | self.assertEqual(1, len(tools)) 32 | self.assertIsInstance(tools[0], SearxSearchTool) 33 | 34 | def test_get_env_keys(self): 35 | """ 36 | Test the `get_env_keys` method of the `SearxSearchToolkit` class. 37 | 38 | It should return an empty list of environment keys. 39 | 40 | Returns: 41 | None 42 | """ 43 | env_keys = self.toolkit.get_env_keys() 44 | self.assertEqual(0, len(env_keys)) 45 | -------------------------------------------------------------------------------- /tests/unit_tests/types/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/types/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/types/test_model_source_types.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from superagi.types.model_source_types import ModelSourceType 4 | 5 | 6 | def test_get_model_source_type(): 7 | assert ModelSourceType.get_model_source_type('Google Palm') == ModelSourceType.GooglePalm 8 | assert ModelSourceType.get_model_source_type('OPENAI') == ModelSourceType.OpenAI 9 | 10 | with pytest.raises(ValueError) as excinfo: 11 | ModelSourceType.get_model_source_type('INVALIDSOURCE') 12 | assert "INVALIDSOURCE is not a valid vector store name." in str(excinfo.value) 13 | 14 | def test_get_model_source_from_model(): 15 | open_ai_models = ['gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-4-32k'] 16 | google_models = ['google-palm-bison-001', 'models/chat-bison-001'] 17 | 18 | for model in open_ai_models: 19 | assert ModelSourceType.get_model_source_from_model(model) == ModelSourceType.OpenAI 20 | 21 | for model in google_models: 22 | assert ModelSourceType.get_model_source_from_model(model) == ModelSourceType.GooglePalm 23 | 24 | assert ModelSourceType.get_model_source_from_model('unregistered-model') == ModelSourceType.OpenAI 25 | 26 | def test_str_representation(): 27 | assert str(ModelSourceType.GooglePalm) == 'Google Palm' 28 | assert str(ModelSourceType.OpenAI) == 'OpenAi' 29 | -------------------------------------------------------------------------------- /tests/unit_tests/vector_embeddings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/vector_embeddings/__init__.py -------------------------------------------------------------------------------- /tests/unit_tests/vector_store/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tests/unit_tests/vector_store/__init__.py -------------------------------------------------------------------------------- /tgwui/config/loras/place-your-loras-here.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tgwui/config/loras/place-your-loras-here.txt -------------------------------------------------------------------------------- /tgwui/config/presets/Debug-deterministic.yaml: -------------------------------------------------------------------------------- 1 | do_sample: False 2 | -------------------------------------------------------------------------------- /tgwui/config/presets/Kobold-Godlike.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 0.5 3 | top_k: 0 4 | temperature: 0.7 5 | repetition_penalty: 1.1 6 | typical_p: 0.19 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/Kobold-Liminal Drift.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 1.0 3 | top_k: 0 4 | temperature: 0.66 5 | repetition_penalty: 1.1 6 | typical_p: 0.6 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/LLaMA-Precise.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 0.1 3 | top_k: 40 4 | temperature: 0.7 5 | repetition_penalty: 1.18 6 | typical_p: 1.0 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/Naive.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | temperature: 0.7 3 | top_p: 0.85 4 | top_k: 50 5 | -------------------------------------------------------------------------------- /tgwui/config/presets/NovelAI-Best Guess.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 0.9 3 | top_k: 100 4 | temperature: 0.8 5 | repetition_penalty: 1.15 6 | typical_p: 1.0 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/NovelAI-Decadence.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 1.0 3 | top_k: 100 4 | temperature: 2 5 | repetition_penalty: 1 6 | typical_p: 0.97 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/NovelAI-Genesis.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 0.98 3 | top_k: 0 4 | temperature: 0.63 5 | repetition_penalty: 1.05 6 | typical_p: 1.0 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/NovelAI-Lycaenidae.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 0.85 3 | top_k: 12 4 | temperature: 2 5 | repetition_penalty: 1.15 6 | typical_p: 1.0 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/NovelAI-Ouroboros.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 1.0 3 | top_k: 100 4 | temperature: 1.07 5 | repetition_penalty: 1.05 6 | typical_p: 1.0 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/NovelAI-Pleasing Results.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 1.0 3 | top_k: 0 4 | temperature: 0.44 5 | repetition_penalty: 1.15 6 | typical_p: 1.0 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/NovelAI-Sphinx Moth.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 0.18 3 | top_k: 30 4 | temperature: 2.0 5 | repetition_penalty: 1.15 6 | typical_p: 1.0 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/NovelAI-Storywriter.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | top_p: 0.73 3 | top_k: 0 4 | temperature: 0.72 5 | repetition_penalty: 1.1 6 | typical_p: 1.0 7 | -------------------------------------------------------------------------------- /tgwui/config/presets/Special-Contrastive Search.yaml: -------------------------------------------------------------------------------- 1 | do_sample: False 2 | penalty_alpha: 0.6 3 | top_k: 4 4 | -------------------------------------------------------------------------------- /tgwui/config/presets/Special-Eta Sampling.yaml: -------------------------------------------------------------------------------- 1 | do_sample: true 2 | eta_cutoff: 3 3 | temperature: 0.7 4 | repetition_penalty: 1.18 5 | -------------------------------------------------------------------------------- /tgwui/config/prompts/Alpaca-with-Input.txt: -------------------------------------------------------------------------------- 1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request. 2 | 3 | ### Instruction: 4 | Instruction 5 | 6 | ### Input: 7 | Input 8 | 9 | ### Response: 10 | 11 | -------------------------------------------------------------------------------- /tgwui/config/prompts/GPT-4chan.txt: -------------------------------------------------------------------------------- 1 | ----- 2 | --- 865467536 3 | Hello, AI frens! 4 | How are you doing on this fine day? 5 | --- 865467537 6 | 7 | -------------------------------------------------------------------------------- /tgwui/config/prompts/QA.txt: -------------------------------------------------------------------------------- 1 | Common sense questions and answers 2 | 3 | Question: 4 | Factual answer: 5 | -------------------------------------------------------------------------------- /tgwui/config/training/datasets/put-trainer-datasets-here.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/tgwui/config/training/datasets/put-trainer-datasets-here.txt -------------------------------------------------------------------------------- /tgwui/config/training/formats/alpaca-chatbot-format.json: -------------------------------------------------------------------------------- 1 | { 2 | "instruction,output": "User: %instruction%\nAssistant: %output%", 3 | "instruction,input,output": "User: %instruction%: %input%\nAssistant: %output%" 4 | } 5 | -------------------------------------------------------------------------------- /tgwui/config/training/formats/alpaca-format.json: -------------------------------------------------------------------------------- 1 | { 2 | "instruction,output": "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n%instruction%\n\n### Response:\n%output%", 3 | "instruction,input,output": "Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n\n### Instruction:\n%instruction%\n\n### Input:\n%input%\n\n### Response:\n%output%" 4 | } 5 | -------------------------------------------------------------------------------- /tgwui/scripts/build_extensions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Specify the directory containing the top-level folders 4 | directory="/app/extensions" 5 | 6 | # Iterate over the top-level folders 7 | for folder in "$directory"/*; do 8 | if [ -d "$folder" ]; then 9 | # Change directory to the current folder 10 | cd "$folder" 11 | 12 | # Check if requirements.txt file exists 13 | if [ -f "requirements.txt" ]; then 14 | echo "Installing requirements in $folder..." 15 | pip3 install -r requirements.txt 16 | echo "Requirements installed in $folder" 17 | else 18 | echo "Skipping $folder: requirements.txt not found" 19 | fi 20 | 21 | # Change back to the original directory 22 | cd "$directory" 23 | fi 24 | done 25 | 26 | -------------------------------------------------------------------------------- /tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": { 3 | } 4 | } -------------------------------------------------------------------------------- /workspace/input/.temp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/workspace/input/.temp -------------------------------------------------------------------------------- /workspace/output/.temp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransformerOptimus/SuperAGI/c3c1982e7bd6a11cfed53c5a193ea502f924b1b6/workspace/output/.temp -------------------------------------------------------------------------------- /workspace/output/testing.txt: -------------------------------------------------------------------------------- 1 | "Hello World" 2 | --------------------------------------------------------------------------------