Rename modules to api and client
openai-api is unecessary here
This commit is contained in:
parent
779be1d98f
commit
f33aea18cb
11
README.md
11
README.md
@ -7,8 +7,8 @@ Includes the following artifacts:
|
|||||||
|
|
||||||
as well as an example project using the client.
|
as well as an example project using the client.
|
||||||
|
|
||||||
## How to use this
|
## Usage
|
||||||
If you're looking for the fastest solution, import the `client` and use [OpenAiService](openai-client/src/main/java/openai/OpenAiService.java).
|
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)
|
OpenAiService service = new OpenAiService(your_token)
|
||||||
CompletionRequest completionRequest = new CompletionRequest();
|
CompletionRequest completionRequest = new CompletionRequest();
|
||||||
@ -17,8 +17,8 @@ completionRequest.setEcho(true);
|
|||||||
service.createCompletion("ada", completionRequest).getChoices().forEach(System.out::println);
|
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).
|
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](openai-client/src/main/java/openai/AuthenticationInterceptor.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.
|
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.
|
If you want to make your own client, just import the POJOs from the `api` module.
|
||||||
@ -29,3 +29,6 @@ All the [example](example/src/main/java/example/OpenAiApiExample.java) project r
|
|||||||
export OPENAI_TOKEN="sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
export OPENAI_TOKEN="sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
||||||
./gradlew example:run
|
./gradlew example:run
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
Published under the MIT License
|
@ -2,7 +2,7 @@ apply plugin: 'java-library'
|
|||||||
apply plugin: 'com.jfrog.bintray'
|
apply plugin: 'com.jfrog.bintray'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(":openai-api")
|
api project(":api")
|
||||||
api 'com.squareup.retrofit2:retrofit:2.9.0'
|
api 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
|
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0'
|
@ -6,5 +6,5 @@ application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(":openai-client")
|
implementation project(":client")
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
rootProject.name = 'openai-java'
|
rootProject.name = 'openai-java'
|
||||||
|
|
||||||
|
include 'api'
|
||||||
|
include 'client'
|
||||||
include 'example'
|
include 'example'
|
||||||
include 'openai-api'
|
|
||||||
include 'openai-client'
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user