implement context caching#135
Merged
Plytas merged 15 commits intoSep 12, 2025
Merged
Conversation
Apply code review fixes
…412023 Add claude GitHub actions 1752708412023
- Add name parameter validation (empty string and invalid characters) - Add TTL format validation for duration format (e.g., "60s", "120.5s") - Follow same validation pattern as DeleteRequest for consistency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add @PHPStan-Ignore nullCoalesce.offset for promptTokenCount field. The Gemini API documentation specifies that promptTokenCount is required, but in practice the API sometimes returns responses without this field (particularly for cached content operations). This causes runtime errors when the field is missing. The ?? 0 fallback handles the real-world API behavior, while the PHPStan ignore comment suppresses the static analysis warning that claims the offset always exists (which contradicts actual API responses). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Replace @PHPStan-Ignore with proper type definition that reflects real API behavior. Changed promptTokenCount from required (int) to optional (?int) in the DocBlock. Cache creation operations may not involve LLM interactions, resulting in incomplete usage metadata where promptTokenCount and other fields can be missing from the API response. This fix resolves PHPStan warnings across all PHP versions (8.1-8.4) while maintaining the existing runtime fallback behavior. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
everything has been tested with this script: https://gist.github.com/michabbb/577b4cb65273bed7e0e6ddde10268f6a |
Closed
Collaborator
|
Thanks for this @michabbb! |
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
Testing
composer lintvendor/bin/phpstan analyse --ansivendor/bin/pest --colors=alwaysSummary by CodeRabbit