You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@planetf1 I am not a big fan of allowing this since people would get confused on what actually gets executed by our runtime. Allowing users to include code that never gets executed (by us) is just inviting trouble and confusion. That's why we settled on the requirement of only having a single function, to ensure that it's absolutely clear that only the function itself is executed by Bee -- so it's different from a standard python my_file.py which would execute top-level code instead.
Could you consider having a second separate test file for your local use?
from find_stuff import find_stuff
f = open('test-data', 'r')
find_stuff('mytextstring',f.read())
Alternatively, you could still copy-paste but only select the function itself, skip the if __name__ == "__main__": ... beneath it.
The bee framework requires that Python tools contain only a single function, with optional imports.
When developing some python code for bee, it is useful to include some test code within the definition.
For example I would typically include something like this at the end:
if name == "main":
f = open('test-data', 'r')
find_stuff('mytextstring',f.read())
This makes it easy to run in vscode and then, for example, cut/paste directly into the bee framework.
There may be other ways of achieving the same goal, ie making it easier to develop small python functions, and then wrap them as an agent
This issue is targetted more at the UI - if coding using the API then there is more flexibility
The text was updated successfully, but these errors were encountered: