Skip to content

Commit 0d60f47

Browse files
authored
Released for 1.6.0 (#21)
2 parents 960d4a2 + 8b1b6f8 commit 0d60f47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+808
-93
lines changed

.github/workflows/checker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
distribution: 'temurin'
7272
- run: chmod 755 ./mvnw
7373
- run: |
74-
./mvnw clean install test -Dfindbugs.skip -Dcheckstyle.skip -Dgpg.skip -Dskip.yarn -Dopenai.token=${{ secrets.OPENAI_TOKEN }} -Dproxy.token=${{ secrets.PROXY_TOKEN }} -Dproxy.host=${{ secrets.PROXY_HOST }} -Dazure.token=${{ secrets.AZURE_TOKEN}}
74+
./mvnw clean install test -Dfindbugs.skip -Dcheckstyle.skip -Dgpg.skip -Dskip.yarn -Dopenai.token=${{ secrets.OPENAI_TOKEN }} -Dproxy.token=${{ secrets.PROXY_TOKEN }} -Dproxy.host=${{ secrets.PROXY_HOST }} -Dazure.token=${{ secrets.AZURE_TOKEN}} -Dclaude.token=${{ secrets.CLAUDE_TOKEN }}
7575
7676
before_checker_package:
7777
runs-on: ubuntu-latest
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Completions
3+
---
4+
5+
!!! note
6+
7+
Support the claude, product address: [https://claude.ai/](https://claude.ai/)
8+
9+
### Create completion
10+
11+
---
12+
13+
Creates a completion for the provided prompt and parameters.
14+
15+
```java
16+
// Automatic resource release
17+
try(OpenAiClient client=OpenAiClient.builder()
18+
.apiKey(System.getProperty("claude.token"))
19+
.provider(ProviderModel.CLAUDE)
20+
.build())
21+
{
22+
CompletionEntity configure = CompletionEntity.builder()
23+
.model(CompletionModel.CLAUDE_2.getName())
24+
.prompt("How to create a completion")
25+
.build();
26+
client.createCompletion(configure).getChoices();
27+
}
28+
```
29+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Completions
3+
---
4+
5+
!!! note
6+
7+
支持 claude,产品地址: [https://claude.ai/](https://claude.ai/)
8+
9+
### Create completion
10+
11+
---
12+
13+
为提供的提示和参数创建补全。
14+
15+
```java
16+
// Automatic resource release
17+
try(OpenAiClient client=OpenAiClient.builder()
18+
.apiKey(System.getProperty("claude.token"))
19+
.provider(ProviderModel.CLAUDE)
20+
.build())
21+
{
22+
CompletionEntity configure = CompletionEntity.builder()
23+
.model(CompletionModel.CLAUDE_2.getName())
24+
.prompt("How to create a completion")
25+
.build();
26+
client.createCompletion(configure).getChoices();
27+
}
28+
```
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Azure OpenAI
2+
title: Completions
33
---
44

55
!!! note
@@ -22,10 +22,12 @@ title: Azure OpenAI
2222
| `model` | Model name deployed in Azure |
2323
| `version` | Model version deployed in Azure |
2424

25-
### Example
25+
### Create completion
2626

2727
---
2828

29+
Creates a completion for the provided prompt and parameters.
30+
2931
```java
3032
// Automatic resource release
3133
try(OpenAiClient client=OpenAiClient.builder()
@@ -36,6 +38,11 @@ try(OpenAiClient client=OpenAiClient.builder()
3638
.version("2022-12-01")
3739
.build())
3840
{
41+
CompletionEntity configure = CompletionEntity.builder()
42+
.model(CompletionModel.TEXT_DAVINCI_003.getName())
43+
.prompt("How to create a completion")
44+
.temperature(2D)
45+
.build();
3946
client.createCompletion(configure).getChoices();
4047
}
4148
```
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Completions
3+
---
4+
5+
!!! note
6+
7+
支持微软提供的 Open Ai服务,产品地址: [https://azure.microsoft.com/zh-cn/products/cognitive-services/openai-service/](https://azure.microsoft.com/zh-cn/products/cognitive-services/openai-service/)
8+
9+
### Required
10+
11+
---
12+
13+
!!! note
14+
15+
以下是调用服务必须指定的一些配置.
16+
17+
| name | description |
18+
|:----------:|-----------------------------------------------------|
19+
| `apiHost` |`${your-resource-name}.openai.azure.com` 格式创建区域标记 |
20+
| `apiKey` | Azure 令牌 |
21+
| `provider` | 指定 `ProviderModel.azure` |
22+
| `model` | Azure 中部署的模型名称 |
23+
| `version` | Azure 中部署的模型版本 |
24+
25+
### Create completion
26+
27+
---
28+
29+
为提供的提示和参数创建补全。
30+
31+
```java
32+
// 自动资源释放
33+
try(OpenAiClient client=OpenAiClient.builder()
34+
.apiHost("https://eus-chatgpt.openai.azure.com")
35+
.apiKey(System.getProperty("azure.token"))
36+
.provider(ProviderModel.azure)
37+
.model("text-davinci-002")
38+
.version("2022-12-01")
39+
.build())
40+
{
41+
CompletionEntity configure = CompletionEntity.builder()
42+
.model(CompletionModel.TEXT_DAVINCI_003.getName())
43+
.prompt("How to create a completion")
44+
.temperature(2D)
45+
.build();
46+
client.createCompletion(configure).getChoices();
47+
}
48+
```
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Chat Completions
3+
---
4+
5+
!!! note
6+
7+
Support the Open Ai service provided by Microsoft, product address: [https://azure.microsoft.com/zh-cn/products/cognitive-services/openai-service/](https://azure.microsoft.com/zh-cn/products/cognitive-services/openai-service/)
8+
9+
### Required
10+
11+
---
12+
13+
!!! note
14+
15+
The following are some configurations that must be specified to invoke the service.
16+
17+
| name | description |
18+
|:----------:|-----------------------------------------------------------------------------|
19+
| `apiHost` | Created zone markers in the format `${your-resource-name}.openai.azure.com` |
20+
| `apiKey` | Azure token |
21+
| `provider` | Specify `ProviderModel.azure` |
22+
| `model` | Model name deployed in Azure |
23+
| `version` | Model version deployed in Azure |
24+
25+
### Create chat completion
26+
27+
---
28+
29+
Creates a model response for the given chat conversation.
30+
31+
```java
32+
// Automatic resource release
33+
try(OpenAiClient client=OpenAiClient.builder()
34+
.apiHost("https://eus-chatgpt.openai.azure.com")
35+
.apiKey(System.getProperty("azure.token"))
36+
.provider(ProviderModel.azure)
37+
.model("text-davinci-002")
38+
.version("2022-12-01")
39+
.build())
40+
{
41+
List<CompletionMessageEntity> messages = Lists.newArrayList();
42+
messages.add(CompletionMessageEntity.builder()
43+
.content("Hello, my name is openai-java-sdk")
44+
.build());
45+
46+
CompletionChatEntity configure = CompletionChatEntity.builder()
47+
.messages(messages)
48+
.build();
49+
50+
client.createChatCompletion(configure)
51+
.getChoices()
52+
.forEach(choice -> messages.add(choice.getMessage()));
53+
54+
messages.add(CompletionMessageEntity.builder()
55+
.content("What is my name?")
56+
.build());
57+
client.createChatCompletion(configure).getChoices();
58+
}
59+
```
60+
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Chat Completions
3+
---
4+
5+
!!! note
6+
7+
支持微软提供的 Open Ai服务,产品地址: [https://azure.microsoft.com/zh-cn/products/cognitive-services/openai-service/](https://azure.microsoft.com/zh-cn/products/cognitive-services/openai-service/)
8+
9+
### Required
10+
11+
---
12+
13+
!!! note
14+
15+
以下是调用服务必须指定的一些配置.
16+
17+
| name | description |
18+
|:----------:|-----------------------------------------------------|
19+
| `apiHost` |`${your-resource-name}.openai.azure.com` 格式创建区域标记 |
20+
| `apiKey` | Azure 令牌 |
21+
| `provider` | 指定 `ProviderModel.azure` |
22+
| `model` | Azure 中部署的模型名称 |
23+
| `version` | Azure 中部署的模型版本 |
24+
25+
### Create chat completion
26+
27+
---
28+
29+
为给定的聊天对话创建模型响应。
30+
31+
```java
32+
// Automatic resource release
33+
try(OpenAiClient client=OpenAiClient.builder()
34+
.apiHost("https://eus-chatgpt.openai.azure.com")
35+
.apiKey(System.getProperty("azure.token"))
36+
.provider(ProviderModel.azure)
37+
.model("text-davinci-002")
38+
.version("2022-12-01")
39+
.build())
40+
{
41+
List<CompletionMessageEntity> messages = Lists.newArrayList();
42+
messages.add(CompletionMessageEntity.builder()
43+
.content("Hello, my name is openai-java-sdk")
44+
.build());
45+
46+
CompletionChatEntity configure = CompletionChatEntity.builder()
47+
.messages(messages)
48+
.build();
49+
50+
client.createChatCompletion(configure)
51+
.getChoices()
52+
.forEach(choice -> messages.add(choice.getMessage()));
53+
54+
messages.add(CompletionMessageEntity.builder()
55+
.content("What is my name?")
56+
.build());
57+
client.createChatCompletion(configure).getChoices();
58+
}
59+
```
60+
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)