Skip to content

Commit edf9f93

Browse files
committed
Improve suggestions for handling truncated output
Smaller models get confused and call the summarize command incorrectly, or try to call it on the output of shell commands, etc. Give a few suggestions of how to better deal with long output.
1 parent 32c9e41 commit edf9f93

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

interpreter/core/utils/truncate_output.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ def truncate_output(data, max_output_chars=2800, add_scrollbars=False):
99

1010
message = ("Output truncated. "
1111
f"Showing {chars_per_end} characters from start/end. "
12-
"You should try again and use computer.ai.summarize(output) "
13-
"over the output, or break it down into smaller steps.\n\n")
12+
"To handle large outputs, store result in python var first "
13+
"`result = command()` then `computer.ai.summarize(result)` for "
14+
"a summary, search with `result.find('text')`, "
15+
"repeat shell commands with wc/grep/sed, etc. or break it down "
16+
"into smaller steps.\n\n")
1417

1518
# This won't work because truncated code is stored in interpreter.messages :/
1619
# If the full code was stored, we could do this:

0 commit comments

Comments
 (0)