Switch to llm-access library - #95
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates LiSSA’s LLM access, caching, and related utility functionality to the external llm-access library, removing the in-repo implementations and updating call sites accordingly.
Changes:
- Add
io.github.ardoco:llm-accessand switch usages of cache/env/key/future/pair/chat utilities to the library. - Replace the in-repo embedding creator implementations with a thin adapter that delegates to
llm-access. - Remove the in-repo cache stack (local/redis/rest-redis/hierarchical + keys/params/strategies) and related tests now owned by the library.
Reviewed changes
Copilot reviewed 59 out of 59 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/edu/kit/kastel/sdq/lissa/ratlr/e2e/Requirement2RequirementE2ETest.java | Switches env handling to llm-access Environment for E2E tests. |
| src/test/java/edu/kit/kastel/sdq/lissa/ratlr/cache/RestRedisTest.java | Removes REST-Redis integration test (cache stack migrated to library). |
| src/test/java/edu/kit/kastel/sdq/lissa/ratlr/cache/HierarchicalCacheTest.java | Removes hierarchical cache unit tests (migrated to library). |
| src/test/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheTest.java | Removes local cache unit tests (migrated to library). |
| src/test/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheReplacementStrategyTest.java | Removes replacement strategy tests (migrated to library). |
| src/test/java/edu/kit/kastel/sdq/lissa/ratlr/ArchitectureTest.java | Updates architecture rules to reference llm-access utility/cache classes and drops rules for removed in-repo components. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/utils/Pair.java | Removes in-repo Pair in favor of library Pair. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/utils/KeyGenerator.java | Removes in-repo KeyGenerator in favor of library KeyGenerator. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/utils/Futures.java | Removes in-repo Futures helper in favor of library Futures. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/utils/Environment.java | Removes in-repo Environment in favor of library Environment. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/utils/ChatLanguageModelUtils.java | Removes in-repo chat utils in favor of library ChatModelUtils. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/promptoptimizer/ProTeGiOptimizer.java | Switches cached multi-request helper and Pair to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/promptoptimizer/PromptOptimizationUtils.java | Switches Pair type to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/promptoptimizer/IterativeOptimizer.java | Switches cache types and chat caching helper to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/preprocessor/SummarizePreprocessor.java | Switches cache types and Futures helper to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/Optimization.java | Switches CacheManager to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/Main.java | Switches CacheManager to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/Evaluation.java | Switches CacheManager to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/embeddingcreator/OpenWebUiEmbeddingCreator.java | Removes in-repo embedding creator (replaced by library embedding platform). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/embeddingcreator/OpenAiEmbeddingCreator.java | Removes in-repo embedding creator (replaced by library embedding platform). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/embeddingcreator/OnnxEmbeddingCreator.java | Removes in-repo embedding creator (replaced by library embedding platform). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/embeddingcreator/OllamaEmbeddingCreator.java | Removes in-repo embedding creator (replaced by library embedding platform). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/embeddingcreator/MockEmbeddingCreator.java | Removes in-repo mock embedding creator (replaced by library embedding platform). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/embeddingcreator/EmbeddingCreator.java | Replaces abstract API with an adapter delegating to llm-access EmbeddingCreator. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/embeddingcreator/CachedEmbeddingCreator.java | Removes in-repo cached embedding base (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/elementstore/TargetElementStore.java | Switches Pair type to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/elementstore/strategy/RetrievalStrategy.java | Switches Pair type to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/elementstore/strategy/CosineSimilarity.java | Switches Pair type to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/elementstore/SourceElementStore.java | Switches Pair type to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/elementstore/ElementStoreOperations.java | Switches Pair type to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/elementstore/ElementStore.java | Switches Pair type to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/configuration/Configuration.java | Switches KeyGenerator to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/SimpleClassifier.java | Switches cache types to llm-access chat cache key/manager. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/ReasoningClassifier.java | Switches cache types to llm-access chat cache key/manager. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/PipelineClassifier.java | Switches Pair type to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/LazyChatModel.java | Removes in-repo lazy model wrapper (handled by library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/Classifier.java | Switches Pair type to llm-access. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/ChatLanguageModelProvider.java | Delegates chat model creation + cache identity to llm-access provider/configuration. |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/ChatLanguageModelPlatform.java | Removes in-repo platform enum (replaced by library ChatModelPlatform). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/UnifiedRedisClient.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/RestRedisCache.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/RestRedisAdapter.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/RedisCache.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/RedisAdapter.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/LocalCache.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/LargeLanguageModelCacheMode.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/HierarchicalCache.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/embedding/EmbeddingCacheParameter.java | Removes in-repo embedding cache keying (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/embedding/EmbeddingCacheKey.java | Removes in-repo embedding cache keying (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/classifier/ClassifierCacheParameter.java | Removes in-repo chat cache keying (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/classifier/ClassifierCacheKey.java | Removes in-repo chat cache keying (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheType.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheReplacementStrategy.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheParameter.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheManager.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheKey.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/Cache.java | Removes in-repo cache stack (migrated to library). |
| src/main/java/edu/kit/kastel/sdq/lissa/cli/command/TransitiveTraceCommand.java | Switches KeyGenerator usage to llm-access. |
| pom.xml | Adds llm-access dependency and drops now-transitive dependencies previously used by in-repo implementations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
624462b to
774d0f3
Compare
774d0f3 to
39ab713
Compare
| * those classes. | ||
| */ | ||
| @AnalyzeClasses(packages = "edu.kit.kastel.sdq.lissa") | ||
| class ArchitectureTest { |
There was a problem hiding this comment.
Arch tests should probably be readded to the llm-access lib
e3d7afa to
add6c69
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 58 out of 58 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/ChatLanguageModelProvider.java:90
threads()assignsDEEPSEEKthe same high concurrency (100) asOPENAI/BLABLADOR. This can easily overwhelm the DeepSeek endpoint (rate limits) and also spawns a large thread pool locally whenReasoningClassifier/SimpleClassifier/SummarizePreprocessoruse this value. If DeepSeek should be treated more conservatively (similar toOLLAMA), consider giving it its own (smaller) thread count or making this configurable.
public static int threads(ModuleConfiguration configuration) {
return switch (platform(configuration)) {
case OPENAI, BLABLADOR, DEEPSEEK -> 100;
case OPENWEBUI -> 10;
case OLLAMA -> 1;
};
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 58 out of 58 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/main/java/edu/kit/kastel/sdq/lissa/ratlr/classifier/ChatLanguageModelProvider.java:101
toLlmConfigurationnow requires amodelargument (argumentAsString("model")). This is a behavioral change from the previous implementation (which had per-platform defaults) and breaks existing configs in this repo that rely on defaults (e.g.,example-configs/transitive/{m2c,d2m}.jsonhave emptyargs). To keep backward compatibility, provide a default model per platform when the argument is missing.
private static LlmConfiguration toLlmConfiguration(ModuleConfiguration configuration) {
ChatModelPlatform platform = platform(configuration);
String model = configuration.argumentAsString("model");
int seed = configuration.argumentAsInt("seed", LlmConfiguration.DEFAULT_SEED);
double temperature = configuration.argumentAsDouble("temperature", LlmConfiguration.DEFAULT_TEMPERATURE);
return LlmConfiguration.builder(platform)
.modelName(model)
.seed(seed)
.temperature(temperature)
.build();
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 61 out of 61 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/test/java/edu/kit/kastel/sdq/lissa/ratlr/LlmAccessArchitectureTest.java:236
lazyChatModelMustOverrideAllChatModelMethodsassumesLazyChatModeldirectly implementsChatModelby scanning onlyclazz.getRawInterfaces(). IfLazyChatModelimplementsChatModelindirectly (e.g., via another interface), this will throw and fail the architecture test even though the rule intent is still satisfiable. UsegetAllInterfaces()(or equivalent) and provide an explicit exception message to avoid brittle failures.



See ardoco/llm-access#1