## Issue
Closes#1049
## Change
Extracted `HtmlTextExtractor` into
`langchain4j-document-transformer-jsoup` module.
Renamed `HtmlToTextDocumentTransformer` into `HtmlTextExtractor`.
Please import:
```xml
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-document-transformer-jsoup</artifactId>
<version>0.35.0</version>
</dependency>
```
## General checklist
- [ ] 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
- [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)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
## Issue
Closes#1738
## Change
- Added AnthropicContentBlockType an enum that specifies content to
follow (text, or tool_use).
- Added AnthropicToolChoice, an enum
- Introduced AnthropicToolExecutionRequestBuilder to build tool
execution requests.
- Updated
`langchain4j-anthropic/src/main/resources/META-INF/native-image/dev.langchain4j/langchain4j-anthropic/reflect-config.json`
- Update handling of streamed content for tools
- Added integration tests
## 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
- [ ] 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
Added Qwen2.5 open-source series models, which show amazing results.
See: https://qwenlm.github.io/blog/qwen2.5/
## 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
- [ ] 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#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)
## Issue
Closes#1777
## Change
`langchain4j-ollama` Add `toolCalls` fields when ChatMessage's type is
AiMessage.
The original message do not contains the `toolCalls`:
```json
{
"model": "qwen2:7b-instruct-q2_K",
"messages": [
{
"role": "user",
"content": "What is 3+4?"
},
{
"role": "assistant"
},
{
"role": "tool",
"content": "7"
}
],
"options": {},
"stream": false,
"tools": [
{
"type": "function",
"function": {
"name": "add",
"description": "",
"parameters": {
"properties": {
"arg1": {
"type": "integer"
},
"arg0": {
"type": "integer"
}
},
"required": [
"arg0",
"arg1"
]
}
}
}
]
}
```
The expect way is that the `AiMessage` should contains the toolCall
information so that the model will not continue to call the tools.
expect request:
```json
{
"model" : "qwen2:7b-instruct-q2_K",
"messages" : [ {
"role" : "user",
"content" : "What is 3+4?"
}, {
"role" : "assistant",
"tool_calls" : [ {
"function" : {
"name" : "add",
"arguments" : {
"arg1" : 4,
"arg0" : 3
}
}
} ]
}, {
"role" : "tool",
"content" : "7"
} ],
"options" : { },
"stream" : false,
"tools" : [ {
"type" : "function",
"function" : {
"name" : "add",
"description" : "",
"parameters" : {
"type" : "object",
"properties" : {
"arg1" : {
"type" : "integer"
},
"arg0" : {
"type" : "integer"
}
},
"required" : [ "arg0", "arg1" ]
}
}
} ]
}
```
## 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
- [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)
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 3.0.6 to
3.1.6.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/cure53/DOMPurify/releases">dompurify's
releases</a>.</em></p>
<blockquote>
<h2>DOMPurify 3.1.6</h2>
<ul>
<li>Fixed an issue with the execution logic of attribute hooks to
prevent bypasses, thanks <a
href="https://github.com/kevin-mizu"><code>@kevin-mizu</code></a></li>
<li>Fixed an issue with element removal leading to uncaught errors
through DOM Clobbering, thanks <a
href="https://github.com/realansgar"><code>@realansgar</code></a></li>
<li>Fixed a minor problem with the bower file pointing to the wrong dist
path</li>
<li>Fixed several minor typos in docs, comments and comment blocks,
thanks <a
href="https://github.com/Rotzbua"><code>@Rotzbua</code></a></li>
<li>Updated several development dependencies</li>
</ul>
<h2>DOMPurify 3.1.5</h2>
<ul>
<li>Fixed a minor issue with the dist paths in <code>bower.js</code>,
thanks <a
href="https://github.com/HakumenNC"><code>@HakumenNC</code></a></li>
<li>Fixed a minor issue with sanitizing HTML coming from copy&paste
Word content, thanks <a
href="https://github.com/kakao-bishop-cho"><code>@kakao-bishop-cho</code></a></li>
</ul>
<h2>DOMPurify 3.1.4</h2>
<ul>
<li>Fixed an issue with the recently implemented <code>isNaN</code>
checks, thanks <a
href="https://github.com/tulach"><code>@tulach</code></a></li>
<li>Added several new popover attributes to allow-list, thanks <a
href="https://github.com/Gigabyte5671"><code>@Gigabyte5671</code></a></li>
<li>Fixed the tests and adjusted the test runner to cover all
branches</li>
</ul>
<h2>DOMPurify 3.1.3</h2>
<ul>
<li>Fixed several mXSS variations found by and thanks to <a
href="https://github.com/kevin-mizu"><code>@kevin-mizu</code></a> &
<a href="https://github.com/Ry0taK"><code>@Ry0taK</code></a></li>
<li>Added better configurability for comment scrubbing default
behavior</li>
<li>Added better hardening against Prototype Pollution attacks, thanks
<a
href="https://github.com/kevin-mizu"><code>@kevin-mizu</code></a></li>
<li>Added better handling and readability of the <code>nodeType</code>
property, thanks <a
href="https://github.com/ssi02014"><code>@ssi02014</code></a></li>
<li>Fixed some smaller issues in README and other documentation</li>
</ul>
<h2>DOMPurify 3.1.2</h2>
<ul>
<li>Addressed and fixed a mXSS variation found by <a
href="https://github.com/kevin-mizu"><code>@kevin-mizu</code></a></li>
<li>Addressed and fixed a mXSS variation found by <a
href="https://twitter.com/hash_kitten">Adam Kues</a> of Assetnote</li>
<li>Updated tests for older Safari and Chrome versions</li>
</ul>
<h2>DOMPurify 3.1.1</h2>
<ul>
<li>Fixed an mXSS sanitiser bypass reported by <a
href="https://github.com/icesfont"><code>@icesfont</code></a></li>
<li>Added new code to track element nesting depth</li>
<li>Added new code to enforce a maximum nesting depth of 255</li>
<li>Added coverage tests and necessary clobbering protections</li>
</ul>
<p><strong>Note that this is a security release and should be upgraded
to immediately. Please also note that further releases may follow as the
underlying vulnerability is apparently new and further variations may be
discovered.</strong></p>
<h2>DOMPurify 3.1.0</h2>
<ul>
<li>Added new setting <code>SAFE_FOR_XML</code> to enable better control
over comment scrubbing</li>
<li>Updated README to warn about <em>happy-dom</em> not being safe for
use with DOMPurify yet</li>
<li>Updated the LICENSE file to show the accurate year number</li>
<li>Updated several build and test dependencies</li>
</ul>
<h2>DOMPurify 3.0.11</h2>
<ul>
<li>Fixed another conditional bypass caused by Processing Instructions,
thanks <a
href="https://github.com/Ry0taK"><code>@Ry0taK</code></a></li>
<li>Fixed the regex for HTML Custom Element detection, thanks <a
href="https://github.com/AlekseySolovey3T"><code>@AlekseySolovey3T</code></a></li>
</ul>
<h2>DOMPurify 3.0.10</h2>
<ul>
<li>Fixed two possible bypasses when sanitizing an XML document and
later using it in HTML, thanks <a
href="https://github.com/Slonser"><code>@Slonser</code></a></li>
<li>Bumped up some build and test dependencies</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="4083a9096b"><code>4083a90</code></a>
Merge pull request <a
href="https://redirect.github.com/cure53/DOMPurify/issues/978">#978</a>
from cure53/main</li>
<li><a
href="90a10a14af"><code>90a10a1</code></a>
fix: Fixed a typo on the README</li>
<li><a
href="65df0428f0"><code>65df042</code></a>
chore: Preparing 3.1.6 release</li>
<li><a
href="6e03334bab"><code>6e03334</code></a>
fix: Made sure that remove() is not called directly from node</li>
<li><a
href="00fc06cf57"><code>00fc06c</code></a>
fix: Fixed a DOM clobbering issue leading to an error being thrown</li>
<li><a
href="f8c2ef5911"><code>f8c2ef5</code></a>
Merge pull request <a
href="https://redirect.github.com/cure53/DOMPurify/issues/977">#977</a>
from cure53/dependabot/npm_and_yarn/multi-99ca4f73d8</li>
<li><a
href="e5112ec40a"><code>e5112ec</code></a>
build(deps): bump ws and socket.io-adapter</li>
<li><a
href="9978cecea2"><code>9978cec</code></a>
docs: Added better security warning about SAFE_FOR_XML to README</li>
<li><a
href="fa542df7e8"><code>fa542df</code></a>
fix: Changed the order for attribute checks slightly for safer
hooks</li>
<li><a
href="b8b552cb21"><code>b8b552c</code></a>
Merge pull request <a
href="https://redirect.github.com/cure53/DOMPurify/issues/975">#975</a>
from cure53/dependabot/npm_and_yarn/multi-2d3aef8690</li>
<li>Additional commits viewable in <a
href="https://github.com/cure53/DOMPurify/compare/3.0.6...3.1.6">compare
view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dompurify&package-manager=npm_and_yarn&previous-version=3.0.6&new-version=3.1.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/langchain4j/langchain4j/network/alerts).
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>