## 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)
## Change
Bump jlama rev to 0.5.0
This rev is currently being promoted in maven so should be there in next
6 hours.
## General checklist
- [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
## Issue
Closes#1660
## Change
This PR adds tool calling support for Jlama added in 0.3.1 release.
I have tested these changes with Mistral and Llama-3.1 models.
## 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. -->
- [X] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [X] 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)