-
Notifications
You must be signed in to change notification settings - Fork 4
Rework caching. #48
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
base: main
Are you sure you want to change the base?
Rework caching. #48
Conversation
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.
Pull request overview
This PR refactors the caching architecture to use a type-safe CacheParameter interface pattern instead of string arrays. The changes ensure that cache parameters are used correctly and consistently across the codebase through new ArchUnit tests that enforce architectural constraints.
Key Changes
- Introduced
CacheParameterinterface with concrete implementations (ClassifierCacheParameter,EmbeddingCacheParameter) to replace string array parameters - Moved
ClassifierCacheKeyandEmbeddingCacheKeyto dedicated subpackages (classifierandembedding) - Added comprehensive ArchUnit tests to enforce that CacheKey implementations use CacheParameter correctly and that CacheParameter implementations include all fields
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheParameter.java |
New interface defining the contract for cache parameters with a parameters() method |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/classifier/ClassifierCacheParameter.java |
New record implementing CacheParameter for classifier caching, with backward compatibility for temperature |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/embedding/EmbeddingCacheParameter.java |
New record implementing CacheParameter for embedding caching |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/classifier/ClassifierCacheKey.java |
Moved to classifier subpackage and updated to use ClassifierCacheParameter in static factory method |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/embedding/EmbeddingCacheKey.java |
Moved to embedding subpackage and updated to use EmbeddingCacheParameter in static factory method |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheKey.java |
Updated imports to reflect moved cache key classes |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheManager.java |
Simplified API to accept CacheParameter instead of string arrays; removed unused getCache(Path, boolean) method |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/ChatLanguageModelProvider.java |
Changed getCacheParameters() to return ClassifierCacheParameter instead of string array |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/SimpleClassifier.java |
Updated to use new cacheParameters() method and ClassifierCacheKey.of() with CacheParameter |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/ReasoningClassifier.java |
Updated to use new cacheParameters() method and ClassifierCacheKey.of() with CacheParameter |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/preprocessor/SummarizePreprocessor.java |
Updated to use new cacheParameters() method and ClassifierCacheKey.of() with CacheParameter |
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/embeddingcreator/CachedEmbeddingCreator.java |
Updated to use EmbeddingCacheParameter throughout and in EmbeddingCacheKey.of() calls |
src/test/java/edu/kit/kastel/sdq/lissa/ratlr/ArchitectureTest.java |
Added two new ArchUnit rules to enforce CacheKey and CacheParameter implementation contracts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/test/java/edu/kit/kastel/sdq/lissa/ratlr/ArchitectureTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
…r.java Co-authored-by: Copilot <[email protected]>
|
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.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Now it shall be ensured that CacheParameters are used correctly.