Skip to content

Commit ae903d7

Browse files
authored
fix: Updated ThreadMessage struct with latest fields based on OpenAI docs (#792)
* fix: Updated ThreadMessage struct with latest fields based on OpenAI docs * fix: Reverted FileIDs for backward compatibility of v1
1 parent 92f4830 commit ae903d7

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

thread.go

+16-5
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,25 @@ type ModifyThreadRequest struct {
8383
type ThreadMessageRole string
8484

8585
const (
86-
ThreadMessageRoleUser ThreadMessageRole = "user"
86+
ThreadMessageRoleAssistant ThreadMessageRole = "assistant"
87+
ThreadMessageRoleUser ThreadMessageRole = "user"
8788
)
8889

8990
type ThreadMessage struct {
90-
Role ThreadMessageRole `json:"role"`
91-
Content string `json:"content"`
92-
FileIDs []string `json:"file_ids,omitempty"`
93-
Metadata map[string]any `json:"metadata,omitempty"`
91+
Role ThreadMessageRole `json:"role"`
92+
Content string `json:"content"`
93+
FileIDs []string `json:"file_ids,omitempty"`
94+
Attachments []ThreadAttachment `json:"attachments,omitempty"`
95+
Metadata map[string]any `json:"metadata,omitempty"`
96+
}
97+
98+
type ThreadAttachment struct {
99+
FileID string `json:"file_id"`
100+
Tools []ThreadAttachmentTool `json:"tools"`
101+
}
102+
103+
type ThreadAttachmentTool struct {
104+
Type string `json:"type"`
94105
}
95106

96107
type ThreadDeleteResponse struct {

0 commit comments

Comments
 (0)