Skip to content

Commit

Permalink
Merge pull request #449 from kreneskyp/repl_errors
Browse files Browse the repository at this point in the history
Skills now return error responses
  • Loading branch information
kreneskyp authored Feb 15, 2024
2 parents df4d841 + 95bb71f commit c58f42b
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 c58f42b

Please sign in to comment.