Fix non-Docker CodeInterpreterTool output #383
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The schema for CodeInterpreterTool says that the result of the code should be printed, but CodeInterpreterTool.run_in_restricted_sandbox and CodeInterpreterTool.run_code_unsafe both try to get the result from a
result
variable. This is inconsistent with howrun_code_in_docker
gets its results and seems to often cause task failures.Use contextlib.redirect_stdout to capture the output from code that is exec'ed so all execution methods get whatever the code output.