Skip to content

Commit 7f87782

Browse files
authored
Merge branch 'langchain4j:main' into main
2 parents 5594751 + 82b882d commit 7f87782

File tree

1,655 files changed

+455503
-20125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,655 files changed

+455503
-20125
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Closes #
2020

2121
## General checklist
2222
<!-- Please double-check the following points and mark them like this: [X] -->
23-
- [ ] There are no breaking changes
23+
- [ ] There are no breaking changes (API, behaviour)
2424
- [ ] I have added unit and/or integration tests for my change
2525
- [ ] The tests cover both positive and negative cases
2626
- [ ] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green

.github/workflows/add_new_pr_to_project.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Documentation: update chatbot"
2+
3+
on:
4+
repository_dispatch:
5+
types: [ trigger-docs-update-chatbot ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
run:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-java@v4
14+
with:
15+
distribution: temurin
16+
java-version: 21
17+
- name: Build and run
18+
run: |
19+
mvn -pl internal/langchain4j-docu-chatbot-updater clean compile exec:java
20+
env:
21+
GOOGLE_AI_GEMINI_API_KEY: ${{ secrets.GOOGLE_AI_GEMINI_API_KEY }}
22+
MILVUS_API_KEY: ${{ secrets.MILVUS_API_KEY }}
23+
MILVUS_URI: ${{ secrets.MILVUS_URI }}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: "Documentation: update versions"
2+
3+
on:
4+
repository_dispatch:
5+
types: [ trigger-docs-update-version ]
6+
workflow_dispatch:
7+
inputs:
8+
stableVersion:
9+
description: "Stable release version (e.g., 1.8.0)"
10+
required: true
11+
betaVersion:
12+
description: "Beta release version (e.g., 1.8.0-beta15)"
13+
required: true
14+
15+
env:
16+
STABLE_VERSION: ${{ github.event.inputs.stableVersion || github.event.client_payload.stableVersion }}
17+
BETA_VERSION: ${{ github.event.inputs.betaVersion || github.event.client_payload.betaVersion }}
18+
19+
jobs:
20+
update-docs:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Extract current stable and beta versions from docs metadata
28+
id: extract-current-versions
29+
run: |
30+
STABLE_CURRENT=$(grep -E "^stableVersion:" docs/docs/get-started.md | sed 's/stableVersion: *//')
31+
BETA_CURRENT=$(grep -E "^betaVersion:" docs/docs/get-started.md | sed 's/betaVersion: *//')
32+
echo "stableCurrent=$STABLE_CURRENT" >> $GITHUB_OUTPUT
33+
echo "betaCurrent=$BETA_CURRENT" >> $GITHUB_OUTPUT
34+
echo "Found stable version in docs: $STABLE_CURRENT"
35+
echo "Found beta version in docs: $BETA_CURRENT"
36+
37+
- name: Create new branch
38+
id: create-branch
39+
run: |
40+
BRANCH_NAME="update-docs-versions-${{ env.STABLE_VERSION }}"
41+
git checkout -b "$BRANCH_NAME"
42+
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
43+
44+
- name: Replace versions in docs recursively
45+
run: |
46+
echo "Replacing all occurrences of stable and beta versions recursively under docs/docs/..."
47+
48+
# Replace beta versions
49+
grep -rl "${{ steps.extract-current-versions.outputs.betaCurrent }}" docs/docs | \
50+
xargs sed -i "s/${{ steps.extract-current-versions.outputs.betaCurrent }}/${{ env.BETA_VERSION }}/g" || true
51+
52+
# Replace stable versions
53+
grep -rl "${{ steps.extract-current-versions.outputs.stableCurrent }}" docs/docs | \
54+
xargs sed -i "s/${{ steps.extract-current-versions.outputs.stableCurrent }}/${{ env.STABLE_VERSION }}/g" || true
55+
56+
- name: Update metadata in get-started.md
57+
run: |
58+
sed -i "s/betaVersion: .*/betaVersion: ${{ env.BETA_VERSION }}/" docs/docs/get-started.md
59+
sed -i "s/stableVersion: .*/stableVersion: ${{ env.STABLE_VERSION }}/" docs/docs/get-started.md
60+
61+
- name: Check if any changes were made
62+
id: git-check
63+
run: |
64+
if git diff --quiet; then
65+
echo "changed=false" >> $GITHUB_OUTPUT
66+
else
67+
echo "changed=true" >> $GITHUB_OUTPUT
68+
fi
69+
70+
- name: Commit and push changes
71+
if: steps.git-check.outputs.changed == 'true'
72+
run: |
73+
git config user.name "github-actions[bot]"
74+
git config user.email "github-actions[bot]@users.noreply.github.com"
75+
git add docs/docs
76+
git commit -m "docu: update versions to ${{ env.STABLE_VERSION }} and ${{ env.BETA_VERSION }}"
77+
git push origin "${{ steps.create-branch.outputs.branch }}"
78+
79+
- name: Trigger documentation build and deploy
80+
if: steps.git-check.outputs.changed == 'true'
81+
uses: peter-evans/repository-dispatch@v4
82+
with:
83+
token: ${{ secrets.GH_RELEASE_AUTOMATION_PAT }}
84+
repository: langchain4j/langchain4j
85+
event-type: trigger-docs-build-and-deploy
86+
87+
- name: Trigger documentation chatbot update
88+
if: steps.git-check.outputs.changed == 'true'
89+
uses: peter-evans/repository-dispatch@v4
90+
with:
91+
token: ${{ secrets.GH_RELEASE_AUTOMATION_PAT }}
92+
repository: langchain4j/langchain4j
93+
event-type: trigger-docs-update-chatbot

.github/workflows/docs.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
name: Build and Publish Docs to GitHub Pages
1+
name: "Documentation: build and deploy"
22

33
on:
4-
release:
5-
types:
6-
- created
7-
# Allow running this workflow manually from the Actions tab
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
repository_dispatch:
10+
types: [ trigger-docs-build-and-deploy ]
811
workflow_dispatch:
912

1013
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
@@ -24,10 +27,10 @@ jobs:
2427
steps:
2528
- uses: actions/checkout@v4
2629

27-
- name: Set up JDK 21
30+
- name: Set up JDK 25
2831
uses: actions/setup-java@v4
2932
with:
30-
java-version: '21'
33+
java-version: '25'
3134
distribution: 'temurin'
3235
cache: 'maven'
3336

.github/workflows/javadoc.yaml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/main.yaml

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,71 +26,95 @@ on:
2626
workflow_dispatch:
2727

2828
jobs:
29-
java_build:
29+
30+
compile_and_unit_test:
3031
runs-on: ubuntu-latest
31-
needs:
32-
- spotless
33-
- compliance
34-
continue-on-error: ${{ !matrix.integration_tests }}
3532
strategy:
36-
fail-fast: false
3733
matrix:
3834
java_version:
3935
- 17
4036
- 21
41-
- 24
42-
include:
43-
- java_version: 17
44-
mvn_opts: ''
45-
integration_tests: false
46-
- java_version: 21
47-
mvn_opts: ''
48-
integration_tests: true
49-
- java_version: 24
50-
mvn_opts: ''
51-
integration_tests: false
52-
env:
53-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
37+
- 25
38+
steps:
39+
40+
- uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Set up JDK ${{ matrix.java_version }}
45+
uses: actions/setup-java@v4
46+
with:
47+
java-version: ${{ matrix.java_version }}
48+
distribution: 'temurin'
49+
cache: 'maven'
50+
51+
- name: Compile and unit test with JDK ${{ matrix.java_version }}
52+
run: |
53+
mvn -B -U -DembeddingsSkipCache -T8C test javadoc:aggregate
54+
55+
- name: Publish Test Report
56+
uses: mikepenz/action-junit-report@v5
57+
if: success() || failure() # always run even if the previous step fails
58+
with:
59+
report_paths: '**/target/*-reports/TEST-*.xml'
60+
annotate_only: true
61+
62+
integration_test:
63+
needs: compile_and_unit_test
64+
runs-on: ubuntu-latest
65+
continue-on-error: true
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
java_version:
70+
- 21
5471
steps:
72+
5573
- uses: actions/checkout@v4
5674
with:
5775
fetch-depth: 0
76+
5877
- name: Create branch from commit by event name
5978
run: |
6079
if [[ '${{ github.event_name }}' == 'push' ]]; then
6180
git branch __branch_before ${{ github.event.before }}
6281
elif [[ "${{ github.event_name }}" == 'pull_request' ]]; then
6382
git branch __branch_before ${{ github.event.pull_request.base.sha }}
6483
fi
84+
6585
- name: Set up JDK ${{ matrix.java_version }}
6686
uses: actions/setup-java@v4
6787
with:
6888
java-version: ${{ matrix.java_version }}
6989
distribution: 'temurin'
7090
cache: 'maven'
71-
- name: Compile and test with JDK ${{ matrix.java_version }}
72-
run: |
73-
mvn -B -U -T8C test javadoc:aggregate \
74-
${{ matrix.mvn_opts }}
7591

7692
- name: Setup JBang
93+
# Required for MCP module
7794
uses: jbangdev/setup-jbang@main
78-
if: ${{ matrix.integration_tests == true }}
95+
continue-on-error: true
7996

8097
- name: Integration test with JDK ${{ matrix.java_version }}
81-
## The step or job will only run if the `integration_tests` variable
82-
## in the matrix is true
83-
## and the OPENAI_API_KEY secret is available and not empty.
84-
if: ${{ matrix.integration_tests == true && env.OPENAI_API_KEY != '' }}
8598
run: |
99+
100+
## Compile and install ALL modules to ensure that modules selected by GIB in the next step
101+
## reference the latest code (e.g., langchain4j-core and langchain4j)
102+
mvn -B -U -T8C -DskipTests -DskipITs -DembeddingsSkipCache install
103+
86104
mvn -B -U verify \
87105
-Dgib.disable=false -Dgib.referenceBranch=__branch_before \
88-
-Dtinylog.writer.level=info \
89-
${{ matrix.mvn_opts }}
106+
-Djunit.jupiter.extensions.autodetection.enabled=true \
107+
-DskipAzureAiSearchITs -DskipJlamaITs -DskipLocalAiITs -DskipMilvusITs -DskipOllamaITs -DskipOracleITs -DskipVespaITs \
108+
-DembeddingsSkipCache \
109+
-Dtinylog.writer.level=info
90110
env:
111+
LC4J_GLOBAL_TEST_RETRY_ENABLED: true
91112
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
92113
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
93114
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
115+
AZURE_OPENAI_AUDIO_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_AUDIO_DEPLOYMENT_NAME }}
116+
AZURE_OPENAI_AUDIO_ENDPOINT: ${{ secrets.AZURE_OPENAI_AUDIO_ENDPOINT }}
117+
AZURE_OPENAI_AUDIO_KEY: ${{ secrets.AZURE_OPENAI_AUDIO_KEY }}
94118
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
95119
AZURE_OPENAI_KEY: ${{ secrets.AZURE_OPENAI_KEY }}
96120
AZURE_SEARCH_ENDPOINT: ${{ secrets.AZURE_SEARCH_ENDPOINT }}
@@ -120,6 +144,9 @@ jobs:
120144
WEAVIATE_API_KEY: ${{ secrets.WEAVIATE_API_KEY }}
121145
WEAVIATE_HOST: ${{ secrets.WEAVIATE_HOST }}
122146

147+
- name: Clean Docker
148+
run: docker system prune -af || true
149+
123150
- name: Publish Test Report
124151
uses: mikepenz/action-junit-report@v5
125152
if: success() || failure() # always run even if the previous step fails

0 commit comments

Comments
 (0)