-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
The "agents" example from the official website failed due to a failure of evaluate_math.
def evaluate_math(expression: str):
return dspy.PythonInterpreter({}).execute(expression)Failed to execute: No output from Deno subprocess. Stderr: error: Module not found "/dspy/.venv/lib/python3.12/site-packages/dspy/primitives/runner.js".
Observation
Related implementation from dspy:
class PythonInterpreter:
r"""
PythonInterpreter that runs code in a sandboxed environment using Deno and Pyodide.
Prerequisites:
- Deno (https://docs.deno.com/runtime/getting_started/installation/).
Example Usage:
```python
code_string = "print('Hello'); 1 + 2"
interp = PythonInterpreter()
output = interp(code_string)
print(output) # If final statement is non-None, prints the numeric result, else prints captured output
interp.shutdown()
```
"""
def __init__(
self,
deno_command: Optional[List[str]] = None
) -> None:
if isinstance(deno_command, dict):
deno_command = None # no-op, just a guard in case someone passes a dict
self.deno_command = deno_command or [
"deno", "run", "--allow-read", self._get_runner_path()
]
self.deno_process = None
def _get_runner_path(self) -> str:
current_dir = os.path.dirname(os.path.abspath(__file__))
return os.path.join(current_dir, "runner.js") # <--- looking for runner.jsThis file should be bundled into the release of dspy, but it's not: /dspy/primitives/runner.js.
As of 2.6.6 the release from PyPI is still broken, there's no primitives/runner.js in the tarball.
SHA256 8fb08bb8009c51d3f972856c19620cab2cc5e2b5a4c379005441bd81267ce905
The same issue was reported and fixed here: #7490
Steps to reproduce
import dspy
dspy.PythonInterpreter({}).execute("1+1")Output:
Traceback (most recent call last):
File "/dspy/main.py", line 3, in <module>
dspy.PythonInterpreter({}).execute("1+1")
File "/dspy/.venv/lib/python3.12/site-packages/dspy/primitives/python_interpreter.py", line 111, in execute
raise InterpreterError(f"No output from Deno subprocess. Stderr: {err_output}")
dspy.primitives.python_interpreter.InterpreterError: No output from Deno subprocess. Stderr: error: Module not found "/dspy/.venv/lib/python3.12/site-packages/dspy/primitives/runner.js".
DSPy version
2.6.6
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working