forked from Archives/langchain
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
898 B
Python
32 lines
898 B
Python
"""Jira Toolkit."""
|
|
from typing import List
|
|
|
|
from langchain.agents.agent_toolkits.base import BaseToolkit
|
|
from langchain.tools import BaseTool
|
|
from langchain.tools.jira.tool import JiraAction
|
|
from langchain.utilities.jira import JiraAPIWrapper
|
|
|
|
|
|
class JiraToolkit(BaseToolkit):
|
|
"""Jira Toolkit."""
|
|
|
|
tools: List[BaseTool] = []
|
|
|
|
@classmethod
|
|
def from_jira_api_wrapper(cls, jira_api_wrapper: JiraAPIWrapper) -> "JiraToolkit":
|
|
actions = jira_api_wrapper.list()
|
|
tools = [
|
|
JiraAction(
|
|
name=action["name"],
|
|
description=action["description"],
|
|
mode=action["mode"],
|
|
api_wrapper=jira_api_wrapper,
|
|
)
|
|
for action in actions
|
|
]
|
|
return cls(tools=tools)
|
|
|
|
def get_tools(self) -> List[BaseTool]:
|
|
"""Get the tools in the toolkit."""
|
|
return self.tools
|