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

feat: compress session automaticlly #333

Merged
merged 9 commits into from Mar 4, 2024
Merged

feat: compress session automaticlly #333

merged 9 commits into from Mar 4, 2024

Conversation

sigoden
Copy link
Owner

@sigoden sigoden commented Mar 3, 2024

There are three configuration items that control automatic session compression

# Compress session messages if tokens exceed this value (valid only >=1000)
compress_threshold: 2000
# The prompt for summarizing session messages
summarize_prompt: 'Summarize the discussion briefly in 200 words or less to use as a prompt for future context.'
# The prompt for the summary of the session
summary_prompt: 'This is a summary of the chat history as a recap: '

When the total number of tokens in the session messages exceeds compress_threshold, aichat will automatically compress the session.

Aichat will send a summarize_prompt with session messages to LLM to summarize the conversation, and then use the summary text prefixed with summary_prompt and the last two messages as context for the next chat.

close #329 #280

This is a very opinion feature, welcome to test and give feedback.

@sigoden sigoden merged commit 3f693ea into main Mar 4, 2024
3 checks passed
@sigoden sigoden deleted the feat-compress-session branch March 4, 2024 03:09
@sigoden sigoden mentioned this pull request Mar 6, 2024
@ahmedre
Copy link

ahmedre commented Mar 9, 2024

Just wanted to say thank you - I think this will do nicely!

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.

Feature Request: Sliding Window Context
2 participants