forked from langchain4j/langchain4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sanitize messages before sending to Qwen models (langchain4j#1423)
## Issue Closes langchain4j#1326 ## Change Construct the message list according to the constraints of Qwen models. (Otherwise, the model provider will return an exception.) 1. If there is a system message, it should be the first message. Otherwise, the user message is the first message. 2. User/Tool-execution-result messages and AI messages should alternate. Use the newest one when duplicated. 3. The last message in the message list should be a user/tool-execution-result message. This serves as the model query/input for the current round. ## 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
- Loading branch information
1 parent
854f76a
commit 2cdfb4a
Showing
3 changed files
with
144 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters