Commit Graph

118 Commits

Author SHA1 Message Date
Eunbin Son 6d1af7497a
fix: Use configured similarity metric in CassandraEmbeddingStore search instead of hardcoded COSINE (#5507)
## Issue
<!-- Update with the real issue number once the issue above is filed -->
Closes #5506

## Change

`CassandraEmbeddingStore` builds its backing `MetadataVectorTable` with
the configured `CassandraSimilarityMetric` (COSINE, DOT_PRODUCT, or
EUCLIDEAN), exposed via `Builder.metric(...)` and
`BuilderAstra.metric(...)`.

But both `findRelevant(...)` overloads (reached by `search(...)`)
hardcoded `.metric(CassandraSimilarityMetric.COSINE)` on the `AnnQuery`.
A store configured with EUCLIDEAN or DOT_PRODUCT was therefore queried
with the COSINE CQL similarity function, returning wrong top-K results
on a normal call path with valid input.

This PR replaces the hardcoded COSINE with
`.metric(embeddingTable.getSimilarityMetric())` in both overloads, so
search honors the configured metric. The COSINE default path is
unchanged (backward compatible).

Scope: this PR fixes only the metric passed to the query. The
EUCLIDEAN/DOT_PRODUCT relevance-score mapping
(`RelevanceScore.fromCosineSimilarity`) is a separate design question,
left to a follow-up.

Tests: added `CassandraEmbeddingStoreTest` (Mockito `ArgumentCaptor`, no
Docker/API key). It captures the `AnnQuery` passed to `similaritySearch`
and asserts the metric matches the configured one for both overloads,
plus a COSINE-default case. Verified fail-then-pass: the EUCLIDEAN
assertions fail against the pre-fix code and pass after the fix.

Note: `CassandraEmbeddingStore.java` predates the palantir-java-format
ratchet, so `spotless:apply` reformatted the whole touched file (import
ordering, line wrapping) as CI requires. Functional change is the two
`.metric(...)` lines.

## General checklist
- [X] There are no breaking changes (API, behaviour)
- [X] I have added unit and/or integration tests for my change
- [X] The tests cover both positive and negative cases
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the core
and main modules <!-- change is isolated to langchain4j-cassandra -->
- [ ] I have added/updated the documentation <!-- bug fix; docs added
after approval per guidelines -->
- [ ] I have added an example in the examples repo <!-- not a big
feature -->
- [ ] I have added/updated Spring Boot starter(s) <!-- not applicable
-->

<!-- Checklist for adding new maven module: not applicable -->
<!-- Checklist for adding/changing embedding store integration: no
schema/persistence change; behavior fix only -->
2026-07-31 15:50:44 +02:00
github-actions[bot] a39f132b91 Update versions to 1.19.0-SNAPSHOT and 1.19.0-beta29-SNAPSHOT 2026-07-17 13:42:56 +00:00
github-actions[bot] 66ad5ee6d5 Release versions 1.18.0 and 1.18.0-beta28 2026-07-17 12:34:45 +00:00
github-actions[bot] 7d7c3349d7 Update versions to 1.18.0-SNAPSHOT and 1.18.0-beta28-SNAPSHOT 2026-06-26 14:49:40 +00:00
github-actions[bot] 207407aec9 Release versions 1.17.0 and 1.17.0-beta27 2026-06-26 13:13:06 +00:00
github-actions[bot] 01de41d641 Update versions to 1.17.0-SNAPSHOT and 1.17.0-beta27-SNAPSHOT 2026-06-06 06:46:38 +00:00
github-actions[bot] cd836845dd Release versions 1.16.0 and 1.16.0-beta26 2026-06-05 15:46:56 +00:00
Evan 541f692f84
chore: remove unused imports across multiple modules (#5338)
## Summary

Removed 18 unused import statements from 17 source files across multiple
modules.

### Modules affected
- `langchain4j-core` (6 files)
- `langchain4j` (3 files)
- `langchain4j-azure-ai-search`
- `langchain4j-cassandra`
- `langchain4j-couchbase`
- `langchain4j-agentic`
- `langchain4j-agentic-mcp`
- `langchain4j-local-ai`
- `langchain4j-workers-ai`
- `document-loaders/langchain4j-document-loader-azure-storage-blob`

### Verification

Each import was verified to be unused — the imported symbol does not
appear in any non-import line of its file (including javadoc `@link` and
`@see` tags).
2026-06-01 15:19:00 +02:00
github-actions[bot] 6185599e37 Update versions to 1.16.0-SNAPSHOT and 1.16.0-beta26-SNAPSHOT 2026-05-15 16:21:14 +00:00
github-actions[bot] d0e54aa006 Release versions 1.15.0 and 1.15.0-beta25 2026-05-15 15:55:12 +00:00
github-actions[bot] 628ac34c01 Update versions to 1.15.0-SNAPSHOT and 1.15.0-beta25-SNAPSHOT 2026-04-30 18:43:12 +00:00
github-actions[bot] 4917afa297 Release versions 1.14.0 and 1.14.0-beta24 2026-04-30 18:10:30 +00:00
github-actions[bot] 4798a89d66 Update versions to 1.14.0-SNAPSHOT and 1.14.0-beta24-SNAPSHOT 2026-04-09 14:41:27 +00:00
github-actions[bot] 759cd9a236 Release versions 1.13.0 and 1.13.0-beta23 2026-04-09 13:07:30 +00:00
Dmytro Liubarskyi e10abf04d0
Update versions to 1.13.0-SNAPSHOT and 1.13.0-beta23-SNAPSHOT (#4710)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-13 11:39:50 +01:00
Dmytro Liubarskyi c92ea033e4
Update versions to 1.13.0-SNAPSHOT and 1.13.0-beta22-SNAPSHOT (#4666)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-05 17:18:22 +01:00
Dmytro Liubarskyi 336b2accce
Update versions to 1.12.0-SNAPSHOT and 1.12.0-beta20-SNAPSHOT (#4537)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-02-04 14:27:44 +01:00
Dmytro Liubarskyi 778be1b360
Update versions to 1.11.0-SNAPSHOT and 1.11.0-beta19-SNAPSHOT (#4285)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-24 15:38:05 +01:00
Dmytro Liubarskyi 25d3b3ec87 cleaned up test dependencies 2025-12-10 10:18:30 +01:00
Dmytro Liubarskyi ca6097e35d
Update versions to 1.10.0-SNAPSHOT and 1.10.0-beta18-SNAPSHOT (#4152)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-28 12:21:30 +01:00
Dmytro Liubarskyi bc0801a4df
Update versions to 1.10.0-SNAPSHOT and 1.10.0-beta17-SNAPSHOT (#4140)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-26 17:38:36 +01:00
Dmytro Liubarskyi a473835133
Update versions to 1.9.0-SNAPSHOT and 1.9.0-beta16-SNAPSHOT (#3951)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-10-24 16:51:33 +02:00
Dmytro Liubarskyi 34632c06a2 nex dev iteration 2025-10-02 17:17:35 +02:00
Dmytro Liubarskyi 7add1a1b4e next dev iteration 2025-09-26 16:54:16 +02:00
Kushal Dixit a41f522bd7
Follow-up to #3685: migrate nullability annotations to JSpecify (#3694)
<!--
Thank you so much for your contribution!

Please fill in all the sections below.
Please open the PR as a draft initially. Once it is reviewed and
approved, we will ask you to add documentation and examples.
Please note that PRs with breaking changes or without tests will be
rejected.

Please note that PRs will be reviewed based on the priority of the
issues they address.
We ask for your patience. We are doing our best to review your PR as
quickly as possible.
Please refrain from pinging and asking when it will be reviewed. Thank
you for understanding!
-->

## Issue
<!-- Please specify the ID of the issue this PR is addressing. For
example: "Closes #1234" or "Fixes #1234" -->
Follow-up to PR #3685

## Change
<!-- Please describe the changes you made. -->
Migrate nullability annotations to JSpecify.


## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [ ] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)


## Checklist for adding new maven module
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added my new module in the root `pom.xml` and
`langchain4j-bom/pom.xml`


## Checklist for adding new embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreIT` that extends
from either `EmbeddingStoreIT` or `EmbeddingStoreWithFilteringIT`
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreRemovalIT` that
extends from `EmbeddingStoreWithRemovalIT`

## Checklist for changing existing embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j
2025-09-24 16:48:14 +02:00
Harikrishna 8fc4337e72
Refactor addAll method to validate ids list and ensure consistent lis… (#3681)
### Summary
Refactored the `addAll` method in `CassandraEmbeddingStore` to improve
validation and ensure robustness.

### Changes
- Added null check for `ids` list.
- Enforced size validation: `ids`, `embeddingList`, and
`textSegmentList` must all have the same size.
- Improved error messages for better clarity during debugging.
- Removed unused logger object

### Why
Previously, the method validated only `embeddingList` and
`textSegmentList`. If `ids` was null or mismatched in size, it could
lead to unexpected runtime errors (e.g., IndexOutOfBoundsException).
This change makes the method more predictable and safer for bulk
inserts.

### Impact
- No changes to external behavior unless invalid inputs are passed.
- Prevents silent runtime failures by failing fast with descriptive
exceptions.

---------

Co-authored-by: Harikrishna <harikrishna.gurram@walmart.com>
2025-09-17 17:36:50 +02:00
Dmytro Liubarskyi afee79638b next dev iteration 2025-09-16 15:23:21 +02:00
Kushal Dixit 7cc5691b1a
Remove Lombok annotations from remaining code and replace with standard java checks and implementations. (#3685)
<!--
Thank you so much for your contribution!

Please fill in all the sections below.
Please open the PR as a draft initially. Once it is reviewed and
approved, we will ask you to add documentation and examples.
Please note that PRs with breaking changes or without tests will be
rejected.

Please note that PRs will be reviewed based on the priority of the
issues they address.
We ask for your patience. We are doing our best to review your PR as
quickly as possible.
Please refrain from pinging and asking when it will be reviewed. Thank
you for understanding!
-->

## Issue
<!-- Please specify the ID of the issue this PR is addressing. For
example: "Closes #1234" or "Fixes #1234" -->
Fixes #1636 (Probably fully as I removed Lombok from wherever it was
remaining).

## Change
<!-- Please describe the changes you made. -->
- Removed Lombok annotations and replaced with standard Java checks for
ex. `Objects.requireNonNull` or equivalent implementation.
- Removed dependency from pom.xml as well, as there is no Lombok
annotation remaining in code.

## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [ ] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)


## Checklist for adding new maven module
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added my new module in the root `pom.xml` and
`langchain4j-bom/pom.xml`


## Checklist for adding new embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreIT` that extends
from either `EmbeddingStoreIT` or `EmbeddingStoreWithFilteringIT`
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreRemovalIT` that
extends from `EmbeddingStoreWithRemovalIT`

## Checklist for changing existing embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j
2025-09-16 09:40:54 +02:00
Dmytro Liubarskyi 7cc34306db next dev iteration 2025-08-29 08:35:38 +02:00
Dmytro Liubarskyi 5b1b2e76d2 next dev iteration 2025-08-07 16:24:25 +02:00
Dmytro Liubarskyi 0a01b49951 next dev iteration 2025-07-29 17:50:28 +02:00
Dmytro Liubarskyi 39a504a83e Updated to the next development version 2025-06-18 19:36:52 +02:00
Dmytro Liubarskyi 3fb258b009 - Updated to the next dev version
- Release to Maven central portal instead of s01
2025-05-20 15:55:12 +02:00
Eddú Meléndez Gonzales 99e44d45a7
Switch CassandraContainer implementation (#2826)
`org.testcontainers.containers.CassandraContainer` is deprecated.
2025-05-16 14:53:09 +02:00
Dmytro Liubarskyi a5313ffc0e
Added maven-flatten-plugin, cleaned up POMs (#2964)
## Change
- Added `maven-flatten-plugin` to `langchain4j-parent` and
`langchain4j-bom`
- Removed integration-specific dependencies from `langchain4j-parent`'s
`dependencyManagement` section and moved them to the modules where these
dependencies are used
- Explicitly added missing implicit dependencies
- Removed redundant `<maven.compiler.release>` for cassandra, infinispan
and opensearch modules
- Removed redundant license declarations and outdated properties


## General checklist
- [ ] There are no breaking changes
- [ ] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2025-05-08 17:55:51 +02:00
Dmytro Liubarskyi dc41ebc297 updated Jackson version to 2.19.0 2025-04-30 16:32:48 +02:00
Dmytro Liubarskyi 857c3c25a6
Rename Tokenizer into TokenCountEstimator (#2874)
## Change

Renamed:
- `Tokenizer` -> `TokenCountEstimator`
- `AzureOpenAiTokenizer` -> `AzureOpenAiTokenCountEstimator`
- `GoogleAiGeminiTokenizer` -> `GoogleAiGeminiTokenCountEstimator`
- `HuggingFaceTokenizer` -> `HuggingFaceTokenCountEstimator`
- `OpenAiTokenizer` -> `OpenAiTokenCountEstimator`
- `*.tokenizer(..)` -> `*.tokenCountEstimator(..)`

### OpenRewrite recipe:
```yml
---
type: specs.openrewrite.org/v1beta/recipe
name: dev.langchain4j.RenameTokenizer
recipeList:
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: dev.langchain4j.model.Tokenizer
      newFullyQualifiedTypeName: dev.langchain4j.model.TokenCountEstimator
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: dev.langchain4j.model.azure.AzureOpenAiTokenizer
      newFullyQualifiedTypeName: dev.langchain4j.model.azure.AzureOpenAiTokenCountEstimator
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: dev.langchain4j.model.googleai.GoogleAiGeminiTokenizer
      newFullyQualifiedTypeName: dev.langchain4j.model.googleai.GoogleAiGeminiTokenCountEstimator
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: dev.langchain4j.model.embedding.onnx.HuggingFaceTokenizer
      newFullyQualifiedTypeName: dev.langchain4j.model.embedding.onnx.HuggingFaceTokenCountEstimator
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: dev.langchain4j.model.openai.OpenAiTokenizer
      newFullyQualifiedTypeName: dev.langchain4j.model.openai.OpenAiTokenCountEstimator
  - org.openrewrite.java.ChangeMethodName:
      methodPattern: dev.langchain4j..* tokenizer(..)
      newMethodName: tokenCountEstimator
```

## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] There are no breaking changes
- [ ] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [X] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [x] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2025-04-15 16:40:06 +02:00
Dmytro Liubarskyi 3ab9218386 Updated version to 1.0.0-beta4-SNAPSHOT 2025-04-14 11:19:37 +02:00
Dmytro Liubarskyi 6ed38d4362
Release 1.0.0-beta3 (#2853) 2025-04-11 15:32:05 +02:00
Dmytro Liubarskyi f8e0dc3562
OpenAI: remove deprecated APIs (#2792)
## Change

Removed deprecated APIs in the `langchain4j-open-ai` module.

## General checklist
- [ ] There are no breaking changes
- [ ] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [x] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [x] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2025-04-01 09:49:45 +02:00
Dmytro Liubarskyi fad1e49e7d
Remove deprecated EmbeddingStore.findRelevant API (#2750)
## Change
Removed deprecated `EmbeddingStore.findRelevant()` API.
It was deprecated a while ago and wad replaced with the
`EmbeddingStore.search(EmbeddingSearchRequest)` API

## General checklist
- [ ] There are no breaking changes
- [ ] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [x] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [x] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2025-03-21 17:27:17 +01:00
Mario Fusco a6927bae6e
Delombok (#2751)
Delombok (almost) all.
2025-03-21 17:22:13 +01:00
Konstantin Pavlov f87fe40406
refactor-poms (#2723)
## Issue

Cleanup repeating dependencies in pom.xml. Better test assertions and
apidocs/javadoc generation.

## Change

Refactor project structure and remove unused test dependencies. 

- Repeating test dependencies like `tinylog`, `awaitility` and others
were removed from various modules and consolidated in the parent module.
This reduction in clutter helps to streamline the testing process.
- A separate `kotlin` profile was created to manage Kotlin-related
configurations and dependencies.

- Upgraded versions of dependencies like `ai-mocks` and `wiremock` were
implemented. Moved to wiremock-standalone (shaded jar) to avoid
potential version conflicts with runtime classes.

- The test changes in `ChatRequestExtensionsTest.kt` partially migrated
from AssertJ to Kotest assertions.

- Updated Dokka plugin configuration

## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [ ] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)


## Checklist for adding new maven module
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added my new module in the root `pom.xml` and
`langchain4j-bom/pom.xml`


## Checklist for adding new embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreIT` that extends
from either `EmbeddingStoreIT` or `EmbeddingStoreWithFilteringIT`
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreRemovalIT` that
extends from `EmbeddingStoreWithRemovalIT`

## Checklist for changing existing embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j
2025-03-21 09:07:33 +01:00
Dmytro Liubarskyi d86c4b999d
Remove deprecated APIs (#2726)
## Change
Removed:
- `ChatMessage.text()`
- `Document.metadata(String)` -> Replaced by:
`Document.metadata().get{Type}(String)`
- `TextSegment.metadata(String)` -> Replaced by:
`TextSegment.metadata().get{Type}(String)`
- `Metadata.get(String)` -> Replaced by: `Metadata.get{Type}(String)`
- `Metadata.add(String, Object)` -> Replaced by: `Metadata.put(String,
{Type})`
- `Metadata.add(String, String)` -> Replaced by: `Metadata.put(String,
{Type})`
- `Metadata.asMap()` -> Replaced by: `Metadata.toMap()`
- `Metadata.from(String, Object)` -> Replaced by: `Metadata.from(String,
String)`
- `Metadata.metadata(String, Object)` -> Replaced by:
`Metadata.metadata(String, String)`
- `RetrievalAugmentor.augment(UserMessage, Metadata)` -> Replaced by:
`RetrievalAugmentor.augment(AugmentationRequest)`
- `ContentInjector.inject(List, UserMessage)` -> Replaced by:
`ContentInjector.inject(List, ChatMessage)`
- `Retriever` -> Replaced by: `ContentRetriever`
- `EmbeddingStoreRetriever` -> Replaced by:
`EmbeddingStoreContentRetriever`
- `Utils.isCollectionEmpty(Collection)` -> Replaced by:
`Utils.isNullOrEmpty(Collection)`
- `JsonObjectSchema.Builder.properties()` -> Replaced by:
`JsonObjectSchema.Builder.addProperties()`

## General checklist
- [ ] There are no breaking changes
- [ ] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [ ] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [x] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2025-03-20 19:15:31 +01:00
Dmytro Liubarskyi a2f8e7f40a Update version to 1.0.0-beta3-SNAPSHOT 2025-03-14 10:00:39 +01:00
Dmytro Liubarskyi 2fcfa357ef
Release 1.0.0-beta2 (#2689) 2025-03-13 15:03:17 +01:00
Konstantin Pavlov ed08a0b8d9
Streamline dependencies (#2639)
## Issue

Streamline maven dependencies

Should fix [this
issue](https://github.com/langchain4j/langchain4j/actions/runs/13666001227/job/38207360909?pr=2640#step:5:16630)
```
2025/03/05 00:52:59,050 3922 [INFO  ] [main] netty.implementation.NettyUtility - {"az.sdk.message":"The following Netty versions were found on the classpath and have a mismatch with the versions used by azure-core-http-netty. If your application runs without issue this message can be ignored, otherwise please align the Netty versions used in your application. For more information, see https://aka.ms/azsdk/java/dependency/troubleshoot.","azure-netty-version":"4.1.118.Final","azure-netty-native-version":"2.0.70.Final","classpath-netty-version-io.netty:netty-common":"4.1.115.Final","classpath-netty-version-io.netty:netty-handler":"4.1.110.Final","classpath-netty-version-io.netty:netty-handler-proxy":"4.1.110.Final","classpath-netty-version-io.netty:netty-buffer":"4.1.110.Final","classpath-netty-version-io.netty:netty-codec":"4.1.110.Final","classpath-netty-version-io.netty:netty-codec-http":"4.1.110.Final","classpath-netty-version-io.netty:netty-codec-http2":"4.1.110.Final","classpath-netty-version-io.netty:netty-transport-native-unix-common":"4.1.110.Final","classpath-netty-version-io.netty:netty-transport-native-epoll":"4.1.110.Final","classpath-netty-version-io.netty:netty-transport-native-kqueue":"4.1.118.Final","classpath-native-netty-version-io.netty:netty-tcnative-boringssl-static":"2.0.70.Final"}
```

## Change

This pull request includes the following changes to improve project
dependency management:

- Removed unnecessary and redundant Netty dependencies and exclusions.
- Updated and reorganized dependency versions for consistency, including
new BOM imports for Azure SDK, Netty, and Reactor.
- Eliminated AWS SDK v1 dependencies, transitioning to
`software.amazon.awssdk` BOM for better compatibility and reduced
clutter.
- Removed redundant test dependencies like `assertj-core` and `mockito`
across modules, referring to the parent POM.
- Adjusted `kotlinx-coroutines-test` to use JVM-specific artifact and
standardized dependency version variables.
- Refined POM XML formatting for consistency and clarity (`mvn
spotless:apply`)


## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] There are no breaking changes
- [ ] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [ ] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)


## Checklist for adding new maven module
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added my new module in the root `pom.xml` and
`langchain4j-bom/pom.xml`


## Checklist for adding new embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreIT` that extends
from either `EmbeddingStoreIT` or `EmbeddingStoreWithFilteringIT`
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreRemovalIT` that
extends from `EmbeddingStoreWithRemovalIT`

## Checklist for changing existing embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j

---------

Co-authored-by: kpavlov <{ID}+{username}@users.noreply.github.com>
Co-authored-by: Dmytro Liubarskyi <ljubarskij@gmail.com>
2025-03-11 09:57:05 +01:00
Tim te Beek 86afe2698e
Apply testing best practices to the project and future pull requests (#2561)
## Issue
As discussed with @dliubarskyi on
-
https://github.com/langchain4j/langchain4j/pull/2437#discussion_r1928261580

## Change
Ran a trio of OpenRewrite recipes to improve the tests here:
1.
[TestsShouldNotBePublic](https://docs.openrewrite.org/recipes/java/testing/cleanup/testsshouldnotbepublic)
2.
[RemoveTestPrefix](https://docs.openrewrite.org/recipes/java/testing/cleanup/removetestprefix)
3.
[Assertj](https://docs.openrewrite.org/recipes/java/testing/assertj/assertj-best-practices)

This was followed by some light touch ups, and applying Spotless to any
changed files.
I've also added the recipes to those enforced on future PRs, and applied
minor fixes to that workflow.

Already ran the tests on a fork PR, to verify the integration
- https://github.com/timtebeek/langchain4j/pull/1

## General checklist
- [x] There are no breaking changes
- [x] I have added unit and/or integration tests for my change
- [x] The tests cover both positive and negative cases
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2025-02-17 11:24:24 +01:00
Dmytro Liubarskyi 0e5b1ece9c Updated version to 1.0.0-beta2-SNAPSHOT 2025-02-11 15:12:24 +01:00
Dmytro Liubarskyi bf4d9a200f
Release 1.0.0-beta1 (#2509) 2025-02-05 16:15:48 +01:00