Skip to content

Commit

Permalink
This diff introduces a property-based versioning approach for the Lan…
Browse files Browse the repository at this point in the history
…gchain4j 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.
  • Loading branch information
cheroliv committed Nov 17, 2024
1 parent 8ebe393 commit b4a0eee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
24 changes: 12 additions & 12 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions api/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit b4a0eee

Please sign in to comment.