Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aimzieslol opened this issue Aug 9, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@aimzieslol
Copy link

aimzieslol commented Aug 9, 2024

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

  • 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
@aimzieslol aimzieslol added the bug Something isn't working label Aug 9, 2024
@kyegomez
Copy link
Owner

kyegomez commented Aug 9, 2024

@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
Copy link
Owner

@aimzieslol did it work well?

@aimzieslol
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants