swarms icon indicating copy to clipboard operation
swarms copied to clipboard

[BUG] pug with BaseTool init

Open lometheus opened this issue 1 year ago • 3 comments

when i try example with this https://docs.swarms.world/en/latest/swarms/tools/build_tool/#integrate-tools-into-agent

i get this error:

Traceback (most recent call last):
  File "/Users/fenyi/codesy/swarm-test/test.py", line 109, in <module>
    agent1 = Agent(
             ^^^^^^
  File "/Users/fenyi/codesy/swarm-test/.venv/lib/python3.12/site-packages/swarms/structs/agent.py", line 407, in __init__
    self.tool_struct = BaseTool(
                       ^^^^^^^^^
  File "/Users/fenyi/codesy/swarm-test/.venv/lib/python3.12/site-packages/pydantic/main.py", line 194, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for BaseTool
base_models
  Input should be a valid list [type=list_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.8/v/list_type
Sentry is attempting to send 2 pending events

bug from here image

actually list_base_models does not have default value, image

you can ealisy find this question with this code `from swarms import Agent from swarms.prompts.tools import tool_sop_prompt

from swarm_models import OpenAIChat from swarms_memory import ChromaDB import subprocess import os from swarms.tools.base_tool import BaseTool

def terminal( code: str, ): """ Run code in the terminal.

Args:
    code (str): The code to run in the terminal.

Returns:
    str: The output of the code.
"""
out = subprocess.run(
    code, shell=True, capture_output=True, text=True
).stdout
return str(out)

BaseTool( tools=[terminal], base_models=None, tool_system_prompt=tool_sop_prompt(), )`

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

lometheus avatar Oct 14 '24 14:10 lometheus

i believe give list_base_models a default value in class Agent can relsove this question

lometheus avatar Oct 14 '24 14:10 lometheus

submitted pull request to fix this issue

peytontolbert avatar Oct 14 '24 23:10 peytontolbert

@lometheus is this fixed now? let me know so we can fix it?

kyegomez avatar Jan 09 '25 21:01 kyegomez