Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve truncation #1583

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

endolith
Copy link

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)
  • I have read docs/CONTRIBUTING.md [but running black and isort on the code caused many unrelated changes, so I didn't commit that.]
  • I have read docs/ROADMAP.md

OS Tests (optional but appreciated):

  • Tested on Windows
  • Tested on MacOS
  • Tested on Linux

This should give more useful context to the assistant, as the most
important info is usually in the beginning and end.
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.
Provides a little more context for the assistant to work with
@endolith
Copy link
Author

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' ?>
…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant