File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -39,10 +39,10 @@ Configure the `API KEY` through the `ModelAccount` settings. If you need to us
39
39
ModelAccount account = ModelAccount . builder(). apiKey(apiKey). baseUrl(baseUrl). build();
40
40
```
41
41
42
- By default, the ` models/gemini-1.5-flash ` model is used, but you can also customize the configuration through the constructor.
42
+ Build a request client
43
43
44
44
``` java
45
- public GeminiClient(String modelName, ModelAccount account)
45
+ public GeminiClient(ModelAccount account)
46
46
```
47
47
48
48
Chat
@@ -56,6 +56,8 @@ public void chatTest() throws IOException {
56
56
GenerationConfig generationConfig = GenerationConfig . builder(). temperature(0.3 ). build();
57
57
58
58
GeminiClient client = new GeminiClient (account);
59
+ // By default, use the models/gemini-1.5-flash model, or customize the configuration.
60
+ // client.chat("models/gemini-1.5-pro", who are you", generationConfig);
59
61
AiChatResponse chatResponse = client. chat(" who are you" , generationConfig);
60
62
System . out. println(chatResponse);
61
63
}
Original file line number Diff line number Diff line change 39
39
ModelAccount account = ModelAccount . builder(). apiKey(apiKey). baseUrl(baseUrl). build();
40
40
```
41
41
42
- 默认使用 ` models/gemini-1.5-flash ` 模型,当然也可以通过构造函数,自定义配置
42
+ 构建请求对象
43
43
44
44
``` java
45
- public GeminiClient(String modelName, ModelAccount account)
45
+ public GeminiClient(ModelAccount account)
46
46
```
47
47
48
48
普通对话
@@ -56,6 +56,8 @@ public void chatTest() throws IOException {
56
56
GenerationConfig generationConfig = GenerationConfig . builder(). temperature(0.3 ). build();
57
57
58
58
GeminiClient client = new GeminiClient (account);
59
+ // 默认使用 `models/gemini-1.5-flash` 模型,也可自定义配置
60
+ // client.chat("models/gemini-1.5-pro", who are you", generationConfig);
59
61
AiChatResponse chatResponse = client. chat(" who are you" , generationConfig);
60
62
System . out. println(chatResponse);
61
63
}
@@ -99,7 +101,7 @@ public void chatMultiModalTest() throws IOException {
99
101
100
102
GenerationConfig generationConfig = GenerationConfig . builder(). temperature(0.3 ). build();
101
103
102
- GeminiClient client = new GeminiClient (GeminiModelEnum . GEMINI_PRO . getName(), account);
104
+ GeminiClient client = new GeminiClient (account);
103
105
104
106
// image url
105
107
String imageUrl = " https://pic.qqtn.com/uploadfiles/2009-6/2009614181816.jpg" ;
You can’t perform that action at this time.
0 commit comments