From b4e79a4eb2d99127ee14f23f079c9121771d7db1 Mon Sep 17 00:00:00 2001 From: Sun S D Tan Date: Thu, 20 Jun 2024 15:50:12 +0200 Subject: [PATCH] refactor: initial refactor to move non-UI code to a core module Created a new core module and moved initial set of classes that did not cause breakage. This is the first iteration of the refactor, with more commits to follow to complete the move. Signed-off-by: Sun S D Tan --- build.gradle.kts | 3 ++ core/build.gradle.kts | 38 +++++++++++++++++++ .../genie/model/gemini/model/Candidate.java | 0 .../model/gemini/model/CitationMetadata.java | 0 .../model/gemini/model/CitationSources.java | 0 .../genie/model/gemini/model/Content.java | 0 .../model/gemini/model/GenerationConfig.java | 0 .../devoxx/genie/model/gemini/model/Part.java | 0 .../model/gemini/model/SafetyRatings.java | 0 .../model/gemini/model/SystemInstruction.java | 0 .../model/gemini/model/UsageMetadata.java | 0 .../java/com/devoxx/genie/model/jan/Data.java | 0 .../com/devoxx/genie/model/jan/Metadata.java | 0 .../devoxx/genie/model/jan/Parameters.java | 0 .../devoxx/genie/model/jan/ResponseDTO.java | 0 .../com/devoxx/genie/model/jan/Settings.java | 0 .../genie/model/ollama/OllamaModelDTO.java | 0 .../model/ollama/OllamaModelEntryDTO.java | 0 settings.gradle.kts | 2 + 19 files changed, 43 insertions(+) create mode 100644 core/build.gradle.kts rename {src => core/src}/main/java/com/devoxx/genie/model/gemini/model/Candidate.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/gemini/model/CitationMetadata.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/gemini/model/CitationSources.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/gemini/model/Content.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/gemini/model/GenerationConfig.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/gemini/model/Part.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/gemini/model/SafetyRatings.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/gemini/model/SystemInstruction.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/gemini/model/UsageMetadata.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/jan/Data.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/jan/Metadata.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/jan/Parameters.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/jan/ResponseDTO.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/jan/Settings.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/ollama/OllamaModelDTO.java (100%) rename {src => core/src}/main/java/com/devoxx/genie/model/ollama/OllamaModelEntryDTO.java (100%) diff --git a/build.gradle.kts b/build.gradle.kts index 8d77d7d9..75ed3e55 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,6 +12,9 @@ repositories { } dependencies { + // Add the dependencies for the core module + implementation("com.devoxx.genie:core:0.1.16") + implementation("dev.langchain4j:langchain4j:0.31.0") implementation("dev.langchain4j:langchain4j-ollama:0.31.0") implementation("dev.langchain4j:langchain4j-local-ai:0.31.0") diff --git a/core/build.gradle.kts b/core/build.gradle.kts new file mode 100644 index 00000000..ba2b8990 --- /dev/null +++ b/core/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + java +} + +group = "com.devoxx.genie" +version = "0.1.16" + +repositories { + mavenCentral() +} + +dependencies { + implementation("dev.langchain4j:langchain4j:0.31.0") + implementation("dev.langchain4j:langchain4j-ollama:0.31.0") + implementation("dev.langchain4j:langchain4j-local-ai:0.31.0") + implementation("dev.langchain4j:langchain4j-open-ai:0.31.0") + implementation("dev.langchain4j:langchain4j-anthropic:0.31.0") + implementation("dev.langchain4j:langchain4j-mistral-ai:0.31.0") + implementation("dev.langchain4j:langchain4j-web-search-engine-google-custom:0.31.0") + implementation("dev.langchain4j:langchain4j-web-search-engine-tavily:0.31.0") + + implementation("org.commonmark:commonmark:0.22.0") + + compileOnly("org.projectlombok:lombok:1.18.32") + annotationProcessor("org.projectlombok:lombok:1.18.32") + + testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.0-M1") + testImplementation("org.mockito:mockito-core:5.11.0") + testImplementation("org.mockito:mockito-inline:5.2.0") + testImplementation("org.assertj:assertj-core:3.25.3") + + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2") +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} diff --git a/src/main/java/com/devoxx/genie/model/gemini/model/Candidate.java b/core/src/main/java/com/devoxx/genie/model/gemini/model/Candidate.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/gemini/model/Candidate.java rename to core/src/main/java/com/devoxx/genie/model/gemini/model/Candidate.java diff --git a/src/main/java/com/devoxx/genie/model/gemini/model/CitationMetadata.java b/core/src/main/java/com/devoxx/genie/model/gemini/model/CitationMetadata.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/gemini/model/CitationMetadata.java rename to core/src/main/java/com/devoxx/genie/model/gemini/model/CitationMetadata.java diff --git a/src/main/java/com/devoxx/genie/model/gemini/model/CitationSources.java b/core/src/main/java/com/devoxx/genie/model/gemini/model/CitationSources.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/gemini/model/CitationSources.java rename to core/src/main/java/com/devoxx/genie/model/gemini/model/CitationSources.java diff --git a/src/main/java/com/devoxx/genie/model/gemini/model/Content.java b/core/src/main/java/com/devoxx/genie/model/gemini/model/Content.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/gemini/model/Content.java rename to core/src/main/java/com/devoxx/genie/model/gemini/model/Content.java diff --git a/src/main/java/com/devoxx/genie/model/gemini/model/GenerationConfig.java b/core/src/main/java/com/devoxx/genie/model/gemini/model/GenerationConfig.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/gemini/model/GenerationConfig.java rename to core/src/main/java/com/devoxx/genie/model/gemini/model/GenerationConfig.java diff --git a/src/main/java/com/devoxx/genie/model/gemini/model/Part.java b/core/src/main/java/com/devoxx/genie/model/gemini/model/Part.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/gemini/model/Part.java rename to core/src/main/java/com/devoxx/genie/model/gemini/model/Part.java diff --git a/src/main/java/com/devoxx/genie/model/gemini/model/SafetyRatings.java b/core/src/main/java/com/devoxx/genie/model/gemini/model/SafetyRatings.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/gemini/model/SafetyRatings.java rename to core/src/main/java/com/devoxx/genie/model/gemini/model/SafetyRatings.java diff --git a/src/main/java/com/devoxx/genie/model/gemini/model/SystemInstruction.java b/core/src/main/java/com/devoxx/genie/model/gemini/model/SystemInstruction.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/gemini/model/SystemInstruction.java rename to core/src/main/java/com/devoxx/genie/model/gemini/model/SystemInstruction.java diff --git a/src/main/java/com/devoxx/genie/model/gemini/model/UsageMetadata.java b/core/src/main/java/com/devoxx/genie/model/gemini/model/UsageMetadata.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/gemini/model/UsageMetadata.java rename to core/src/main/java/com/devoxx/genie/model/gemini/model/UsageMetadata.java diff --git a/src/main/java/com/devoxx/genie/model/jan/Data.java b/core/src/main/java/com/devoxx/genie/model/jan/Data.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/jan/Data.java rename to core/src/main/java/com/devoxx/genie/model/jan/Data.java diff --git a/src/main/java/com/devoxx/genie/model/jan/Metadata.java b/core/src/main/java/com/devoxx/genie/model/jan/Metadata.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/jan/Metadata.java rename to core/src/main/java/com/devoxx/genie/model/jan/Metadata.java diff --git a/src/main/java/com/devoxx/genie/model/jan/Parameters.java b/core/src/main/java/com/devoxx/genie/model/jan/Parameters.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/jan/Parameters.java rename to core/src/main/java/com/devoxx/genie/model/jan/Parameters.java diff --git a/src/main/java/com/devoxx/genie/model/jan/ResponseDTO.java b/core/src/main/java/com/devoxx/genie/model/jan/ResponseDTO.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/jan/ResponseDTO.java rename to core/src/main/java/com/devoxx/genie/model/jan/ResponseDTO.java diff --git a/src/main/java/com/devoxx/genie/model/jan/Settings.java b/core/src/main/java/com/devoxx/genie/model/jan/Settings.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/jan/Settings.java rename to core/src/main/java/com/devoxx/genie/model/jan/Settings.java diff --git a/src/main/java/com/devoxx/genie/model/ollama/OllamaModelDTO.java b/core/src/main/java/com/devoxx/genie/model/ollama/OllamaModelDTO.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/ollama/OllamaModelDTO.java rename to core/src/main/java/com/devoxx/genie/model/ollama/OllamaModelDTO.java diff --git a/src/main/java/com/devoxx/genie/model/ollama/OllamaModelEntryDTO.java b/core/src/main/java/com/devoxx/genie/model/ollama/OllamaModelEntryDTO.java similarity index 100% rename from src/main/java/com/devoxx/genie/model/ollama/OllamaModelEntryDTO.java rename to core/src/main/java/com/devoxx/genie/model/ollama/OllamaModelEntryDTO.java diff --git a/settings.gradle.kts b/settings.gradle.kts index 875ff561..f202b7d3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -9,3 +9,5 @@ plugins { } rootProject.name = "DevoxxGenie" + +includeBuild("core")