open-interpreter
open-interpreter copied to clipboard
Improve truncation
Describe the changes you have made:
When truncating long outputs, remove the middle and show the head and tail to the assistant, instead of showing only the tail. This provides more useful context.
Also improve the suggestions given to the assistant for how to deal with long output, since it tends to do the wrong thing here.
Reference any relevant issues (e.g. "Fixes #000"):
I don't see any.
Pre-Submission Checklist (optional but appreciated):
- [ ] I have included relevant documentation updates (stored in /docs)
- [x] I have read
docs/CONTRIBUTING.md[but runningblackandisorton the code caused many unrelated changes, so I didn't commit that.] - [ ] I have read
docs/ROADMAP.md
OS Tests (optional but appreciated):
- [x] Tested on Windows
- [ ] Tested on MacOS
- [x] Tested on Linux
Also prints the total length now, with typical output like this:
…
print(content)
Output truncated (2,659,274 characters total). Showing 1,400 characters from start/end. To handle large outputs,
store result in python var first `result = command()` then `computer.ai.summarize(result)` for a summary, search
with `result.find('text')`, repeat shell commands with wc/grep/sed, etc. or break it down into smaller steps.
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
…