Imp.program_of_thought/2 and Imp.code_act/3 run model-written code in Imp.Sandbox (lib/imp/sandbox.ex), an expression language over literals and variables with arbitrary function calls rejected. Imp.rlm/2 runs a separate, much richer interpreter (lib/imp/predict/rlm/interpreter.ex): assignment and pattern matching, if, bounded for comprehensions, pipes, anonymous functions with guards, most of Enum/Keyword/List/Map/String, and tool calls as suspended effects with step, effect, size and time budgets; no case, def/defmodule or interpolation (see its controller_language_guide/0). Both run inside the VM, and Imp's docs say they are not OS sandboxes (docs/coming-from-dspy.md). DSPy runs Python in Deno/Pyodide by default, and 3.4 adds LocalInterpreter (trusted CPython).
Imp.program_of_thought/2andImp.code_act/3run model-written code inImp.Sandbox(lib/imp/sandbox.ex), an expression language over literals and variables with arbitrary function calls rejected.Imp.rlm/2runs a separate, much richer interpreter (lib/imp/predict/rlm/interpreter.ex): assignment and pattern matching,if, boundedforcomprehensions, pipes, anonymous functions with guards, most ofEnum/Keyword/List/Map/String, and tool calls as suspended effects with step, effect, size and time budgets; nocase,def/defmoduleor interpolation (see itscontroller_language_guide/0). Both run inside the VM, and Imp's docs say they are not OS sandboxes (docs/coming-from-dspy.md). DSPy runs Python in Deno/Pyodide by default, and 3.4 addsLocalInterpreter(trusted CPython).