[REFACTOR][ToolAgent]

pull/378/head
Kye 11 months ago
parent 70c2a8515f
commit 42049f4411

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
name = "swarms" name = "swarms"
version = "3.9.9" version = "4.0.0"
description = "Swarms - Pytorch" description = "Swarms - Pytorch"
license = "MIT" license = "MIT"
authors = ["Kye Gomez <kye@apac.ai>"] authors = ["Kye Gomez <kye@apac.ai>"]

@ -1,6 +1,7 @@
from swarms.tools.format_tools import Jsonformer
from typing import Any from typing import Any
from swarms.models.base_llm import AbstractLLM from swarms.models.base_llm import AbstractLLM
from swarms.tools.format_tools import Jsonformer
class ToolAgent(AbstractLLM): class ToolAgent(AbstractLLM):
@ -65,15 +66,17 @@ class ToolAgent(AbstractLLM):
model: Any, model: Any,
tokenizer: Any, tokenizer: Any,
json_schema: Any, json_schema: Any,
max_number_tokens: int = 500,
*args, *args,
**kwargs, **kwargs,
): ):
super().__init__() super().__init__(*args, **kwargs)
self.name = name self.name = name
self.description = description self.description = description
self.model = model self.model = model
self.tokenizer = tokenizer self.tokenizer = tokenizer
self.json_schema = json_schema self.json_schema = json_schema
self.max_number_tokens = max_number_tokens
def run(self, task: str, *args, **kwargs): def run(self, task: str, *args, **kwargs):
""" """
@ -92,10 +95,11 @@ class ToolAgent(AbstractLLM):
""" """
try: try:
self.toolagent = Jsonformer( self.toolagent = Jsonformer(
self.model, model=self.model,
self.tokenizer, tokenizer=self.tokenizer,
self.json_schema, json_schema=self.json_schema,
task, prompt=task,
max_number_tokens=self.max_number_tokens,
*args, *args,
**kwargs, **kwargs,
) )

Loading…
Cancel
Save