-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathBaiChuanUsage.java
33 lines (29 loc) · 1.07 KB
/
BaiChuanUsage.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) Alibaba, Inc. and its affiliates.
import com.alibaba.dashscope.aigc.generation.Generation;
import com.alibaba.dashscope.aigc.generation.GenerationParam;
import com.alibaba.dashscope.aigc.generation.GenerationResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
public class BaiChuanUsage{
public static void usage()
throws NoApiKeyException, ApiException, InputRequiredException {
Generation gen = new Generation();
GenerationParam param = GenerationParam
.builder()
.model("baichuan-7b-v1")
.prompt("介绍下杭州")
.build();
GenerationResult result = gen.call(param);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args){
try {
usage();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}