dspy-rlm-module
Installation
SKILL.md
dspy.RLM — Recursive Language Model
dspy.RLM runs the LLM in a sandboxed Python REPL (Pyodide/WASM via Deno) with access to the full context as variables. The LLM writes code to slice, grep, summarize, and recursively sub-query the data, iterating until it can answer. Use it when the context is too large to cram into a single prompt.
Prerequisites
- Deno installed (for the default
PythonInterpreter):brew install denoor see https://deno.land. The interpreter is a Pyodide-in-WASM sandbox spawned by Deno. - A sub-LM for inner calls — usually a cheaper model than the outer LM. Defaults to
dspy.settings.lm.
Canonical usage
import dspy
dspy.configure(lm=dspy.LM("openai/gpt-4o"))
sub_lm = dspy.LM("openai/gpt-4o-mini") # cheap inner model