kyegomez / swarms

The Enterprise-Grade Production-Ready Multi-Agent Orchestration Framework Join our Community: https://discord.com/servers/agora-999382051935506503
https://docs.swarms.world
GNU Affero General Public License v3.0
1.79k stars 245 forks source link

[BUG] Swarms Environment Variables and Template Swarms #632

Open evelynmitchell opened 1 week ago

evelynmitchell commented 1 week ago

Describe the bug Was running Legal-Swarm-Template/main.py in a colab notebook with python 3.10:

Traceback (most recent call last):
  File "/content/Legal-Swarm-Template/main.py", line 7, in <module>
    from swarms.agents.create_agents_from_yaml import (
  File "/usr/local/lib/python3.10/dist-packages/swarms/__init__.py", line 6, in <module>
    from swarms.telemetry.bootup import bootup  # noqa: E402, F403
  File "/usr/local/lib/python3.10/dist-packages/swarms/telemetry/bootup.py", line 7, in <module>
    from swarms.utils.disable_logging import disable_logging
  File "/usr/local/lib/python3.10/dist-packages/swarms/utils/__init__.py", line 2, in <module>
    from swarms.utils.data_to_text import (
  File "/usr/local/lib/python3.10/dist-packages/swarms/utils/data_to_text.py", line 5, in <module>
    from swarms.utils.pdf_to_text import pdf_to_text
  File "/usr/local/lib/python3.10/dist-packages/swarms/utils/pdf_to_text.py", line 2, in <module>
    from swarms.utils.try_except_wrapper import try_except_wrapper
  File "/usr/local/lib/python3.10/dist-packages/swarms/utils/try_except_wrapper.py", line 5, in <module>
    from swarms.utils.loguru_logger import logger
  File "/usr/local/lib/python3.10/dist-packages/swarms/utils/loguru_logger.py", line 8, in <module>
    os.path.join(WORKSPACE_DIR, "swarms.log"),
  File "/usr/lib/python3.10/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

The error is occurring because WORKSPACE_DIR, which is used for logging is not set.

The .env.example fot Legal-Swarms-Template only includes the OpenAI and Groq api keys.

When someone uses the template, and not the swarms source install, they would not see the full list of environment variables assumed to be available in swarms, as shown in swarms/.env.example

Perhaps a more robust swarms install process, or configuration tool could be used to set the env vars in projects that use swarms.

Upvote & Fund

Fund with Polar