Add Vertex AI prompt caching support for Claude models #961
+375
−33
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.
Description
This PR adds prompt caching support for the Vertex API integration. The main changes are:
cache_control
fields have been added to user messages and system prompts insrc/api/providers/vertex.ts
when caching is supported.src/shared/api.ts
has been updated to enable prompt caching for supported models and includes pricing details for cache writes and reads.src/api/providers/__tests__/vertex.test.ts
have been updated to simulate and verify the new caching behavior.Type of change
How Has This Been Tested?
How Has This Been Tested?
vertex.test.ts
simulate prompt caching scenarios.Checklist:
Additional context
supportsPromptCache
enabled.Related Issues
N/A
Reviewers
Important
Add prompt caching support for Claude models in Vertex AI, updating configurations and tests to handle caching behavior.
cache_control
fields to user messages and system prompts invertex.ts
.vertexModels
inapi.ts
for supported models.vertex.test.ts
to simulate and verify caching behavior.This description was created by
for 3ddd4c9. It will automatically update as commits are pushed.