trimwise
Query-aware prompt compression for high-signal LLM prompts.
Trimwise is an extractive Python library for the step between collecting text and assembling a prompt. Give it a document, a maximum size, and optionally the task you care about. It selects useful fragments from across the document, returns them in source order, and guarantees that the measured result stays within your token, word, or character limit.
This is especially useful when an agent has several sources but cannot place every source in the context window. Instead of taking the...