aboutsummaryrefslogtreecommitdiffstats
path: root/tools/may_execute_py_code.py
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-07 15:16:31 +0800
committerGitHub <noreply@github.com>2024-06-07 15:16:31 +0800
commit739a832d87c00e3b5977a24bba5654fa5ea7a702 (patch)
tree2bb4c102a3e04b9c8c1ecd61bdb6c92f84ca27cb /tools/may_execute_py_code.py
parent2b07fc2c7e4e6311d35ae72c17b25e47680d61f6 (diff)
downloadllm-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.py27
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)