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

Incorporating current summary length in token count calculation for the update_running_summary function #4670

Conversation

kinance
Copy link
Contributor

@kinance kinance commented Jun 12, 2023

Background

This PR addresses an oversight in my previous PR #4652, which introduced a new batch processing approach within the update_running_summary function. The goal of this approach is to prevent the total token count from exceeding the model's maximum limit when new events are being processed. While this method accounted for the token length of new events and the summarization prompt, it failed to consider the length of the current summary.

Changes

In the modified version, a summary_tlength variable has been introduced in the update_running_summary function. This variable holds the token length of the current summary, ensuring the total token count of three components: 1) the current summary, 2) the new events, and 3) the summarization prompt, does not surpass the maximum token limit imposed by the model.

Test Plan

Reran the tests and passed.

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes.
  • I have run the following commands against my code to ensure it passes our linters:
    black .
    isort .
    mypy
    autoflake --remove-all-unused-imports --recursive --ignore-init-module-imports --ignore-pass-after-docstring autogpt tests --in-place

@vercel
Copy link

vercel bot commented Jun 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Jun 12, 2023 3:46pm

@netlify
Copy link

netlify bot commented Jun 12, 2023

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 759ac5d
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/6487a94aaa44ac0008c1d8fa

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.03 ⚠️

Comparison is base (a9d177e) 69.96% compared to head (24a72fd) 69.94%.

❗ Current head 24a72fd differs from pull request most recent head 759ac5d. Consider uploading reports for the commit 759ac5d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4670      +/-   ##
==========================================
- Coverage   69.96%   69.94%   -0.03%     
==========================================
  Files          72       72              
  Lines        3586     3590       +4     
  Branches      569      569              
==========================================
+ Hits         2509     2511       +2     
- Misses        894      895       +1     
- Partials      183      184       +1     
Impacted Files Coverage Δ
autogpt/log_cycle/log_cycle.py 95.65% <100.00%> (+0.19%) ⬆️
autogpt/memory/message_history.py 85.71% <100.00%> (+0.29%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kinance kinance requested a review from waynehamadi June 12, 2023 15:45
@waynehamadi
Copy link
Contributor

@kinance great I understand your changes, this will remove the last token issues

@waynehamadi waynehamadi merged commit 7bf39cb into Significant-Gravitas:master Jun 12, 2023
@kinance kinance deleted the fix-should-include-current-summary-lenght branch June 12, 2023 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants