Skip to content

Refactor: Remove fallbacks from Anthropic context window detection #346

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

Merged
merged 5 commits into from
Mar 22, 2025

Conversation

bhouston
Copy link
Member

This PR removes the fallback mechanism from the Anthropic model context window detection as requested by the user.

Changes

  • Removed hardcoded fallback constants for model context window sizes
  • Updated the initializeModelContextWindow method to throw errors instead of returning undefined
  • Updated the tokenUsageFromMessage function to throw an error if the context window size is not available
  • Changed the error handling in the constructor to better inform about initialization failures

This PR is an enhancement to PR #343 which implements the basic dynamic context window detection. This PR specifically removes the fallback mechanism as requested in the user feedback.

Relates to #342

semantic-release-bot and others added 5 commits March 21, 2025 20:18
# [mycoder-agent-v1.7.0](mycoder-agent-v1.6.0...mycoder-agent-v1.7.0) (2025-03-21)

### Bug Fixes

* Fix TypeScript errors and tests for message compaction feature ([d4f1fb5](d4f1fb5))

### Features

* Add automatic compaction of historical messages for agents ([a5caf46](a5caf46)), closes [#338](#338)
* Improve message compaction with proactive suggestions ([6276bc0](6276bc0))
@bhouston bhouston merged commit f0437be into main Mar 22, 2025
1 check passed
Copy link

sentry-io bot commented Mar 22, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ Error: No context window information found for model: claude-3-7-sonnet-20250219 AnthropicProvider.getModelContextWindow(anthrop... View Issue

Did you find this useful? React with a 👍 or 👎

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.

2 participants