File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 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
3939ModelAccount account = ModelAccount . builder(). apiKey(apiKey). baseUrl(baseUrl). build();
4040```
4141
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
4343
4444``` java
45- public GeminiClient(String modelName, ModelAccount account)
45+ public GeminiClient(ModelAccount account)
4646```
4747
4848Chat
@@ -56,6 +56,8 @@ public void chatTest() throws IOException {
5656 GenerationConfig generationConfig = GenerationConfig . builder(). temperature(0.3 ). build();
5757
5858 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);
5961 AiChatResponse chatResponse = client. chat(" who are you" , generationConfig);
6062 System . out. println(chatResponse);
6163}
Original file line number Diff line number Diff line change 3939ModelAccount account = ModelAccount . builder(). apiKey(apiKey). baseUrl(baseUrl). build();
4040```
4141
42- 默认使用 ` models/gemini-1.5-flash ` 模型,当然也可以通过构造函数,自定义配置
42+ 构建请求对象
4343
4444``` java
45- public GeminiClient(String modelName, ModelAccount account)
45+ public GeminiClient(ModelAccount account)
4646```
4747
4848普通对话
@@ -56,6 +56,8 @@ public void chatTest() throws IOException {
5656 GenerationConfig generationConfig = GenerationConfig . builder(). temperature(0.3 ). build();
5757
5858 GeminiClient client = new GeminiClient (account);
59+ // 默认使用 `models/gemini-1.5-flash` 模型,也可自定义配置
60+ // client.chat("models/gemini-1.5-pro", who are you", generationConfig);
5961 AiChatResponse chatResponse = client. chat(" who are you" , generationConfig);
6062 System . out. println(chatResponse);
6163}
@@ -99,7 +101,7 @@ public void chatMultiModalTest() throws IOException {
99101
100102 GenerationConfig generationConfig = GenerationConfig . builder(). temperature(0.3 ). build();
101103
102- GeminiClient client = new GeminiClient (GeminiModelEnum . GEMINI_PRO . getName(), account);
104+ GeminiClient client = new GeminiClient (account);
103105
104106 // image url
105107 String imageUrl = " https://pic.qqtn.com/uploadfiles/2009-6/2009614181816.jpg" ;
You can’t perform that action at this time.
0 commit comments