diff options
| author | sigoden <sigoden@gmail.com> | 2024-06-07 15:16:31 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-07 15:16:31 +0800 |
| commit | 739a832d87c00e3b5977a24bba5654fa5ea7a702 (patch) | |
| tree | 2bb4c102a3e04b9c8c1ecd61bdb6c92f84ca27cb /tools/may_execute_py_code.py | |
| parent | 2b07fc2c7e4e6311d35ae72c17b25e47680d61f6 (diff) | |
| download | llm-functions-docker-739a832d87c00e3b5977a24bba5654fa5ea7a702.tar.gz | |
feat: js/py generate declarations from comments (#30)
Diffstat (limited to 'tools/may_execute_py_code.py')
| -rw-r--r-- | tools/may_execute_py_code.py | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/tools/may_execute_py_code.py b/tools/may_execute_py_code.py index 01a59b9..8e55a8d 100644 --- a/tools/may_execute_py_code.py +++ b/tools/may_execute_py_code.py @@ -1,21 +1,6 @@ -def declarate(): - return { - "name": "may_execute_py_code", - "description": "Runs the python code.", - "parameters": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Python code to execute, such as `print(\"hello world\")`" - } - }, - "required": [ - "code" - ] - } - } - - -def execute(data): - exec(data["code"]) +def main(code: str): + """Runs the python code. + Args: + code: Python code to execute, such as `print("hello world")` + """ + exec(code) |
