Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Github tool #903

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/superagent/app/api/workflow_configs/saml_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
4 changes: 4 additions & 0 deletions libs/superagent/app/models/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ class HTTPInput(BaseModel):

class TavilyInput(BaseModel):
query: str


class GithubInput(BaseModel):
query: str
3 changes: 3 additions & 0 deletions libs/superagent/app/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
WolframInput,
ZapierInput,
TavilyInput,
GithubInput,
)
from app.tools.agent import Agent
from app.tools.algolia import Algolia
Expand All @@ -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__)

Expand Down Expand Up @@ -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}
Expand Down
13 changes: 13 additions & 0 deletions libs/superagent/app/tools/github.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "ToolType" ADD VALUE 'GITHUB';
1 change: 1 addition & 0 deletions libs/superagent/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ enum ToolType {
HTTP
SUPERRAG
RESEARCH
GITHUB
}

enum DatasourceType {
Expand Down
9 changes: 9 additions & 0 deletions libs/ui/config/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down