Skip to content

Code interpreters: a restricted Elixir language, not Python #201

Description

@deepfates

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions