Dsxir.Predictor.CodeAct (dsxir v0.4.0)

Copy Markdown

ProgramOfThought whose generated code may call user-provided Dsxir.Tools from inside the Dune sandbox. The generated Elixir is constrained to the default safe allowlist plus one dispatcher function; the tools themselves are trusted and run with their own privileges, exactly as Dsxir.Predictor.ReAct trusts its tools.

Declaration

predictor :solve, Dsxir.Predictor.CodeAct,
  signature: DataTask

:tools, :max_iters, and the sandbox opts are passed at call time, not in the declaration (tools are usually runtime values):

call(prog, :solve, inputs, tools: [stats_tool, parse_tool], max_iters: 5)

Recognised opts

If a caller passes a custom :allowlist, it must permit Dsxir.Predictor.CodeExec.ToolBridge.call/3 or tool calls from generated code will be rejected by the sandbox.

Returns a %Dsxir.Prediction{} with the signature's outputs plus :generated_code and :trajectory.