Skip to content

Commit

Permalink
Add GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Dec 25, 2023
1 parent f9f3e2f commit 0cd448a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: build

on:
push:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build
run: ./gradlew spotlessCheck build
env:
OPENAI_API_KEY: {{ secrets.OPENAI_API_KEY }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ ChatResponse response = chatClient.sendRequest(request);
| [Models](https://platform.openai.com/docs/api-reference/models) | ✔️ |
| [Moderations](https://platform.openai.com/docs/api-reference/moderations) | |

There are no plans to support the Beta APIs
There are no plans to support the Beta APIs.


12 changes: 11 additions & 1 deletion src/main/java/com/stefanbratanov/chatjpt/ChatJPT.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public ModelsClient newModelsClient() {
return new ModelsClient(baseUrl, apiKey, organization, httpClient, objectMapper);
}

/**
* @param apiKey the API key used for authentication
*/
public static Builder newBuilder(String apiKey) {
return new Builder(apiKey);
}
Expand All @@ -47,15 +50,22 @@ public static class Builder {
private final String apiKey;
private Optional<String> organization = Optional.empty();

public Builder(String apiKey) {
Builder(String apiKey) {
this.apiKey = apiKey;
}

/**
* @param baseUrl the url which exposes the OpenAI API
*/
public Builder baseUrl(String baseUrl) {
this.baseUrl = baseUrl;
return this;
}

/**
* @param organization for users who belong to multiple organizations specify which organization
* will be used for the API requests
*/
public Builder organization(String organization) {
this.organization = Optional.of(organization);
return this;
Expand Down

0 comments on commit 0cd448a

Please sign in to comment.