diff --git a/libs/superagent/app/api/workflow_configs/saml_schema.py b/libs/superagent/app/api/workflow_configs/saml_schema.py index e494e0197..ee3160266 100644 --- a/libs/superagent/app/api/workflow_configs/saml_schema.py +++ b/libs/superagent/app/api/workflow_configs/saml_schema.py @@ -81,6 +81,7 @@ class ToolModel(BaseModel): metaphor: Optional[Tool] function: Optional[Tool] research: Optional[Tool] + github: Optional[Tool] # ~~~~~~Assistants as tools~~~~~~ superagent: Optional["SuperagentAgentTool"] openai_assistant: Optional["OpenAIAgentTool"] diff --git a/libs/superagent/app/models/tools.py b/libs/superagent/app/models/tools.py index 431e0af7a..89ee6d60a 100644 --- a/libs/superagent/app/models/tools.py +++ b/libs/superagent/app/models/tools.py @@ -98,3 +98,7 @@ class HTTPInput(BaseModel): class TavilyInput(BaseModel): query: str + + +class GithubInput(BaseModel): + query: str diff --git a/libs/superagent/app/tools/__init__.py b/libs/superagent/app/tools/__init__.py index d80a85a9b..f527b2362 100644 --- a/libs/superagent/app/tools/__init__.py +++ b/libs/superagent/app/tools/__init__.py @@ -25,6 +25,7 @@ WolframInput, ZapierInput, TavilyInput, + GithubInput, ) from app.tools.agent import Agent from app.tools.algolia import Algolia @@ -47,6 +48,7 @@ from app.tools.wolfram_alpha import WolframAlpha from app.tools.zapier import ZapierNLA from app.tools.tavily import Tavily +from app.tools.github import Github logger = logging.getLogger(__name__) @@ -80,6 +82,7 @@ "HTTP": {"class": LCHttpTool, "schema": HTTPInput}, "SUPERRAG": {"class": SuperRagTool, "schema": SuperRagInput}, "RESEARCH": {"class": Tavily, "schema": TavilyInput}, + "GITHUB": {"class": Github, "schema": GithubInput}, } OSS_TOOL_TYPE_MAPPING = {"BROWSER": Browser, "BING_SEARCH": BingSearch} diff --git a/libs/superagent/app/tools/github.py b/libs/superagent/app/tools/github.py new file mode 100644 index 000000000..5c783c32e --- /dev/null +++ b/libs/superagent/app/tools/github.py @@ -0,0 +1,13 @@ +from langchain_community.tools import BaseTool + + +class Github(BaseTool): + name = "Github" + description = "useful for answering questions about github projects" + return_direct = False + + def _run(self, query: str) -> str: + pass + + async def _arun(self, query: str) -> str: + pass diff --git a/libs/superagent/prisma/migrations/20240318081112_github_tool/migration.sql b/libs/superagent/prisma/migrations/20240318081112_github_tool/migration.sql new file mode 100644 index 000000000..90b89b6c5 --- /dev/null +++ b/libs/superagent/prisma/migrations/20240318081112_github_tool/migration.sql @@ -0,0 +1,2 @@ +-- AlterEnum +ALTER TYPE "ToolType" ADD VALUE 'GITHUB'; diff --git a/libs/superagent/prisma/schema.prisma b/libs/superagent/prisma/schema.prisma index c30657d57..3c24d9459 100644 --- a/libs/superagent/prisma/schema.prisma +++ b/libs/superagent/prisma/schema.prisma @@ -59,6 +59,7 @@ enum ToolType { HTTP SUPERRAG RESEARCH + GITHUB } enum DatasourceType { diff --git a/libs/ui/config/site.ts b/libs/ui/config/site.ts index 4b4f7a75c..98a53b7ae 100644 --- a/libs/ui/config/site.ts +++ b/libs/ui/config/site.ts @@ -377,6 +377,15 @@ export const siteConfig = { title: "Research", metadata: [{ key: "apiKey", type: "input", label: "Tavily API key" }], }, + { + value: "GITHUB", + title: "Github", + metadata: [ + { key: "apiKey", type: "input", label: "Github API key" }, + { key: "repository", type: "input", label: "Github Repository" }, + { key: "branch", type: "input", label: "Repositroy branch" }, + ], + }, { value: "SUPERRAG", title: "SuperRag",