Skip to content

Commit

Permalink
Skills should now return an error response for errors inside the runn…
Browse files Browse the repository at this point in the history
…ing repl.
  • Loading branch information
kreneskyp committed Feb 15, 2024
1 parent 67b8ab6 commit 95bb71f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions ix/skills/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ def run_code_with_repl(
) -> str:
# HAX: use globals for I/O with the REPL. Hacky way to avoid serialization.
func_output = []
repl = PythonREPL(_globals={"func_input": input, "func_output": func_output})
repl = PythonREPL(
_globals={"func_input": input, "func_output": func_output, "json": json}
)

# Prepare the command to run in the REPL
command = textwrap.dedent(
Expand All @@ -118,12 +120,6 @@ def run_code_with_repl(
"""
)

print(input)
print(command)

# Run the command in the PythonREPL
repl.run(command, timeout)

print(func_output)

return func_output[0]
response = repl.run(command, timeout)
return func_output[0] if func_output else response

0 comments on commit 95bb71f

Please sign in to comment.