{{ message }}
Repository navigation
fix: add configurable maxInputTokens to OpenAI and Anthropic adapters (#2405) - #3823
Merged
Merged
Conversation
jpr5
requested review from
ataibarkai,
mme,
ranst91 and
tylerslaton
as code owners
April 12, 2026 22:03
Contributor
|
Contributor
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
jpr5
force-pushed
the
fix/max-input-tokens-configurable-2405
branch
from
April 14, 2026 23:12
5875c58 to
a7cf382
Compare
AlemTuzlak
approved these changes
Apr 16, 2026
zeekay
pushed a commit
to Dream-AI-4444/CopilotKit
that referenced
this pull request
Sep 11, 2026
…CopilotKit#2405) (CopilotKit#3823) ## Summary Fixes CopilotKit#2405 Both OpenAI and Anthropic adapters used a hardcoded token limit for message trimming. This adds an optional `maxInputTokens` constructor parameter to both adapter classes, allowing consumers to override the default context window limit. ## Test plan - [ ] Verify default behavior unchanged when `maxInputTokens` not provided - [ ] Verify custom `maxInputTokens` is passed through to `limitMessagesToTokenCount`
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes #2405
Both OpenAI and Anthropic adapters used a hardcoded token limit for message trimming. This adds an optional
maxInputTokensconstructor parameter to both adapter classes, allowing consumers to override the default context window limit.Test plan
maxInputTokensnot providedmaxInputTokensis passed through tolimitMessagesToTokenCount