Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add playground tools [WIP]
Tomáš Valentac692a48b9770
diff --git a/api-service/codegen/tools/playground/__init__.py b/api-service/codegen/tools/playground/__init__.pynew file mode 100644index 000000000..e49b15106--- /dev/null+++ b/api-service/codegen/tools/playground/__init__.py@@ -0,0 +1 @@+import\ No newline at end of filediff --git a/api-service/codegen/tools/playground/tool.py b/api-service/codegen/tools/playground/tool.pynew file mode 100644index 000000000..97eef20be--- /dev/null+++ b/api-service/codegen/tools/playground/tool.py@@ -0,0 +1,23 @@+"""A tool for running code in eval() on remote endpoint"""++from langchain.tools.base import BaseTool+from codegen.tools.javascript.eval import eval as js_eval+++class PlaygroundTool(BaseTool):+ name = "JavaScriptCodeExecution"+ description = (+ "JavaScript eval() function that can execute code. Use this to execute and evaluate javascript code. "+ "Input should be a valid javascript code. "+ )++ def __init__(self) -> None:+ super().__init__()+++ def _run(self, query: str) -> str:+ query = query.strip().strip("`")+ return js_eval(query)++ async def _arun(self, query: str) -> str:+ return NotImplementedError("JavascriptEval does not support async")