## Issue
Fixes#1929
## Change
- Set `tinylog.level=info` in the `surefire` and `failsafe` plugin
system properties. Remove tinilog property from `jvm.config`
- Set explicit `maven-deploy-plugin` version in the aggregator
- Remove redundant explicit dependency versions with
[openrewrite](https://docs.openrewrite.org/recipes/maven/removeredundantdependencyversions)
### Dependency Version Updates:
* Updated the `maven-deploy-plugin` version to `3.1.3` in
`langchain4j-parent/pom.xml` and `pom.xml`.
[[1]](diffhunk://#diff-db1dfc1ccffac6c8f8ae2414e6aad535940aaf08a488d30941157dc53ec573b0L469-R470)
[[2]](diffhunk://#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R119-R121)
* Updated the `maven-surefire-plugin` version to `3.3.1` and added a
configuration for `tinylog.level` in `langchain4j-parent/pom.xml`.
* Updated the `maven-failsafe-plugin` version to `3.3.1` and added a
configuration for `tinylog.level` in `langchain4j-parent/pom.xml`.
### Plugin Configuration Changes:
* Removed the `maven-failsafe-plugin` configuration from
`langchain4j-parent/pom.xml`.
* Removed specific version tags for dependencies in multiple `pom.xml`
files, such as `langchain4j-cassandra/pom.xml`,
`langchain4j-easy-rag/pom.xml`, and others.
[[1]](diffhunk://#diff-2a7ac31c7ee7ca4842a1502363449f7e8fdcd1bbe03f904229b80bfe5b693a83L35)
[[2]](diffhunk://#diff-12719e04c48f3263f90134aa98b8f63c2dcac5ffc06b2877baaf36e29f0ab4c1L28)
etc.)
### Other Changes:
* Added `-Djava.awt.headless=true` to `.mvn/jvm.config`.
* Added a comment for dependency versions in
`langchain4j-parent/pom.xml`.
* Removed a TODO comment in `.github/workflows/main.yaml`.
These changes aim to streamline dependency management and plugin
configurations, ensuring consistency and reducing potential conflicts.
## 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 integration tests for my change
- [ ] 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
## Issue
Closes#896Fixes#1480Fixes#1881Fixes#1858Fixes#1865
## Context
Schema for tool parameters in the low-level API (`ChatLanguageModel` +
`ToolSpecification`) is currently specified using `ToolParameters` and
`JsonSchemaProperty` classes. This API works fine for simple cases, but
it does not work well for more complicated cases (e.g., when nested
objects or collections or recursion is required).
Moreover, [Structured
Outputs](https://github.com/langchain4j/langchain4j/pull/1590) feature
is using another API and a lot of logic between tools and structured
outputs is duplicated and out of sync.
## Change
`ToolParameters` and `JsonSchemaProperty` classes are now deprecated in
favour of new `JsonSchemaElement` API (which is used for Structured
Outputs as well). Most of the logic between this 2 features is now
unified.
`JsonSchemaElement` represents a schema for a JSON element. It can be of
such types:
- `JsonArraySchema`
- `JsonBooleanSchema`
- `JsonEnumSchema`
- `JsonIntegerSchema`
- `JsonNumberSchema`
- `JsonObjectSchema`
- `JsonReferenceSchema`
- `JsonStringSchema`
All model providers that support tools (see the list below) were updated
to support the new API. Old API is still supported for backward
compatibility, but will be removed in the future.
`ToolSpecifications` helper class now generates `ToolSpecification`s
using the new API only.
Example of the new API:
```java
ToolSpecification.builder()
.name("weather")
.description("Returns the current weather in the specified city")
.parameters(JsonObjectSchema.builder()
.addStringProperty("city", s -> s.description("The name of the city, e.g., Munich"))
.addEnumProperty("units", TemperatureUnit.class)
.required("city") // the required properties should be specified explicitly
.build())
.build();
```
`JsonObjectSchema` builder has some helper methods to make it easier to
add properties (e.g., `addProperty`, `addStringProperty`,
`addIntegerProperty`, etc.), but properties can also be specified using
a map:
```java
ToolSpecification.builder()
.name("weather")
.description("Returns the current weather in the specified city")
.parameters(JsonObjectSchema.builder()
.properties(Map.of(
"city", JsonStringSchema.builder().description("The name of the city, e.g., Munich").build(),
"units", JsonEnumSchema.builder().enumValues("CELSIUS", "FAHRENHEIT").build()
))
.required("city") // the required properties should be specified explicitly
.build())
.build();
```
### Providers that support new `JsonSchemaElement` for tools
- [x] Amazon Bedrock
- [X] Anthropic
- [X] Azure OpenAI
- [X] DashScope
- [x] GitHub Models
- [X] Google AI Gemini
- [X] Google Vertex AI Gemini
- [x] Jlama
- [x] LocalAI
- [X] Mistral AI
- [X] Ollama
- [X] OpenAI
- [x] Qianfan
- [x] Zhipu AI
### Tested Providers
- [x] Amazon Bedrock
- [x] Anthropic
- [x] Azure OpenAI
- [x] DashScope
- [x] GitHub Models
- [x] Google AI Gemini
- [x] Google Vertex AI Gemini
- [x] Jlama
- [ ] LocalAI
- [x] Mistral AI
- [x] Ollama
- [x] OpenAI
- [x] Qianfan
- [x] Zhipu AI
### Additional Changes
Several bugs have been fixed along the way (see the list of Github
issues on the top).
### Breaking changes
- `ToolSpecification.parameters()` method has been renamed into
`toolParameters()`
### Potentially breaking changes
- `ToolSpecifications` helper class now generates `ToolSpecification`s
with parameters defined using the new API (`JsonObjectSchema`) instead
of the old API (`ToolParameters`).
- If `@Tool` does not have a description (`value` annotation attribute),
`ToolSpecifications` will return `ToolSpecification` with `description()
== null`
## General checklist
- [ ] There are no breaking changes (Most of the use cases should not
break)
- [x] I have added unit and integration tests for my change
- [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. -->
- [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)
## Issue
Fixes#1909, Fixes#1899, Closes#1652
This pull request includes several updates to the GitHub Actions
workflows and Maven configuration files to modernize the Java version
and improve the build process. The most important changes include
upgrading the Java version, modifying the Maven build commands, and
updating dependencies.
## Change
- ⬆️ Min JDK version has been upgraded to 17
- 🗿 Hardening: run `mvn process-test-classes javadocs:aggregate` on
**ALL** modules to verify that code compiles before running integraiton
tests
- 💄 Reformat maven commands to multiline to fit on a screen
- Rename GoogleAiGeminiTokenizerTest to GoogleAiGeminiTokenizerIT
- Upgrade graalvm and Oracle image
- Run tests on every build, run integraiton tests only on
langchain4j/langchain4j repo
----
This pull request includes several updates to the GitHub workflows and
various project files to modernize the build environment and improve
testing processes. The most important changes include updating the Java
Development Kit (JDK) versions, modifying Maven commands for better
readability and functionality, and renaming test classes for
consistency.
### Updates to GitHub Workflows:
* **JDK Version Updates:**
*
[`.github/workflows/javadoc.yaml`](diffhunk://#diff-40d3687e6b489280a4b84d8a8ee6ceaee3d7ca3a8e161df603d1046daded3db3L30-R39):
Updated from JDK 8 to JDK 17 and changed the distribution to 'temurin'.
*
[`.github/workflows/main.yaml`](diffhunk://#diff-71cabc4177e41ea8f15a89eb65398fa8187739f68a2762706d84885cd8b2ddc3L31-R36):
Removed JDK 8 and 11, now only using JDK 17 and 21.
[[1]](diffhunk://#diff-71cabc4177e41ea8f15a89eb65398fa8187739f68a2762706d84885cd8b2ddc3L31-R36)
[[2]](diffhunk://#diff-71cabc4177e41ea8f15a89eb65398fa8187739f68a2762706d84885cd8b2ddc3L59-R68)
*
[`.github/workflows/nightly.yaml`](diffhunk://#diff-e79198339eb3fcc6974b6912e52526068eab3b7952ed67d03276479a235eb58eL13-L18):
Removed JDK 8 and 11, now only using JDK 17 and 21.
[[1]](diffhunk://#diff-e79198339eb3fcc6974b6912e52526068eab3b7952ed67d03276479a235eb58eL13-L18)
[[2]](diffhunk://#diff-e79198339eb3fcc6974b6912e52526068eab3b7952ed67d03276479a235eb58eL43-R46)
* **Maven Command Enhancements:**
*
[`.github/workflows/receive-pr.yml`](diffhunk://#diff-3f8fc2f08505435fdc4f66740e23234e3fee099725c4d72b02a67a0fc5db4c41L45-R47):
Reformatted Maven command for better readability.
*
[`.github/workflows/release.yaml`](diffhunk://#diff-e426ed45842837026e10e66af23d9c7077e89eacbe6958ce7cb991130ad05adaL38-R44):
Reformatted Maven command for better readability and maintainability.
*
[`.github/workflows/release_core_and_parent.yaml`](diffhunk://#diff-29983aaefd1016684ce940117feefedb37edefca433dde927389805f65cdfee6L27-R31):
Reformatted Maven command for better readability.
*
[`.github/workflows/snapshot_release.yaml`](diffhunk://#diff-cf84df4f6da634dce2ec7dc5dfc37ddc1f47181a6dd4f2e1d81df7537356dcd8L34-R38):
Reformatted Maven command for better readability.
*
[`.github/workflows/snapshot_release_core_and_parent.yaml`](diffhunk://#diff-178e48d6db6047dafaad65fe4eb44b9bdbe8a90f03397c2c653de9fa07e830dfL34-R40):
Reformatted Maven command for better readability.
### Project File Updates:
* **Dependency and Property Updates:**
*
[`code-execution-engines/langchain4j-code-execution-engine-graalvm-polyglot/pom.xml`](diffhunk://#diff-336b440bd3a43cdb2df4f9c6ee2a0cb257703526e8700f607cc67ec7ec73f0eaL19-R20):
Updated GraalVM version from 23.1.1 to 24.1.0.
*
[`langchain4j-parent/pom.xml`](diffhunk://#diff-db1dfc1ccffac6c8f8ae2414e6aad535940aaf08a488d30941157dc53ec573b0L17-R18):
Updated Maven compiler plugin version to 3.13.0 and removed Java 11+
profile.
[[1]](diffhunk://#diff-db1dfc1ccffac6c8f8ae2414e6aad535940aaf08a488d30941157dc53ec573b0L17-R18)
[[2]](diffhunk://#diff-db1dfc1ccffac6c8f8ae2414e6aad535940aaf08a488d30941157dc53ec573b0L458-R458)
[[3]](diffhunk://#diff-db1dfc1ccffac6c8f8ae2414e6aad535940aaf08a488d30941157dc53ec573b0L616-L624)
* **Test Class Renaming:**
*
[`langchain4j-google-ai-gemini/src/test/java/dev/langchain4j/model/googleai/GoogleAiGeminiTokenizerIT.java`](diffhunk://#diff-76accbd5060e23e5e16220546f59fa5074b91b36c2d42ece8109fa800c9a2f3dL14-R14):
Renamed from `GoogleAiGeminiTokenizerTest.java` to follow integration
test naming conventions.
* **Miscellaneous Fixes:**
*
[`langchain4j-oracle/src/test/java/dev/langchain4j/store/embedding/oracle/CommonTestOperations.java`](diffhunk://#diff-4a9654970655bfc6505ad1b1d334df5751c823922bdca974630c3641e29cf951L24):
Added a constant for the Oracle image name and updated container startup
and connect timeouts.
[[1]](diffhunk://#diff-4a9654970655bfc6505ad1b1d334df5751c823922bdca974630c3641e29cf951L24)
[[2]](diffhunk://#diff-4a9654970655bfc6505ad1b1d334df5751c823922bdca974630c3641e29cf951R63-R64)
[[3]](diffhunk://#diff-4a9654970655bfc6505ad1b1d334df5751c823922bdca974630c3641e29cf951L72-R75)
*
[`langchain4j-qdrant/src/test/java/dev/langchain4j/store/embedding/qdrant/QdrantFilterConverterTest.java`](diffhunk://#diff-2006ea9aece1dcbcf4d519a514526e8314ecebf5575d9197fc5385c99e2c3119L68-R68):
Corrected assertions for better readability.
[[1]](diffhunk://#diff-2006ea9aece1dcbcf4d519a514526e8314ecebf5575d9197fc5385c99e2c3119L68-R68)
[[2]](diffhunk://#diff-2006ea9aece1dcbcf4d519a514526e8314ecebf5575d9197fc5385c99e2c3119L78-R78)
[[3]](diffhunk://#diff-2006ea9aece1dcbcf4d519a514526e8314ecebf5575d9197fc5385c99e2c3119L88-R88)
[[4]](diffhunk://#diff-2006ea9aece1dcbcf4d519a514526e8314ecebf5575d9197fc5385c99e2c3119L98-R98)
----
## 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 integration tests for my change
- [ ] 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)
## Issue
- Follows https://github.com/langchain4j/langchain4j/pull/673
## Change
Apply best practices once more, as time had passed between when #673 was
opened and today. By clearing out any recipe suggestions on the main
branch we ensure any new suggestions on PRs are limited to changed
files.
## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [x] I have added unit and integration tests for my change
- [ ] 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)
## Issue
Closes#1756Closes#1750
## Change
1. `OllamaChatModel` and `OllamaStreamingChatModel` support
`ChatListener`
2. Fix `OllamaStreamingLanguageModel` throws `EOFException` when the
response content is too long.
## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [x] I have added unit and integration tests for my change
- [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)
## Change
In addition to `application/json`, Gemini also supports `text/x.enum` as
a structured output format, which is great for classification.
This PR covers both Google Vertex AI Gemini and Google AI Gemini models.
A minor internal change to create the `GeminiService` at construction
time rather than on each request.
+ Observability (ChatLanguageModel) for Google AI Gemini
## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [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)
* bug(Google AI Gemini) — fix mapping for tools with parameters with
nested object structures
* fix(JsonSchemas) — minor improvement to cover all cases of strings
## Change
- Error reporting now properly reflect when the input payload has
problems, or when the server sends an error back.
- Python code execution is more configurable, allows you to specify if
you want to activate code execution or not, and if yes if you want the
code executed and its output to appear in the response
## General checklist
- [X] There are no breaking changes
- [ ] I have added unit and integration tests for my change
- [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)