Skip to content

Commit 12087b7

Browse files
committed
edit client api
1 parent 963abd1 commit 12087b7

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ Configure the `API KEY` through the `ModelAccount` settings. If you need to us
3939
ModelAccount 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

4848
Chat
@@ -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
}

README_CN.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
ModelAccount 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";

0 commit comments

Comments
 (0)