kyegomez / swarms

The Enterprise-Grade Production-Ready Multi-Agent Orchestration Framework Join our Community: https://discord.com/servers/agora-999382051935506503
https://docs.swarms.world
Other
1.16k stars 167 forks source link

[BUG] `Error checking stopping condition: 'str' object is not callable` error when using a very, very basic agent. #559

Open aimzieslol opened 1 month ago

aimzieslol commented 1 month ago

Describe the bug

When using a very basic Agent to test functionality, after adding the stopping_condition as a string to the Agent() class construction, I see the error shown in the issue title.

To Reproduce

This is the Agent code:

dumb_agent = Agent(agent_name='dumb-tester',
                   agent_description=('does dumb things'),
                   llm=get_groq_llm(),
                   max_loops=10,
                   verbose=True,
                   stopping_condition="finish")

This is how I run it:

dumb_agent.run('make me a linked in post about machine learning. it can only be 240 chars. output the text and the # of chars used. provide detailed reasoning why you chose the wording for this post.')

Despite a successful run on the first "loop," the agent runs to the maximum loop number because there's no stopping condition.

Upvote & Fund

Fund with Polar

kyegomez commented 1 month ago

@aimzieslol the stopping condition is supposed to be a callable function, i think what you're looking for is the stopping_token="finish", let me know if this works!

kyegomez commented 1 week ago

@aimzieslol did it work well?

aimzieslol commented 6 days ago

Latest test using the same code from before produces this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-4-527ba3a8ba9b>](https://localhost:8080/#) in <cell line: 1>()
----> 1 from swarms import Agent, OpenAIChat
      2 
      3 agent = Agent(
      4     agent_name="API Requester",
      5     agent_description="This agent is responsible for making API requests.",

6 frames
[/usr/local/lib/python3.10/dist-packages/swarms/__init__.py](https://localhost:8080/#) in <module>
----> 1 from swarms.telemetry.bootup import bootup  # noqa: E402, F403
      2 from swarms.telemetry.sentry_active import activate_sentry
      3 
      4 bootup()
      5 activate_sentry()

[/usr/local/lib/python3.10/dist-packages/swarms/telemetry/bootup.py](https://localhost:8080/#) in <module>
      4 
      5 from swarms.telemetry.auto_upgrade_swarms import auto_update
----> 6 from swarms.utils.disable_logging import disable_logging
      7 
      8 

[/usr/local/lib/python3.10/dist-packages/swarms/utils/__init__.py](https://localhost:8080/#) in <module>
      1 from swarms.utils.class_args_wrapper import print_class_parameters
----> 2 from swarms.tools.prebuilt.code_interpreter import (
      3     SubprocessCodeInterpreter,
      4 )
      5 from swarms.utils.data_to_text import (

[/usr/local/lib/python3.10/dist-packages/swarms/tools/__init__.py](https://localhost:8080/#) in <module>
      3     tool_find_by_name,
      4 )
----> 5 from swarms.tools.func_calling_executor import openai_tool_executor
      6 from swarms.tools.pydantic_to_json import (
      7     _remove_a_key,

[/usr/local/lib/python3.10/dist-packages/swarms/tools/func_calling_executor.py](https://localhost:8080/#) in <module>
      1 import concurrent.futures
      2 from typing import Callable, Any, Dict, List
----> 3 from swarms.utils.loguru_logger import logger
      4 
      5 

[/usr/local/lib/python3.10/dist-packages/swarms/utils/loguru_logger.py](https://localhost:8080/#) in <module>
      8 
      9 logger.add(
---> 10     os.path.join(WORKSPACE_DIR, "swarms.log"),
     11     level="INFO",
     12     colorize=True,

[/usr/lib/python3.10/posixpath.py](https://localhost:8080/#) in join(a, *p)
     74     will be discarded.  An empty last part will result in a path that
     75     ends with a separator."""
---> 76     a = os.fspath(a)
     77     sep = _get_sep(a)
     78     path = a

TypeError: expected str, bytes or os.PathLike object, not NoneType