Rename modules to api and client

openai-api is unecessary here
This commit is contained in:
Theo Kanning 2020-10-04 21:30:20 -05:00
parent 779be1d98f
commit f33aea18cb
15 changed files with 12 additions and 10 deletions

View File

@ -7,8 +7,8 @@ Includes the following artifacts:
as well as an example project using the client.
## How to use this
If you're looking for the fastest solution, import the `client` and use [OpenAiService](openai-client/src/main/java/openai/OpenAiService.java).
## Usage
If you're looking for the fastest solution, import the `client` and use [OpenAiService](client/src/main/java/openai/OpenAiService.java).
```
OpenAiService service = new OpenAiService(your_token)
CompletionRequest completionRequest = new CompletionRequest();
@ -17,8 +17,8 @@ completionRequest.setEcho(true);
service.createCompletion("ada", completionRequest).getChoices().forEach(System.out::println);
```
If you're using retrofit, you can import the `client` module and use the [OpenAiApi](openai-client/src/main/java/openai/OpenAiApi.java).
You'll have to add your auth token as a header (see [AuthenticationInterceptor](openai-client/src/main/java/openai/AuthenticationInterceptor.java))
If you're using retrofit, you can import the `client` module and use the [OpenAiApi](client/src/main/java/openai/OpenAiApi.java).
You'll have to add your auth token as a header (see [AuthenticationInterceptor](client/src/main/java/openai/AuthenticationInterceptor.java))
and set your converter factory to use snake case and only include non-null fields.
If you want to make your own client, just import the POJOs from the `api` module.
@ -28,4 +28,7 @@ All the [example](example/src/main/java/example/OpenAiApiExample.java) project r
```
export OPENAI_TOKEN="sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
./gradlew example:run
```
```
## License
Published under the MIT License

View File

@ -2,7 +2,7 @@ apply plugin: 'java-library'
apply plugin: 'com.jfrog.bintray'
dependencies {
api project(":openai-api")
api project(":api")
api 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0'

View File

@ -6,5 +6,5 @@ application {
}
dependencies {
implementation project(":openai-client")
implementation project(":client")
}

View File

@ -1,6 +1,5 @@
rootProject.name = 'openai-java'
include 'api'
include 'client'
include 'example'
include 'openai-api'
include 'openai-client'