Skip to content

Commit

Permalink
🔖 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
이용홍 committed Mar 9, 2023
1 parent 324d6ec commit 9c438ab
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 4 deletions.
73 changes: 71 additions & 2 deletions README.md
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 openai/src/test/java/herbaccara/openai/OpenAiJavaTest.java
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();
}
}
4 changes: 2 additions & 2 deletions settings.gradle
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'
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class OpenAiAutoConfiguration {
properties.apiKey,
properties.rootUri,
properties.timeout,
properties.validate,
properties.logging
)
}
Expand Down

0 comments on commit 9c438ab

Please sign in to comment.