Spaces:
Paused
Paused
Update Modules/Code_Interpreter.py
Browse files4 unmodified lines56789101112131420 unmodified lines353637383940414243444546474 unmodified linesfrom typing import Annotatedimport gradio as grfrom app import _log_call_end, _log_call_start, _truncate_for_logdef Code_Interpreter(code: Annotated[str, "Python source code to run; stdout is captured and returned."]) -> str:_log_call_start("Code_Interpreter", code=_truncate_for_log(code or "", 300))if code is None:20 unmodified linesoutputs=gr.Textbox(label="Output", lines=5, max_lines=20),title="Code Interpreter",description="<div style=\"text-align:center\">Execute Python code and see the output.</div>",api_description=("Execute arbitrary Python code and return captured stdout or an error message. ""Supports any valid Python code including imports, variables, functions, loops, and calculations. ""Examples: 'print(2+2)', 'import math; print(math.sqrt(16))', 'for i in range(3): print(i)'. ""Parameters: code (str - Python source code to execute). ""Returns: Combined stdout output or exception text if execution fails."),flagging_mode="never",)4 unmodified lines56789101112131415161718192021222320 unmodified lines444546474849504 unmodified linesfrom typing import Annotatedimport gradio as grfrom ._docstrings import autodocfrom app import _log_call_end, _log_call_start, _truncate_for_log# Single source of truth for the LLM-facing tool descriptionTOOL_SUMMARY = ("Execute Python code; returns captured stdout or the exception text.")@autodoc(summary=TOOL_SUMMARY,)def Code_Interpreter(code: Annotated[str, "Python source code to run; stdout is captured and returned."]) -> str:_log_call_start("Code_Interpreter", code=_truncate_for_log(code or "", 300))if code is None:20 unmodified linesoutputs=gr.Textbox(label="Output", lines=5, max_lines=20),title="Code Interpreter",description="<div style=\"text-align:center\">Execute Python code and see the output.</div>",api_description=TOOL_SUMMARY,flagging_mode="never",)
Modules/Code_Interpreter.py+10-7