fix: check both dash-form and dot-form model IDs in getDefaultMaxTokens - #464
Open
wasim-builds wants to merge 2 commits into
Open
fix: check both dash-form and dot-form model IDs in getDefaultMaxTokens#464wasim-builds wants to merge 2 commits into
wasim-builds wants to merge 2 commits into
Conversation
normalizeModelId converts Anthropic version dashes to dots (e.g., claude-3-7-sonnet -> claude-3.7-sonnet), but getDefaultMaxTokens only checked dash-form patterns. This caused normalized model IDs to silently fall back to the 4096 default instead of their intended values (64000 for Sonnet 4/3.7, 8192 for 3.5 Haiku, 64000 for Haiku 4.5). Fixes stripe#432
|
|
Author
|
By the way, I've really been enjoying contributing to this project! My goal is to get more involved in open source to help maintain projects and learn from great engineering teams. Is there a process or pathway for becoming a member of the stripe GitHub organization? I'd love to continue helping out where I can! |
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 #432
in both the V2 and V3 language models only checked for dash-form model ID patterns (e.g.,
claude-3-7-sonnet), butnormalizeModelIdconverts version dashes to dots (e.g.,claude-3.7-sonnet). This caused normalized Anthropic model IDs to silently fall back to the 4096 default instead of their intended values:anthropic/claude-3-7-sonnetanthropic/claude-3.7-sonnet(normalized)anthropic/claude-3-5-haikuanthropic/claude-3.5-haiku(normalized)anthropic/claude-haiku-4-5anthropic/claude-haiku-4.5(normalized)Changes
stripe-language-model.ts: Added dot-form pattern checks (claude-3.7-sonnet,claude-3.5-haiku,haiku-4.5) togetDefaultMaxTokensstripe-language-model-v3.ts: Same fix applied to the V3 implementationAll 333 tests pass.