-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(unbound): enable prompt caching for Claude 4 models #4589
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
Conversation
- Update model ID check from 'anthropic/claude-3' to 'anthropic/claude-' to include both Claude 3 and Claude 4 models - Add comprehensive test coverage for Claude 4 models (sonnet-4, opus-4) - Ensure cache breakpoints are properly applied for performance optimization - Verify non-Claude models continue to work without caching Fixes caching support for claude-sonnet-4-20250514 and claude-opus-4-20250514 models, enabling cost savings and improved response times.
src/api/providers/unbound.ts
Outdated
| ...convertToOpenAiMessages(messages), | ||
| ] | ||
|
|
||
| if (modelId.startsWith("anthropic/claude-3")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will cause issues for haiku -- should be limited to models that support caching
| }) | ||
| }) | ||
|
|
||
| describe("cache breakpoints", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider parameterizing the cache breakpoint tests for Claude 3, Claude Sonnet 4, and Claude Opus 4 models to reduce duplication and improve maintainability.
Add support for Claude 3 and 3.5 Haiku models in caching logic based on Unbound API indicating `supportsPromptCaching: true`. Updates pattern matching to include: - anthropic/claude-3-haiku-* - anthropic/claude-3-5-haiku-*
Fixes caching support for claude-sonnet-4-20250514 and claude-opus-4-20250514 models, enabling cost savings and improved response times.
Related GitHub Issue
Closes: #
Description
Test Procedure
Type of Change
srcor test files.Pre-Submission Checklist
npm run lint).console.log) has been removed.npm test).mainbranch.npm run changesetif this PR includes user-facing changes or dependency updates.Screenshots / Videos
Documentation Updates
Additional Notes
Get in Touch
Important
Enable prompt caching for Claude 4 models and add tests for cache breakpoints in
unbound.ts.unbound.tsfrom'anthropic/claude-3'to'anthropic/claude-'to include Claude 4 models.unbound.ts.unbound.ts.claude-sonnet-4-20250514,claude-opus-4-20250514) inunbound.test.ts.unbound.test.ts.This description was created by
for d37e86f. You can customize this summary. It will automatically update as commits are pushed.