forked from TheoKanning/openai-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'TheoKanning:main' into main
- Loading branch information
Showing
76 changed files
with
2,733 additions
and
43 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
api/src/main/java/com/theokanning/openai/ListSearchParameters.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,51 @@ | ||
package com.theokanning.openai; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* Common options when getting a list of objects | ||
*/ | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class ListSearchParameters { | ||
/** | ||
* 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. | ||
*/ | ||
Order 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; | ||
|
||
public enum Order { | ||
@JsonProperty("asc") | ||
ASCENDING, | ||
|
||
@JsonProperty("desc") | ||
DESCENDING | ||
} | ||
} |
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
67 changes: 67 additions & 0 deletions
67
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,67 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class Assistant { | ||
|
||
/** | ||
* 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; | ||
|
||
/** | ||
* The name of the assistant. The maximum length is 256 | ||
*/ | ||
String name; | ||
|
||
/** | ||
* The description of the assistant. | ||
*/ | ||
String description; | ||
|
||
/** | ||
* ID of the model to use | ||
*/ | ||
@NonNull | ||
String model; | ||
|
||
/** | ||
* 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> fileIds; | ||
|
||
/** | ||
* 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; | ||
} |
28 changes: 28 additions & 0 deletions
28
api/src/main/java/com/theokanning/openai/assistants/AssistantFunction.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,28 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @description: | ||
* @author: vacuity | ||
* @create: 2023-11-20 10:09 | ||
**/ | ||
|
||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class AssistantFunction { | ||
|
||
private String description; | ||
|
||
private String name; | ||
|
||
private Map<String, Object> parameters; | ||
} |
52 changes: 52 additions & 0 deletions
52
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,52 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class AssistantRequest { | ||
|
||
/** | ||
* 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> fileIds; | ||
|
||
/** | ||
* Set of 16 key-value pairs that can be attached to an object. | ||
*/ | ||
Map<String, String> metadata; | ||
} |
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 | ||
} |
51 changes: 51 additions & 0 deletions
51
api/src/main/java/com/theokanning/openai/assistants/ModifyAssistantRequest.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,51 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class ModifyAssistantRequest { | ||
|
||
/** | ||
* ID of the model to use | ||
*/ | ||
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> fileIds; | ||
|
||
/** | ||
* Set of 16 key-value pairs that can be attached to an object. | ||
*/ | ||
Map<String, String> metadata; | ||
} |
20 changes: 20 additions & 0 deletions
20
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,20 @@ | ||
package com.theokanning.openai.assistants; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class Tool { | ||
/** | ||
* The type of tool being defined | ||
*/ | ||
AssistantToolsEnum type; | ||
|
||
/** | ||
* Function definition, only used if type is "function" | ||
*/ | ||
AssistantFunction function; | ||
} |
Oops, something went wrong.