This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chatfunction-parameters
- Loading branch information
Showing
57 changed files
with
1,662 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Compile | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
compile: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 8 | ||
|
||
- name: Compile | ||
run: ./gradlew compileJava compileTestJava |
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 |
---|---|---|
|
@@ -3,8 +3,6 @@ name: Test | |
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
|
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
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
24 changes: 24 additions & 0 deletions
24
api/src/main/java/com/theokanning/openai/assistants/Assistant.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,24 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class Assistant extends AssistantBase { | ||
|
||
/** | ||
* The identifier, which can be referenced in API endpoints. | ||
*/ | ||
String id; | ||
|
||
/** | ||
* The object type which is always 'assistant' | ||
*/ | ||
String object; | ||
|
||
/** | ||
* The Unix timestamp(in seconds) for when the assistant was created | ||
*/ | ||
@JsonProperty("created_at") | ||
Integer createdAt; | ||
} |
55 changes: 55 additions & 0 deletions
55
api/src/main/java/com/theokanning/openai/assistants/AssistantBase.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,55 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.NonNull; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class AssistantBase { | ||
|
||
/** | ||
* ID of the model to use | ||
*/ | ||
@NonNull | ||
String model; | ||
|
||
/** | ||
* The name of the assistant. The maximum length is 256 | ||
*/ | ||
String name; | ||
|
||
/** | ||
* The description of the assistant. | ||
*/ | ||
String description; | ||
|
||
/** | ||
* The system instructions that the assistant uses. | ||
*/ | ||
String instructions; | ||
|
||
/** | ||
* A list of tools enabled on the assistant. | ||
*/ | ||
List<Tool> tools; | ||
|
||
/** | ||
* A list of file IDs attached to this assistant. | ||
*/ | ||
@JsonProperty("file_ids") | ||
List<String> fields; | ||
|
||
/** | ||
* Set of 16 key-value pairs that can be attached to an object. | ||
*/ | ||
Map<String, String> metadata; | ||
} |
30 changes: 30 additions & 0 deletions
30
api/src/main/java/com/theokanning/openai/assistants/AssistantFile.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,30 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class AssistantFile { | ||
|
||
/** | ||
* The identifier of the Assistant File | ||
*/ | ||
String id; | ||
|
||
/** | ||
* The object type, which is always assistant.file. | ||
*/ | ||
String object; | ||
|
||
/** | ||
* The Unix timestamp (in seconds) for when the assistant file was created. | ||
*/ | ||
@JsonProperty("created_at") | ||
String createdAt; | ||
|
||
/** | ||
* The assistant ID that the file is attached to | ||
*/ | ||
@JsonProperty("assistant_id") | ||
String assistantId; | ||
} |
17 changes: 17 additions & 0 deletions
17
api/src/main/java/com/theokanning/openai/assistants/AssistantFileRequest.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,17 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class AssistantFileRequest { | ||
|
||
@JsonProperty("file_id") | ||
String fileId; | ||
} |
6 changes: 6 additions & 0 deletions
6
api/src/main/java/com/theokanning/openai/assistants/AssistantRequest.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,6 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
|
||
public class AssistantRequest extends AssistantBase { | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
api/src/main/java/com/theokanning/openai/assistants/AssistantSortOrder.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,12 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public enum AssistantSortOrder { | ||
|
||
@JsonProperty("asc") | ||
ASC, | ||
|
||
@JsonProperty("desc") | ||
DESC | ||
} |
15 changes: 15 additions & 0 deletions
15
api/src/main/java/com/theokanning/openai/assistants/AssistantToolsEnum.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,15 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public enum AssistantToolsEnum { | ||
|
||
@JsonProperty("code_interpreter") | ||
CODE_INTERPRETER, | ||
|
||
@JsonProperty("function") | ||
FUNCTION, | ||
|
||
@JsonProperty("retrieval") | ||
RETRIEVAL | ||
} |
16 changes: 16 additions & 0 deletions
16
api/src/main/java/com/theokanning/openai/assistants/ListAssistant.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,16 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.theokanning.openai.OpenAiResponse; | ||
|
||
public class ListAssistant<T extends AssistantBase> extends OpenAiResponse<T> { | ||
|
||
@JsonProperty("first_id") | ||
String firstId; | ||
|
||
@JsonProperty("last_id") | ||
String lastId; | ||
|
||
@JsonProperty("has_more") | ||
boolean hasMore; | ||
} |
39 changes: 39 additions & 0 deletions
39
api/src/main/java/com/theokanning/openai/assistants/ListAssistantQueryRequest.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,39 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class ListAssistantQueryRequest { | ||
/** | ||
* A limit on the number of objects to be returned. | ||
* Limit can range between 1 and 100, and the default is 20 | ||
*/ | ||
|
||
Integer limit; | ||
|
||
/** | ||
* Sort order by the 'created_at' timestamp of the objects. | ||
* 'asc' for ascending order and 'desc' for descending order. | ||
*/ | ||
AssistantSortOrder order; | ||
|
||
/** | ||
* A cursor for use in pagination. after is an object ID that defines your place in the list. | ||
* For instance, if you make a list request and receive 100 objects, ending with obj_foo, | ||
* your subsequent call can include after=obj_foo in order to fetch the next page of the list | ||
*/ | ||
String after; | ||
|
||
/** | ||
* A cursor for use in pagination. before is an object ID that defines your place in the list. | ||
* For instance, if you make a list request and receive 100 objects, ending with obj_foo, | ||
* your subsequent call can include before=obj_foo in order to fetch the previous page of the list. | ||
*/ | ||
String before; | ||
} |
12 changes: 12 additions & 0 deletions
12
api/src/main/java/com/theokanning/openai/assistants/Tool.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,12 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class Tool { | ||
AssistantToolsEnum type; | ||
} |
45 changes: 45 additions & 0 deletions
45
api/src/main/java/com/theokanning/openai/audio/CreateSpeechRequest.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,45 @@ | ||
package com.theokanning.openai.audio; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.NonNull; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class CreateSpeechRequest { | ||
|
||
/** | ||
* The name of the model to use. | ||
*/ | ||
@NonNull | ||
String model; | ||
|
||
/** | ||
* The text to generate audio for. The maximum length is 4096 characters. | ||
*/ | ||
@NonNull | ||
String input; | ||
|
||
/** | ||
* The voice to use when generating the audio. | ||
*/ | ||
@NonNull | ||
String voice; | ||
|
||
/** | ||
* The format to audio in. Supported formats are mp3, opus, aac, and flac. Defaults to mp3. | ||
*/ | ||
@JsonProperty("response_format") | ||
String responseFormat; | ||
|
||
/** | ||
* The speed of the generated audio. Select a value from 0.25 to 4.0. Defaults to 1.0. | ||
*/ | ||
Double speed; | ||
} |
29 changes: 29 additions & 0 deletions
29
api/src/main/java/com/theokanning/openai/billing/BillingUsage.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,29 @@ | ||
package com.theokanning.openai.billing; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.List; | ||
|
||
/** | ||
* Amount consumption information | ||
* | ||
*/ | ||
@Data | ||
public class BillingUsage { | ||
|
||
@JsonProperty("object") | ||
private String object; | ||
/** | ||
* Account expenditure details | ||
*/ | ||
@JsonProperty("daily_costs") | ||
private List<DailyCost> dailyCosts; | ||
/** | ||
* Total usage amount: cents | ||
*/ | ||
@JsonProperty("total_usage") | ||
private BigDecimal totalUsage; | ||
|
||
} |
Oops, something went wrong.