-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
이용홍
committed
Mar 9, 2023
1 parent
324d6ec
commit 9c438ab
Showing
4 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,71 @@ | ||
# spring-boot-starter-openai | ||
spring boot starter openai | ||
# OpenAI | ||
OpenAI | ||
|
||
Made with API version 2023-3-9. | ||
|
||
## How to | ||
To get a Git project into your build: | ||
|
||
*Step 1*. Add the JitPack repository to your build file | ||
|
||
Add it in your root build.gradle at the end of repositories: | ||
|
||
```groovy | ||
allprojects { | ||
repositories { | ||
... | ||
maven { url 'https://jitpack.io' } | ||
} | ||
} | ||
``` | ||
|
||
*Step 2*. Add the dependency | ||
|
||
```groovy | ||
dependencies { | ||
implementation 'com.github.herbaccara.openai:openai:Tag' | ||
// if you want to use spring boot auto-configuration | ||
implementation 'com.github.herbaccara.openai:spring-boot-starter-openai:Tag' | ||
} | ||
``` | ||
|
||
## Supported APIs | ||
- [Models](https://platform.openai.com/docs/api-reference/models) | ||
- [Completions](https://platform.openai.com/docs/api-reference/completions) | ||
- [Chat Completions](https://platform.openai.com/docs/api-reference/chat/create) | ||
- [Edits](https://platform.openai.com/docs/api-reference/edits) | ||
- [Embeddings](https://platform.openai.com/docs/api-reference/embeddings) | ||
- [Files](https://platform.openai.com/docs/api-reference/files) | ||
- [Fine-tunes](https://platform.openai.com/docs/api-reference/fine-tunes) | ||
- [Images](https://platform.openai.com/docs/api-reference/images) | ||
- [Moderations](https://platform.openai.com/docs/api-reference/moderations) | ||
|
||
## to use | ||
```java | ||
// java | ||
final OpenAiService openAiService = new OpenAiService(apiKey); | ||
final ListModels listModels = openAiService.listModels(); | ||
``` | ||
|
||
```kotlin | ||
// kotlin | ||
val openAiService = OpenAiService(apiKey) | ||
val listModels: ListModels = openAiService.listModels() | ||
``` | ||
|
||
## application.yml | ||
```yaml | ||
openai: | ||
enabled: true | ||
api-key: your api key | ||
root-uri: https://api.openai.com | ||
timeout: 30s | ||
validate: false | ||
logging: | ||
enable: true | ||
level: BASIC | ||
``` | ||
## License | ||
Published under the MIT License |
14 changes: 14 additions & 0 deletions
14
openai/src/test/java/herbaccara/openai/OpenAiJavaTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package herbaccara.openai; | ||
|
||
import herbaccara.openai.model.model.ListModels; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class OpenAiJavaTest { | ||
|
||
@Test | ||
public void test() { | ||
final String apiKey = "123123"; | ||
final OpenAiService openAiService = new OpenAiService(apiKey); | ||
final ListModels listModels = openAiService.listModels(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
include 'spring-boot-starter-openai' | ||
include 'openai' | ||
include 'openai' | ||
include 'spring-boot-starter-openai' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters