From b4a0eee6e84c378b6340b31204f79899678dd513 Mon Sep 17 00:00:00 2001 From: cheroliv Date: Sun, 17 Nov 2024 19:54:20 +0100 Subject: [PATCH] This diff introduces a property-based versioning approach for the Langchain4j dependencies in a Gradle build. Let's break down the changes: * **`api/gradle.properties`**: A new property `langchain4j.version` is defined and set to `0.36.0`. This centralizes the version number, making updates easier. * **`api/build.gradle.kts`**: All Langchain4j dependency declarations now use the `langchain4j.version` property via `${properties["langchain4j.version"]}`. This replaces the hardcoded version numbers. This change affects multiple Langchain4j modules, including `easy-rag`, `pgvector`, various document parsers, web search engines, Hugging Face integration, Spring Boot starters, and test dependencies. The commented-out dependencies also adopt this approach. **Benefits of this Change:** * **Single Source of Truth:** Managing the Langchain4j version in one place simplifies updates and ensures consistency across all dependencies. * **Easier Upgrades:** Changing the version requires modifying only the `gradle.properties` file. * **Maintainability:** The build script is cleaner and easier to understand. This is a standard and recommended practice for dependency management in Gradle. It promotes maintainability and reduces the risk of errors associated with manual version updates across multiple locations. --- api/build.gradle.kts | 24 ++++++++++++------------ api/gradle.properties | 1 + 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 7533d38..8c5d121 100755 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -151,18 +151,18 @@ dependencies { // Langchain4j - implementation("dev.langchain4j:langchain4j-easy-rag:0.36.0") - implementation("dev.langchain4j:langchain4j-pgvector:0.36.0") - implementation("dev.langchain4j:langchain4j-document-parser-apache-pdfbox:0.36.0") - implementation("dev.langchain4j:langchain4j-web-search-engine-google-custom:0.36.0") - implementation("dev.langchain4j:langchain4j-hugging-face:0.36.0") - implementation("dev.langchain4j:langchain4j-spring-boot-starter:0.36.0") - implementation("dev.langchain4j:langchain4j-ollama-spring-boot-starter:0.36.0") - implementation("dev.langchain4j:langchain4j-vertex-ai-gemini-spring-boot-starter:0.36.0") - testImplementation("dev.langchain4j:langchain4j-spring-boot-tests:0.36.0") -// implementation("dev.langchain4j:langchain4j-vertex-ai:0.36.0") -// implementation("dev.langchain4j:langchain4j-google-ai-gemini:0.36.0") -// implementation("dev.langchain4j:langchain4j-vertex-ai-gemini:0.36.0") + implementation("dev.langchain4j:langchain4j-easy-rag:${properties["langchain4j.version"]}") + implementation("dev.langchain4j:langchain4j-pgvector:${properties["langchain4j.version"]}") + implementation("dev.langchain4j:langchain4j-document-parser-apache-pdfbox:${properties["langchain4j.version"]}") + implementation("dev.langchain4j:langchain4j-web-search-engine-google-custom:${properties["langchain4j.version"]}") + implementation("dev.langchain4j:langchain4j-hugging-face:${properties["langchain4j.version"]}") + implementation("dev.langchain4j:langchain4j-spring-boot-starter:${properties["langchain4j.version"]}") + implementation("dev.langchain4j:langchain4j-ollama-spring-boot-starter:${properties["langchain4j.version"]}") + implementation("dev.langchain4j:langchain4j-vertex-ai-gemini-spring-boot-starter:${properties["langchain4j.version"]}") + testImplementation("dev.langchain4j:langchain4j-spring-boot-tests:${properties["langchain4j.version"]}") +// implementation("dev.langchain4j:langchain4j-vertex-ai:${properties["langchain4j.version"]}") +// implementation("dev.langchain4j:langchain4j-google-ai-gemini:${properties["langchain4j.version"]}") +// implementation("dev.langchain4j:langchain4j-vertex-ai-gemini:${properties["langchain4j.version"]}") // misc diff --git a/api/gradle.properties b/api/gradle.properties index fb4b3cc..89408f4 100755 --- a/api/gradle.properties +++ b/api/gradle.properties @@ -45,6 +45,7 @@ arrow-kt_jackson.version=0.14.1 node-gradle.version=7.0.2 jbake-gradle.version=5.5.0 kotlinx-serialization-json.version=1.7.2 +langchain4j.version=0.36.0 #docker_registry= #docker_hub_login= #docker_hub_email=