Skip to content

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 09 Sep 10:19
· 8 commits to main since this release

Initial release.

Added

  • pack() / ContextPacker: allocate a fixed token budget across competing
    Sections using declared priority, with ties broken deterministically by
    section name.
  • min_tokens / max_tokens guarantees per section. Infeasible minimums
    raise BudgetTooSmallError instead of silently violating one.
  • reserved_output: hold back tokens for the model's reply so it is never
    offered to a section.
  • Eviction strategies: truncate (default), drop_oldest, drop_newest,
    lowest_score_first, all_or_nothing. Custom strategies plug in via
    Strategy + register_strategy() with no change to the allocator.
  • Pinned items (Item(..., pinned=True)) that are never dropped or cut,
    and raise SectionOverflowError if they genuinely cannot fit.
  • Tokenizer adapters: dependency-free CharTokenizer (default), any plain
    str -> int callable, and an optional TiktokenTokenizer for exact
    OpenAI-family counts.
  • PackResult audit trail: used_tokens, remaining_tokens, complete,
    per-section SectionReports, and a full ItemDecision for every item
    with a human-readable reason. Serializes via to_dict() / to_json().
  • Fully typed and PEP 561 compliant: a py.typed marker ships in the
    wheel, so type checkers in consuming projects honour these annotations.
  • Value semantics on Item: hashable (usable in sets and as dict keys),
    with metadata copied on construction so packing stays a pure function
    and no caller dict can be mutated out from under you.
  • Eviction is linear in tokenizer calls, not quadratic -- token counts are
    computed once and the running total maintained incrementally. Packing 400
    messages costs 405 tokenizer calls rather than 80,603, and the gap widens
    with size.
  • Zero runtime dependencies in the core install.