Skip to content

chu2bard/ctxpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

116 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cleanup: edge case

ctxpack

Context window compression and management for LLM conversations. Strategies: sliding window, importance-based pruning, recursive summarization.

Install

pip install -e .

Usage

# fixme: performance
from ctxpack import ContextManager

ctx = ContextManager(max_tokens=4000, strategy="sliding")
ctx.add("system", "you are helpful")
ctx.add("user", "hello")
ctx.add("assistant", "hi there")

messages = ctx.get_messages()  # auto-compresses if over budget
print(ctx.status())
# note: edge case

License

MIT

About

Context window compression and management utilities

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages