Skip to content

Commit

Permalink
[Release] 发布 2024.01.3 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
qianmoQ committed May 17, 2024
2 parents 367e913 + 6e61022 commit db0061b
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 11 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
</a>&nbsp;
<a href="https://developers.generativeai.google/products/palm" target="_blank">
<img src="images/google-palm.png" alt="Google PaLM" height="80" />
</a>&nbsp;
<a href="https://ai.google.dev/gemini-api" target="_blank">
<img src="images/google-gemini.png" alt="Google Gemini" height="100" />
</a>
</div>

Expand Down
3 changes: 3 additions & 0 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
</a>&nbsp;
<a href="https://developers.generativeai.google/products/palm" target="_blank">
<img src="images/google-palm.png" alt="Google PaLM" height="80" />
</a>&nbsp;
<a href="https://ai.google.dev/gemini-api" target="_blank">
<img src="images/google-gemini.png" alt="Google Gemini" height="100" />
</a>
</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/reference/google/gemini/chat/home.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Chat
title: Chat <span style="font-weight:bold; margin-left:10px; color:red;">New</span>
---

> 支持 Google Gemini,产品地址: https://ai.google.dev/gemini-api
Expand Down
16 changes: 16 additions & 0 deletions docs/docs/release/2024.01.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: 2024.01.2
---

| Release version | Release Time |
|:---------------:|:------------:|
| `2024.01.2` | `2024-03-10` |

## OpenAi

---

- Create thread
- Retrieve thread
- Modify thread
- Delete thread
File renamed without changes.
115 changes: 107 additions & 8 deletions docs/docs/release/latest.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,115 @@
---
title: 2024.01.2
title: 2024.01.3 (latest)
---

| Release version | Release Time |
|:---------------:|:------------:|
| `2024.01.2` | `2024-03-10` |
| 发布版本 | 发布时间 |
|:-----------:|:------------:|
| `2024.01.3` | `2024-05-17` |

## OpenAi

---

- Create thread
- Retrieve thread
- Modify thread
- Delete thread
- 支持新模型 `gpt-4o`

### Google Gemini

---

- 支持简单对话

```java
try (GoogleClient client = GoogleClient.builder()
.apiKey(token)
.build()) {
PartEntity part = PartEntity.builder()
.text("Hello, Open AI Java SDK!")
.build();
ObjectEntity object = ObjectEntity.builder()
.parts(Lists.newArrayList(part))
.build();
ChatEntity chat = ChatEntity.builder()
.contents(Lists.newArrayList(object))
.build();

ChatResponse response = client.createChatCompletions(chat);
response.getCandidates()
.forEach(item -> item.getContent()
.getParts()
.forEach(value -> log.info(value.getText())));
}
```

- 支持连续对话

```java
List<ObjectEntity> contents = Lists.newArrayList();
PartEntity part = PartEntity.builder()
.text("你好,我叫小明")
.build();
ObjectEntity object = ObjectEntity.builder()
.parts(Lists.newArrayList(part))
.build();
contents.add(object);
ChatEntity chat = ChatEntity.builder()
.contents(contents)
.build();
ChatResponse response = client.createChatCompletions(chat);
response.getCandidates()
.forEach(item -> item.getContent()
.getParts()
.forEach(value -> {
log.info(value.getText());

contents.add(ObjectEntity.builder()
.role(RoleModel.MODEL)
.parts(Lists.newArrayList(PartEntity.builder()
.text(value.getText())
.build()))
.build());
}));

ObjectEntity newObject = ObjectEntity.builder()
.parts(Lists.newArrayList(PartEntity.builder()
.text("我刚刚说了什么")
.build()))
.build();
contents.add(newObject);
ChatEntity newChat = ChatEntity.builder()
.contents(contents)
.build();
client.createChatCompletions(newChat);
```

- 支持流式响应

```java
// 构建客户端
CountDownLatch countDownLatch = new CountDownLatch(1);
ConsoleEventSourceListener listener = ConsoleEventSourceListener.builder()
.countDownLatch(countDownLatch)
.build();
GoogleClient client = GoogleClient.builder()
.apiKey(ResourceUtils.getValue("google.token"))
.listener(listener)
.build();

List<ObjectEntity> contents = Lists.newArrayList();
PartEntity part = PartEntity.builder()
.text("帮我写一万字的作文")
.build();
ObjectEntity object = ObjectEntity.builder()
.parts(Lists.newArrayList(part))
.build();
contents.add(object);
ChatEntity chat = ChatEntity.builder()
.contents(contents)
.build();
client.createChatCompletions(chat);
try {
countDownLatch.await();
}
catch (InterruptedException e) {
log.error("Interrupted while waiting", e);
}
```
3 changes: 2 additions & 1 deletion docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repo_url: https://github.com/devlive-community/openai-java-sdk
edit_uri: "https://github.com/devlive-community/openai-java-sdk/blob/master/docs/docs"

banners:
- title: OpenAi Java SDK &nbsp; <em>2024.01.2</em> &nbsp; is released
- title: OpenAi Java SDK &nbsp; <em>2024.01.3</em> &nbsp; is released
link: /release-latest.html
description: <a href="https://github.com/devlive-community/openai-java-sdk" class="text-white"> Do you ❤️ DataCap? Give us a 🌟 on GitHub </a>

Expand Down Expand Up @@ -115,6 +115,7 @@ nav:
- reference/google/gemini/chat/home.md
- NavReleaseNote:
- release/latest.md
- release/2024.01.2.md
- release/2024.01.1.md
- release/2023.12.1.md
- released.md
Expand Down
Binary file added images/google-gemini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.devlive.sdk</groupId>
<artifactId>openai-java-sdk</artifactId>
<version>2024.01.3-SNAPSHOT</version>
<version>2024.01.3</version>

<name>openai-java-sdk</name>
<description>
Expand Down

0 comments on commit db0061b

Please sign in to comment.