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.
Feature langchain4j#1210 Support Tongyi Qianwen(QwenChatModel) functi…
…on call (langchain4j#1254) <!-- 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 will be rejected. --> <!-- Please note that PRs 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 paste the link to the issue this PR is addressing. For example: langchain4j#1012 --> ## Change <!-- Please describe the changes you made. --> ## 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) ## Checklist for adding new model integration <!-- Please double-check the following points and mark them like this: [X] --> - [ ] I have added my new module in the [BOM](https://github.com/langchain4j/langchain4j/blob/main/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 my new module in the [BOM](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-bom/pom.xml) ## 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
- Loading branch information
Showing
6 changed files
with
274 additions
and
10 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
42 changes: 42 additions & 0 deletions
42
langchain4j-dashscope/src/main/java/dev/langchain4j/model/dashscope/QwenParameters.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package dev.langchain4j.model.dashscope; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
import dev.langchain4j.agent.tool.ToolParameters; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
@JsonInclude(NON_NULL) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonNaming(SnakeCaseStrategy.class) | ||
public class QwenParameters { | ||
private String type = "object"; | ||
private Map<String, Map<String, Object>> properties; | ||
private List<String> required; | ||
|
||
private static final QwenParameters EMPTY_PARAMETERS_INSTANT = QwenParameters.builder().build(); | ||
|
||
public static QwenParameters from(ToolParameters toolParameters) { | ||
if (toolParameters == null) { | ||
return EMPTY_PARAMETERS_INSTANT; | ||
} | ||
|
||
return QwenParameters.builder() | ||
.properties(toolParameters.properties()) | ||
.required(toolParameters.required()) | ||
.build(); | ||
} | ||
} |
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