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.
Add MessageContent types and simplify list querying (#405)
Changed assistants to use the new shared ListSearchParams.
- Loading branch information
1 parent
4ff2758
commit 741cfe2
Showing
14 changed files
with
220 additions
and
68 deletions.
There are no files selected for viewing
16 changes: 0 additions & 16 deletions
16
api/src/main/java/com/theokanning/openai/assistants/ListAssistant.java
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
api/src/main/java/com/theokanning/openai/assistants/ListAssistantQueryRequest.java
This file was deleted.
Oops, something went wrong.
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
44 changes: 44 additions & 0 deletions
44
api/src/main/java/com/theokanning/openai/messages/content/Annotation.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,44 @@ | ||
package com.theokanning.openai.messages.content; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* An annotation for a text Message | ||
* <p> | ||
* https://platform.openai.com/docs/api-reference/messages/object | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Annotation { | ||
/** | ||
* The type of annotation, either file_citation or file_path | ||
*/ | ||
String type; | ||
|
||
/** | ||
* The text in the message content that needs to be replaced | ||
*/ | ||
String text; | ||
|
||
/** | ||
* File citation details, only present when type == file_citation | ||
*/ | ||
@JsonProperty("file_citation") | ||
FileCitation fileCitation; | ||
|
||
/** | ||
* File path details, only present when type == file_path | ||
*/ | ||
@JsonProperty("file_path") | ||
FilePath filePath; | ||
|
||
@JsonProperty("start_index") | ||
int startIndex; | ||
|
||
@JsonProperty("end_index") | ||
int endIndex; | ||
} |
29 changes: 29 additions & 0 deletions
29
api/src/main/java/com/theokanning/openai/messages/content/FileCitation.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.messages.content; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* A citation within the message that points to a specific quote from a specific File associated with the | ||
* assistant or the message. Generated when the assistant uses the "retrieval" tool to search files. | ||
* <p> | ||
* https://platform.openai.com/docs/api-reference/messages/object | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class FileCitation { | ||
|
||
/** | ||
* The ID of the specific File the citation is from. | ||
*/ | ||
@JsonProperty("file_id") | ||
String fileId; | ||
|
||
/** | ||
* The specific quote in the file. | ||
*/ | ||
String quote; | ||
} |
23 changes: 23 additions & 0 deletions
23
api/src/main/java/com/theokanning/openai/messages/content/FilePath.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,23 @@ | ||
package com.theokanning.openai.messages.content; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file. | ||
* <p> | ||
* https://platform.openai.com/docs/api-reference/messages/object | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class FilePath { | ||
|
||
/** | ||
* The ID of the file that was generated | ||
*/ | ||
@JsonProperty("file_id") | ||
String fileId; | ||
} |
23 changes: 23 additions & 0 deletions
23
api/src/main/java/com/theokanning/openai/messages/content/ImageFile.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,23 @@ | ||
package com.theokanning.openai.messages.content; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* References an image File int eh content of a message. | ||
* <p> | ||
* /https://platform.openai.com/docs/api-reference/messages/object | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ImageFile { | ||
|
||
/** | ||
* The File ID of the image in the message content. | ||
*/ | ||
@JsonProperty("file_id") | ||
String fileId; | ||
} |
28 changes: 28 additions & 0 deletions
28
api/src/main/java/com/theokanning/openai/messages/content/Text.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.messages.content; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* The text content that is part of a message | ||
* <p> | ||
* https://platform.openai.com/docs/api-reference/messages/object | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Text { | ||
|
||
/** | ||
* The data that makes up the text. | ||
*/ | ||
String value; | ||
|
||
/** | ||
* Text annotations that show additional details | ||
*/ | ||
List<Annotation> annotations; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"id": "msg_abc123", | ||
"object": "thread.message", | ||
"created_at": 1698983503, | ||
"thread_id": "thread_abc123", | ||
"role": "assistant", | ||
"content": [ | ||
{ | ||
"type": "text", | ||
"text": { | ||
"value": "Hi! How can I help you today?", | ||
"annotations": [ | ||
{ | ||
"type": "file_citation", | ||
"text": "file citation text", | ||
"file_citation": { | ||
"file_id": "file citation id", | ||
"quote": "Enough, Reggie" | ||
}, | ||
"start_index": 0, | ||
"end_index": 1 | ||
}, | ||
{ | ||
"type": "file_path", | ||
"text": "file path text", | ||
"file_path": { | ||
"file_id": "file id" | ||
}, | ||
"start_index": 1, | ||
"end_index": 2 | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "image_file", | ||
"image_file": { | ||
"file_id": "image file id" | ||
} | ||
} | ||
], | ||
"file_ids": [], | ||
"assistant_id": "asst_abc123", | ||
"run_id": "run_abc123", | ||
"metadata": {} | ||
} |
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
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