Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dfuchss committed Dec 17, 2024
1 parent 1fe9f00 commit 01ae882
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.core.StreamWriteConstraints;
import com.fasterxml.jackson.databind.ObjectMapper;

import edu.kit.kastel.mcse.ardoco.core.common.JsonHandling;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.ChatMessage;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.output.Response;
import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
import edu.kit.kastel.mcse.ardoco.core.common.JsonHandling;

@Deterministic
public class CachedChatLanguageModel implements ChatLanguageModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public LLMArchitectureProviderInformant(DataRepository dataRepository, LargeLang
super(LLMArchitectureProviderInformant.class.getSimpleName(), dataRepository);
String apiKey = System.getenv("OPENAI_API_KEY");
String orgId = System.getenv("OPENAI_ORG_ID");
if (apiKey == null || orgId == null) {
throw new IllegalArgumentException("OPENAI_API_KEY and OPENAI_ORG_ID must be set as environment variables");
if ((apiKey == null || orgId == null) && largeLanguageModel != null && largeLanguageModel.isOpenAi()) {
throw new IllegalArgumentException("OpenAI API Key and Organization ID must be set");
}
this.chatLanguageModel = largeLanguageModel.create();
this.chatLanguageModel = largeLanguageModel == null ? null : largeLanguageModel.create();
this.documentationPrompt = documentation;
this.codePrompt = code;
this.codeFeature = codeFeature;
this.aggregationPrompt = aggregation;
if (documentationPrompt == null && codePrompt == null) {
if (largeLanguageModel != null && documentationPrompt == null && codePrompt == null) {
throw new IllegalArgumentException("At least one prompt must be provided");
}
if (documentationPrompt != null && codePrompt != null && aggregationPrompt == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.ollama.OllamaChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
import okhttp3.Credentials;

@Deterministic
public enum LargeLanguageModel {
// OPENAI
GPT_4_O_MINI("GPT-4o mini", () -> createOpenAiModel("gpt-4o-mini-2024-07-18")), //
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* Licensed under MIT 2024. */
package edu.kit.kastel.mcse.ardoco.id.tests;

import com.tngtech.archunit.junit.AnalyzeClasses;

@AnalyzeClasses(packages = "edu.kit.kastel.mcse.ardoco")
// @AnalyzeClasses(packages = "edu.kit.kastel.mcse.ardoco")
public class ArchitectureTest extends edu.kit.kastel.mcse.ardoco.core.tests.architecture.ArchitectureTest {
// Has to be executed in this module
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* Licensed under MIT 2024. */
package edu.kit.kastel.mcse.ardoco.id.tests;

import com.tngtech.archunit.junit.AnalyzeClasses;

@AnalyzeClasses(packages = "edu.kit.kastel.mcse.ardoco")
// @AnalyzeClasses(packages = "edu.kit.kastel.mcse.ardoco")
public class DeterministicArDoCoTest extends edu.kit.kastel.mcse.ardoco.core.tests.architecture.DeterministicArDoCoTest {
// Has to be executed in this module
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* Licensed under MIT 2024. */
package edu.kit.kastel.mcse.ardoco.tlr.tests;

import com.tngtech.archunit.junit.AnalyzeClasses;

@AnalyzeClasses(packages = "edu.kit.kastel.mcse.ardoco")
// @AnalyzeClasses(packages = "edu.kit.kastel.mcse.ardoco")
public class ArchitectureTest extends edu.kit.kastel.mcse.ardoco.core.tests.architecture.ArchitectureTest {
// Has to be executed in this module
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* Licensed under MIT 2024. */
package edu.kit.kastel.mcse.ardoco.tlr.tests;

import com.tngtech.archunit.junit.AnalyzeClasses;

@AnalyzeClasses(packages = "edu.kit.kastel.mcse.ardoco")
// @AnalyzeClasses(packages = "edu.kit.kastel.mcse.ardoco")
public class DeterministicArDoCoTest extends edu.kit.kastel.mcse.ardoco.core.tests.architecture.DeterministicArDoCoTest {
// Has to be executed in this module
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
Expand All @@ -30,6 +31,7 @@
import edu.kit.kastel.mcse.ardoco.tlr.models.informants.LLMArchitecturePrompt;
import edu.kit.kastel.mcse.ardoco.tlr.models.informants.LargeLanguageModel;

@Disabled("Only for manual execution")
class TraceLinkEvaluationSadSamViaLlmCodeIT {
private static final Logger logger = LoggerFactory.getLogger(TraceLinkEvaluationSadSamViaLlmCodeIT.class);
protected static final String LOGGING_ARDOCO_CORE = "org.slf4j.simpleLogger.log.edu.kit.kastel.mcse.ardoco.core";
Expand Down

0 comments on commit 01ae882

Please sign in to comment.