Add qianfan free model "ERNIE-Speed-128K" (#1253)

<!-- 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! -->
 

## Change
<!-- Please describe the changes you made. -->
Add qianfan free model "ERNIE-Speed-128K" and complete the test call
1.add qianfan free model `ERNIE_SPEED_128K("ERNIE-Speed-128K",
"completions"),`
in class dev.langchain4j.model.qianfan.QianfanChatModelNameEnum . and
complete the test call
2.update exception description in
dev.langchain4j.model.qianfan.QianfanStreamingChatModel `(or there is no
model definition in the QianfanChatModelNameEnum class)`

## 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
- [ ] 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)

Co-authored-by: songjinming <songjinming@jd.com>
This commit is contained in:
SONG 2024-06-10 20:29:15 +08:00 committed by GitHub
parent 28565a7657
commit 6b78a77846
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -9,6 +9,7 @@ public enum QianfanChatModelNameEnum {
ERNIE_BOT_4("ERNIE-Bot 4.0", "completions_pro"),
ERNIE_BOT_8("ERNIE-Bot-8K", "ernie_bot_8k"),
ERNIE_BOT_TURBO("ERNIE-Bot-turbo", "eb-instant"),
ERNIE_SPEED_128K("ERNIE-Speed-128K", "completions"),
EB_TURBO_APPBUILDER("EB-turbo-AppBuilder", "ai_apaas"),
YI_34B_CHAT("Yi-34B-Chat", "yi_34b_chat"),
BLOOMZ_7B("BLOOMZ-7B","bloomz_7b1"),

View File

@ -65,7 +65,7 @@ public class QianfanStreamingChatModel implements StreamingChatLanguageModel {
this.endpoint=Utils.isNullOrBlank(endpoint)? QianfanChatModelNameEnum.getEndpoint(modelName):endpoint;
if (Utils.isNullOrBlank(this.endpoint)) {
throw new IllegalArgumentException("Qianfan is no such model name. You can see model name here: https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Nlks5zkzu");
throw new IllegalArgumentException("Qianfan is no such model name(or there is no model definition in the QianfanChatModelNameEnum class). You can see model name here: https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Nlks5zkzu");
}
this.baseUrl = getOrDefault(baseUrl, "https://aip.baidubce.com");