Run python code in a REPL.
(query : str)
| 50 | |
| 51 | @tool.get("/run_python") |
| 52 | def run_python(query : str): |
| 53 | '''Run python code in a REPL. |
| 54 | ''' |
| 55 | if sanitize_input: |
| 56 | query = query.strip().strip("```") |
| 57 | return python_repl.run(query) |
| 58 | |
| 59 | |
| 60 | return tool |