|
|
@ -36,38 +36,38 @@ from transformers import load_tool
|
|
|
|
# api_type = data.get("api_type", self.api_type)
|
|
|
|
# api_type = data.get("api_type", self.api_type)
|
|
|
|
|
|
|
|
|
|
|
|
# if not(api_key and api_type and api_endpoint):
|
|
|
|
# if not(api_key and api_type and api_endpoint):
|
|
|
|
# raise ValueError("Please provide api_key, api_type, and api_endpoint")
|
|
|
|
# # raise ValueError("Please provide api_key, api_type, and api_endpoint")
|
|
|
|
|
|
|
|
|
|
|
|
# response = chat_huggingface(messages, api_key, api_type, api_endpoint)
|
|
|
|
# # response = chat_huggingface(messages, api_key, api_type, api_endpoint)
|
|
|
|
# return response
|
|
|
|
# # return response
|
|
|
|
|
|
|
|
|
|
|
|
class Step:
|
|
|
|
# class Step:
|
|
|
|
def __init__(
|
|
|
|
# def __init__(
|
|
|
|
self,
|
|
|
|
# self,
|
|
|
|
task: str,
|
|
|
|
# task: str,
|
|
|
|
id: int,
|
|
|
|
# id: int,
|
|
|
|
dep: List[int],
|
|
|
|
# dep: List[int],
|
|
|
|
args: Dict[str, str],
|
|
|
|
# args: Dict[str, str],
|
|
|
|
tool: BaseTool
|
|
|
|
# tool: BaseTool
|
|
|
|
):
|
|
|
|
# ):
|
|
|
|
self.task = task
|
|
|
|
# self.task = task
|
|
|
|
self.id = id
|
|
|
|
# self.id = id
|
|
|
|
self.dep = dep
|
|
|
|
# self.dep = dep
|
|
|
|
self.args = args
|
|
|
|
# self.args = args
|
|
|
|
self.tool = tool
|
|
|
|
# self.tool = tool
|
|
|
|
|
|
|
|
|
|
|
|
class Plan:
|
|
|
|
# class Plan:
|
|
|
|
def __init__(
|
|
|
|
# def __init__(
|
|
|
|
self,
|
|
|
|
# self,
|
|
|
|
steps: List[Step]
|
|
|
|
# steps: List[Step]
|
|
|
|
):
|
|
|
|
# ):
|
|
|
|
self.steps = steps
|
|
|
|
# self.steps = steps
|
|
|
|
|
|
|
|
|
|
|
|
def __str__(self) -> str:
|
|
|
|
# def __str__(self) -> str:
|
|
|
|
return str([str(step) for step in self.steps])
|
|
|
|
# return str([str(step) for step in self.steps])
|
|
|
|
|
|
|
|
|
|
|
|
def __repr(self) -> str:
|
|
|
|
# def __repr(self) -> str:
|
|
|
|
return str(self)
|
|
|
|
# return str(self)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|